]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
IMAP ACLs: Let MYRIGHTS show the rights even if we don't have "r" permission.
authorTimo Sirainen <tss@iki.fi>
Sun, 16 Nov 2008 12:43:14 +0000 (14:43 +0200)
committerTimo Sirainen <tss@iki.fi>
Sun, 16 Nov 2008 12:43:14 +0000 (14:43 +0200)
--HG--
branch : HEAD

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

index ddb32724f275f63d1c966bc9956e32ca6f4cbc2a..101b16abff7de4df22a7e4401149b96e04ae1cfb 100644 (file)
@@ -74,10 +74,10 @@ acl_mailbox_open_as_admin(struct client_command_context *cmd, const char *name)
        /* not an administrator. */
        if (acl_mailbox_right_lookup(box, ACL_STORAGE_RIGHT_LOOKUP) <= 0) {
                client_send_tagline(cmd, t_strdup_printf(
-                       "["IMAP_RESP_CODE_NONEXISTENT"] "
+                       "NO ["IMAP_RESP_CODE_NONEXISTENT"] "
                        MAIL_ERRSTR_MAILBOX_NOT_FOUND, name));
        } else {
-               client_send_tagline(cmd, ERROR_NOT_ADMIN);
+               client_send_tagline(cmd, "NO "ERROR_NOT_ADMIN);
        }
        mailbox_close(&box);
        return NULL;
@@ -231,7 +231,8 @@ static bool cmd_myrights(struct client_command_context *cmd)
        if (storage == NULL)
                return TRUE;
 
-       box = mailbox_open(storage, real_mailbox, NULL, ACL_MAILBOX_OPEN_FLAGS);
+       box = mailbox_open(storage, real_mailbox, NULL, ACL_MAILBOX_OPEN_FLAGS |
+                          MAIL_STORAGE_FLAG_IGNORE_ACLS);
        if (box == NULL) {
                client_send_storage_error(cmd, storage);
                return TRUE;
@@ -243,6 +244,13 @@ static bool cmd_myrights(struct client_command_context *cmd)
                mailbox_close(&box);
                return TRUE;
        }
+       if (*rights == NULL) {
+               client_send_tagline(cmd, t_strdup_printf(
+                       "NO ["IMAP_RESP_CODE_NONEXISTENT"] "
+                       MAIL_ERRSTR_MAILBOX_NOT_FOUND, real_mailbox));
+               mailbox_close(&box);
+               return TRUE;
+       }
 
        str = t_str_new(128);
        str_append(str, "* MYRIGHTS ");