]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
virtual: Fix assert-crash when backend mbox mailbox is deleted while virtual mailbox...
authorTimo Sirainen <timo.sirainen@open-xchange.com>
Thu, 7 Oct 2021 11:52:12 +0000 (14:52 +0300)
committertimo.sirainen <timo.sirainen@open-xchange.com>
Sat, 9 Oct 2021 20:02:39 +0000 (20:02 +0000)
The code wrongly thought that metadata lookup couldn't fail because it was
already successfully looked up. But the backend storage could still try to
refresh the mailbox to verify whether it still exists or not, and fail if
it was deleted.

This seems to have affected only the mbox mailbox format.

Broken by 710346bcb884b464c8ed128870fdc1999c13dfd3

src/plugins/virtual/virtual-sync.c

index f46e6201dc3d9cfe76405472a5727728bc769ee8..f8c6989a28403793d87677b5321bf468dd29c91b 100644 (file)
@@ -1261,10 +1261,13 @@ static void virtual_sync_backend_ext_header(struct virtual_sync_context *ctx,
                array_count(&bbox->sync_pending_removes) > 0 ? 0 :
                status.highest_modseq;
 
-       /* The caller already did this successfully, so we simply assert */
        if (mailbox_get_metadata(bbox->box, MAILBOX_METADATA_GUID,
-                                &metadata) < 0)
-               i_unreached();
+                                &metadata) < 0) {
+               /* Either a temporary failure or the mailbox was already
+                  deleted. Either way, it doesn't really matter at this point.
+                  We'll just leave the error handling until the next sync. */
+               return;
+       }
 
        if (virtual_bbox_mailbox_equals(bbox, &status, &metadata, &reason) &&
            bbox->ondisk_highest_modseq == wanted_ondisk_highest_modseq)