From: Timo Sirainen Date: Thu, 7 Oct 2021 11:52:12 +0000 (+0300) Subject: virtual: Fix assert-crash when backend mbox mailbox is deleted while virtual mailbox... X-Git-Tag: 2.3.18~211 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=2aa531b4a469bf71f4c3b15da6cc1f45d3f9532f;p=thirdparty%2Fdovecot%2Fcore.git virtual: Fix assert-crash when backend mbox mailbox is deleted while virtual mailbox is open 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 --- diff --git a/src/plugins/virtual/virtual-sync.c b/src/plugins/virtual/virtual-sync.c index f46e6201dc..f8c6989a28 100644 --- a/src/plugins/virtual/virtual-sync.c +++ b/src/plugins/virtual/virtual-sync.c @@ -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)