dovecot-2.1: imapc: Detect when message has been unexpectedly ex...

dovecot at dovecot.org dovecot at dovecot.org
Fri Oct 7 21:07:34 EEST 2011


details:   http://hg.dovecot.org/dovecot-2.1/rev/aaa0463aa66f
changeset: 13618:aaa0463aa66f
user:      Timo Sirainen <tss at iki.fi>
date:      Fri Oct 07 21:14:58 2011 +0300
description:
imapc: Detect when message has been unexpectedly expunged from index.

diffstat:

 src/lib-storage/index/imapc/imapc-mailbox.c |  12 +++++++++++-
 1 files changed, 11 insertions(+), 1 deletions(-)

diffs (29 lines):

diff -r 3058a10313bd -r aaa0463aa66f src/lib-storage/index/imapc/imapc-mailbox.c
--- a/src/lib-storage/index/imapc/imapc-mailbox.c	Fri Oct 07 20:50:02 2011 +0300
+++ b/src/lib-storage/index/imapc/imapc-mailbox.c	Fri Oct 07 21:14:58 2011 +0300
@@ -229,7 +229,8 @@
 		mbox->prev_skipped_uid = fetch_uid;
 	} else if (fetch_uid < imapc_msgmap_uidnext(msgmap)) {
 		imapc_mailbox_set_corrupted(mbox,
-			"Expunged message reappeared (uid=%u < next_uid=%u)",
+			"Expunged message reappeared in session "
+			"(uid=%u < next_uid=%u)",
 			fetch_uid, imapc_msgmap_uidnext(msgmap));
 		return -1;
 	} else {
@@ -237,6 +238,15 @@
 		imapc_msgmap_append(msgmap, rseq, uid);
 		if (uid < mbox->min_append_uid) {
 			/* message is already added to index */
+			if (!mbox->initial_sync_done &&
+			    !mail_index_lookup_seq(mbox->delayed_sync_view,
+						   uid, lseq_r)) {
+				imapc_mailbox_set_corrupted(mbox,
+					"Expunged message reappeared "
+					"(uid=%u < next_uid=%u)",
+					uid, mbox->min_append_uid);
+				return -1;
+			}
 		} else if (mbox->syncing) {
 			mail_index_append(mbox->delayed_sync_trans,
 					  uid, lseq_r);


More information about the dovecot-cvs mailing list