]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
acl: Fix potential crash when listing shared mailbox subscriptions
authorTimo Sirainen <timo.sirainen@open-xchange.com>
Thu, 11 Sep 2025 15:52:45 +0000 (18:52 +0300)
committeraki.tuomi <aki.tuomi@open-xchange.com>
Tue, 30 Sep 2025 05:48:46 +0000 (05:48 +0000)
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)

src/plugins/acl/acl-mailbox-list.c

index cb495b5bb74d3cf9091f2a54dd1c666d9839f795..7cab3e98ce661fff8409e5edd5beffd00285b134 100644 (file)
@@ -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