]> 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>
Tue, 26 Jun 2018 08:29:07 +0000 (11:29 +0300)
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 5ba9ba3ba5bf87851531c9fd185b29ef9b9fed2a..bc051222619a2a93f4968245a91d7ba2e6389aaa 100644 (file)
@@ -611,6 +611,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;