]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
imap: If mailbox is inconsistent after syncing, don't try to sync message counts.
authorTimo Sirainen <timo.sirainen@dovecot.fi>
Tue, 27 Sep 2016 16:38:26 +0000 (19:38 +0300)
committerTimo Sirainen <timo.sirainen@dovecot.fi>
Thu, 13 Oct 2016 08:20:45 +0000 (10:20 +0200)
This fixes (e.g. after doveadm force-resync):
Panic: Message count decreased

src/imap/imap-sync.c

index 27f31d054301eeaddebdf5886a54975e9e0a349f..8b55e6f9ed6c66cc8559cf5fe28d91992a55e249 100644 (file)
@@ -326,6 +326,13 @@ static int imap_sync_finish(struct imap_sync_context *ctx, bool aborting)
                client_disconnect_with_error(client,
                                             "Mailbox UIDVALIDITY changed");
        }
+       if (mailbox_is_inconsistent(ctx->box)) {
+               client_disconnect_with_error(client,
+                       "IMAP session state is inconsistent, please relogin.");
+               /* we can't trust status information anymore, so don't try to
+                  sync message counts. */
+               return -1;
+       }
        if (!ctx->no_newmail && !aborting) {
                if (ctx->status.messages < ctx->messages_count)
                        i_panic("Message count decreased");