--- dbmail-imapsession.c.org 2009-08-26 17:08:29.000000000 +0200 +++ dbmail-imapsession.c 2009-08-26 17:10:47.576625914 +0200 @@ -811,6 +811,7 @@ static int _fetch_get_items(struct ImapSession *self, u64_t *uid) { int result; + int writeable; u64_t actual_cnt, tmpdumpsize; gchar *s = NULL; @@ -958,8 +959,15 @@ dbmail_imap_session_buff_append(self, "\r\n *BYE internal dbase error\r\n"); return -1; } + + /* also only adjust the seen flag if we can write to the mailbox */ + writeable = acl_has_right(&ud->mailbox, ud->userid, ACL_RIGHT_WRITE); + if (writeable == -1) { + dbmail_imap_session_buff_append(self, "\r\n *BYE internal dbase error\r\n"); + return -1; + } - if (result == 1) { + if ((result == 1) && (writeable == 1)) { result = db_set_msgflag(self->msg_idnr, ud->mailbox.uid, setSeenSet, IMAPFA_ADD); if (result == -1) { dbmail_imap_session_buff_append(self, "\r\n* BYE internal dbase error\r\n");