From becb0ee0d5468864bf695942829203fd86647c3e Mon Sep 17 00:00:00 2001 From: Markus Valentin Date: Thu, 20 May 2021 14:27:46 +0200 Subject: [PATCH] imap-acl: Allow LISTRIGHT replies without opening as admin 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 | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/src/plugins/imap-acl/imap-acl-plugin.c b/src/plugins/imap-acl/imap-acl-plugin.c index 4d716044dc..dc5828bd62 100644 --- a/src/plugins/imap-acl/imap-acl-plugin.c +++ b/src/plugins/imap-acl/imap-acl-plugin.c @@ -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, ' '); -- 2.47.3