From: Timo Sirainen Date: Thu, 11 Sep 2025 15:52:45 +0000 (+0300) Subject: acl: Fix potential crash when listing shared mailbox subscriptions X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=d424ad328b367cc5234816e0595c676c1d9e55e5;p=thirdparty%2Fdovecot%2Fcore.git acl: Fix potential crash when listing shared mailbox subscriptions This code is obsolete now that subscriptions handling was moved to lib-storage. Using IMAP LIST (SUBSCRIBED) resulted in a crash: Panic: file acl-mailbox-list.c: line 384 (acl_mailbox_list_info_is_visible): assertion failed: ((info->flags & PRESERVE_MAILBOX_FLAGS) != 0) --- diff --git a/src/plugins/acl/acl-mailbox-list.c b/src/plugins/acl/acl-mailbox-list.c index cb495b5bb7..7cab3e98ce 100644 --- a/src/plugins/acl/acl-mailbox-list.c +++ b/src/plugins/acl/acl-mailbox-list.c @@ -340,14 +340,6 @@ acl_mailbox_list_info_is_visible(struct mailbox_list_iterate_context *_ctx) return 1; } - if ((_ctx->flags & MAILBOX_LIST_ITER_SELECT_SUBSCRIBED) != 0 && - (_ctx->flags & MAILBOX_LIST_ITER_RETURN_NO_FLAGS) != 0) { - /* don't waste time doing an ACL check. we're going to list - all subscriptions anyway. */ - info->flags &= MAILBOX_SUBSCRIBED | MAILBOX_CHILD_SUBSCRIBED; - return 1; - } - acl_name = acl_mailbox_list_iter_get_name(_ctx, info->vname); ret = acl_mailbox_list_have_right(_ctx->list, acl_name, FALSE, ACL_STORAGE_RIGHT_LOOKUP); @@ -364,17 +356,6 @@ acl_mailbox_list_info_is_visible(struct mailbox_list_iterate_context *_ctx) return ret; } - /* no permission to see this mailbox */ - if ((_ctx->flags & MAILBOX_LIST_ITER_SELECT_SUBSCRIBED) != 0) { - /* we're listing subscribed mailboxes. this one or its child - is subscribed, so we'll need to list it. but since we don't - have LOOKUP right, we'll need to show it as nonexistent. */ - i_assert((info->flags & PRESERVE_MAILBOX_FLAGS) != 0); - info->flags = MAILBOX_NONEXISTENT | - (info->flags & PRESERVE_MAILBOX_FLAGS); - return 1; - } - if (!iter_is_listing_all_children(_ctx) && iter_mailbox_has_visible_children(_ctx, TRUE)) { /* no child mailboxes match the list pattern(s), but mailbox