From: Marco Bettini Date: Thu, 13 Apr 2023 08:03:57 +0000 (+0000) Subject: lib-storage: index_list_mailbox_open() - Check that mailbox has not been deleted X-Git-Tag: 2.4.0~2792 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=1adf2ab810cba408fc601d831b3a537bf23d3069;p=thirdparty%2Fdovecot%2Fcore.git lib-storage: index_list_mailbox_open() - Check that mailbox has not been deleted Without this, removing a mailbox (obox) used in a virtual box fails to understand that the box has been removed intentionally and tries to recreate/rebuild it. --- diff --git a/src/lib-storage/list/mailbox-list-index-backend.c b/src/lib-storage/list/mailbox-list-index-backend.c index 88dd6c74e2..70f79ccef3 100644 --- a/src/lib-storage/list/mailbox-list-index-backend.c +++ b/src/lib-storage/list/mailbox-list-index-backend.c @@ -539,6 +539,16 @@ static int index_list_mailbox_open(struct mailbox *box) const unsigned char *name_hdr; size_t name_hdr_size; + if (!box->creating && (box->flags & MAILBOX_FLAG_OPEN_DELETED) == 0) { + if (mailbox_list_index_refresh(box->list) < 0) + return -1; + if (mailbox_list_index_lookup(box->list, box->name) == NULL) { + mail_storage_set_error(box->storage, MAIL_ERROR_NOTFOUND, + T_MAIL_ERR_MAILBOX_NOT_FOUND(box->name)); + return -1; + } + } + if (ibox->module_ctx.super.open(box) < 0) return -1;