From: Timo Sirainen Date: Tue, 17 Apr 2018 12:46:41 +0000 (+0300) Subject: imapc: Fix expunges+appends in same session with imapc_features=no-msn-updates X-Git-Tag: 2.3.2.rc1~180 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=06855565c79d63e29a97abedd79681c38e551713;p=thirdparty%2Fdovecot%2Fcore.git imapc: Fix expunges+appends in same session with imapc_features=no-msn-updates Since the EXPUNGEs were ignored, the sequence numbers weren't updated. When a new mail arrived, the sequence number sent by the remote IMAP server pointed to existing mails in imapc's mapping. Fix this by changing the sequence number if the returned UID is >= next_uid. Fixes "FETCH UID mismatch" errors. --- diff --git a/src/lib-storage/index/imapc/imapc-mailbox.c b/src/lib-storage/index/imapc/imapc-mailbox.c index 24bf4ba60b..0a1bb6e0fa 100644 --- a/src/lib-storage/index/imapc/imapc-mailbox.c +++ b/src/lib-storage/index/imapc/imapc-mailbox.c @@ -372,6 +372,14 @@ imapc_mailbox_msgmap_update(struct imapc_mailbox *mbox, if (imapc_msgmap_uid_to_rseq(msgmap, fetch_uid, &fixed_rseq)) rseq = fixed_rseq; + else if (fetch_uid >= imapc_msgmap_uidnext(msgmap) && + rseq <= msg_count) { + /* The current rseq is wrong. Lets hope that the + correct rseq is the next new one. This happens + especially with no-msn-updates when mails have been + expunged and new mails arrive in the same session. */ + rseq = msg_count+1; + } } if (rseq <= msg_count) {