dovecot-2.2: virtual: virtual_uids weren't always set to all mai...

dovecot at dovecot.org dovecot at dovecot.org
Wed Jun 17 11:28:31 UTC 2015


details:   http://hg.dovecot.org/dovecot-2.2/rev/d609454bdf64
changeset: 18880:d609454bdf64
user:      Timo Sirainen <tss at iki.fi>
date:      Wed Jun 17 14:25:48 2015 +0300
description:
virtual: virtual_uids weren't always set to all mails, causing missing mails and crashes in search.

diffstat:

 src/plugins/virtual/virtual-sync.c |  16 +++++++---------
 1 files changed, 7 insertions(+), 9 deletions(-)

diffs (40 lines):

diff -r ac8fc3db0ef6 -r d609454bdf64 src/plugins/virtual/virtual-sync.c
--- a/src/plugins/virtual/virtual-sync.c	Wed Jun 17 14:24:06 2015 +0300
+++ b/src/plugins/virtual/virtual-sync.c	Wed Jun 17 14:25:48 2015 +0300
@@ -1228,8 +1228,6 @@
 
 		if (bbox == NULL || bbox->mailbox_id != vrec->mailbox_id) {
 			/* add the rest of the newly seen messages */
-			i_assert(j == uidmap_count ||
-				 bbox->search_result != NULL);
 			for (; j < uidmap_count; j++) {
 				add_rec.rec.real_uid = uidmap[j].real_uid;
 				array_append(&ctx->all_adds, &add_rec, 1);
@@ -1247,11 +1245,6 @@
 			add_rec.rec.mailbox_id = bbox->mailbox_id;
 			bbox->sync_seen = TRUE;
 		}
-		if (bbox->search_result == NULL) {
-			/* mailbox is completely unchanged since last sync */
-			j = uidmap_count;
-			continue;
-		}
 		mail_index_lookup_uid(ctx->sync_view, vseq, &vuid);
 
 		/* if virtual record doesn't exist in uidmap, it's expunged */
@@ -1268,8 +1261,13 @@
 		else {
 			/* exists - update uidmap and flags */
 			uidmap[j++].virtual_uid = vuid;
-			virtual_sync_external_flags(ctx, bbox, vseq,
-						    vrec->real_uid);
+			if (bbox->search_result == NULL) {
+				/* mailbox is completely unchanged since last
+				   sync - no need to sync flags */
+			} else {
+				virtual_sync_external_flags(ctx, bbox, vseq,
+							    vrec->real_uid);
+			}
 		}
 	}
 	i_free(vmails);


More information about the dovecot-cvs mailing list