changeset 22908:27af5f2acc53

imapc: Fix local state if mailbox is empty after reconnection If local indexes had more than 0 mails, but after reconnection the remote IMAP server replied with "* 0 EXISTS", the mails in local index weren't expunged. This could have resulted in: Panic: file imapc-sync.c: line 328 (imapc_initial_sync_check): assertion failed: (mail_index_is_expunged(view, lseq) || seq_range_exists(&ctx->mbox->delayed_expunged_uids, luid))
author Timo Sirainen <timo.sirainen@dovecot.fi>
date Sun, 25 Mar 2018 23:15:58 +0300
parents 8b32d37472a0
children 091204834111
files src/lib-storage/index/imapc/imapc-mailbox.c
diffstat 1 files changed, 4 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/src/lib-storage/index/imapc/imapc-mailbox.c	Wed Apr 11 14:19:06 2018 +0300
+++ b/src/lib-storage/index/imapc/imapc-mailbox.c	Sun Mar 25 23:15:58 2018 +0300
@@ -220,8 +220,10 @@
 	struct imapc_command *cmd;
 
 	if (mbox->exists_count == 0) {
-		/* empty mailbox - no point in fetching anything */
-		mbox->state_fetched_success = TRUE;
+		/* empty mailbox - no point in fetching anything.
+		   just make sure everything is expunged in local index. */
+		mbox->sync_next_lseq = 1;
+		imapc_mailbox_fetch_state_finish(mbox);
 		return;
 	}
 	if (mbox->state_fetching_uid1) {