]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
imapc: Fix assert-crash when reconnecting during initial FETCH finds expunges
authorTimo Sirainen <timo.sirainen@dovecot.fi>
Sat, 16 Jun 2018 12:56:26 +0000 (15:56 +0300)
committerTimo Sirainen <timo.sirainen@dovecot.fi>
Mon, 18 Jun 2018 19:10:12 +0000 (19:10 +0000)
The initial FETCH is automatically retried on failure, but the FETCH state
wasn't reset during the reconnection.

Fixes:
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))

src/lib-storage/index/imapc/imapc-storage.c

index eda298151a79a91dbf37495d947deb83b161a712..d7b5ba185d0fed0f67e4ade9dae711208a2da2ca 100644 (file)
@@ -619,6 +619,14 @@ static void imapc_mailbox_reopen(void *context)
                i_assert(!mbox->initial_sync_done);
                return;
        }
+       if (!mbox->initial_sync_done) {
+               /* Initial FETCH 1:* didn't fully succeed. We're reconnecting
+                  and lib-imap-client is automatically resending it. But we
+                  need to reset the sync_next_* state so that if any of the
+                  mails are now expunged we won't get confused and crash. */
+               mbox->sync_next_lseq = 1;
+               mbox->sync_next_rseq = 1;
+       }
 
        mbox->initial_sync_done = FALSE;
        mbox->selecting = TRUE;