]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
imapc: Fix potential assert-crash when reconnecting during syncing
authorTimo Sirainen <timo.sirainen@dovecot.fi>
Sat, 16 Jun 2018 16:37:27 +0000 (19:37 +0300)
committerTimo Sirainen <timo.sirainen@dovecot.fi>
Tue, 26 Jun 2018 08:29:10 +0000 (11:29 +0300)
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
src/lib-storage/index/imapc/imapc-sync.c

index bc051222619a2a93f4968245a91d7ba2e6389aaa..7b4a5c9f30e74d22832bb24e976600149116cff8 100644 (file)
@@ -620,6 +620,7 @@ static void imapc_mailbox_reopen(void *context)
                mbox->sync_next_rseq = 1;
        }
 
+       mbox->state_fetched_success = FALSE;
        mbox->initial_sync_done = FALSE;
        mbox->selecting = TRUE;
        mbox->selected = FALSE;
index 857271edee801b6cad4b880e3f208baafeb7ecf4..5941d66c50198a2a9ce829648d2ddd538aec7557 100644 (file)
@@ -411,6 +411,12 @@ static void imapc_sync_index(struct imapc_sync_context *ctx)
                imapc_mailbox_run(mbox);
        array_free(&ctx->expunged_uids);
 
+       if (!mbox->state_fetched_success) {
+               /* All the sync commands succeeded, but we got disconnected.
+                  imapc_initial_sync_check() will crash if we go there. */
+               ctx->failed = TRUE;
+       }
+
        /* add uidnext & highestmodseq after all appends */
        imapc_sync_uid_next(ctx);
        imapc_sync_highestmodseq(ctx);