]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
imap-acl: Allow LISTRIGHT replies without opening as admin
authorMarkus Valentin <markus.valentin@open-xchange.com>
Thu, 20 May 2021 12:27:46 +0000 (14:27 +0200)
committerMarkus Valentin <markus.valentin@open-xchange.com>
Wed, 26 May 2021 10:02:06 +0000 (12:02 +0200)
As the reply is hardcoded there is no need to proxy the ACL
command to a remote backend in case imapc_feature "acl" is
enabled.

src/plugins/imap-acl/imap-acl-plugin.c

index 4d716044dc96fe2c513633870d2f387414282c18..dc5828bd626b587a166bbf5dd09dba5e7aca4b48 100644 (file)
@@ -706,19 +706,24 @@ static bool cmd_myrights(struct client_command_context *cmd)
 static bool cmd_listrights(struct client_command_context *cmd)
 {
        struct mailbox *box;
-       const char *mailbox, *identifier;
+       struct mail_namespace *ns;
+       const char *mailbox, *orig_mailbox, *identifier;
        string_t *str;
 
        if (!client_read_string_args(cmd, 2, &mailbox, &identifier))
                return FALSE;
+       orig_mailbox = mailbox;
 
-       box = acl_mailbox_open_as_admin(cmd, mailbox);
-       if (box == NULL)
+       ns = client_find_namespace(cmd, &mailbox);
+       if (ns == NULL)
                return TRUE;
 
+       box = mailbox_alloc(ns->list, mailbox,
+                           MAILBOX_FLAG_READONLY | MAILBOX_FLAG_IGNORE_ACLS);
+
        str = t_str_new(128);
        str_append(str, "* LISTRIGHTS ");
-       imap_append_astring(str, mailbox);
+       imap_append_astring(str, orig_mailbox);
        str_append_c(str, ' ');
        imap_append_astring(str, identifier);
        str_append_c(str, ' ');