]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
imap-acl: Don't allow accessing "" as mailbox.
authorTimo Sirainen <tss@iki.fi>
Wed, 4 Aug 2010 16:18:54 +0000 (17:18 +0100)
committerTimo Sirainen <tss@iki.fi>
Wed, 4 Aug 2010 16:18:54 +0000 (17:18 +0100)
src/plugins/imap-acl/imap-acl-plugin.c

index d17312450d33d00535d870f11e58a961e1d01a8f..0d70b366d0b975704df99dff0ed6d7cea7b6df89 100644 (file)
@@ -58,6 +58,7 @@ acl_mailbox_open_as_admin(struct client_command_context *cmd, const char *name)
        struct mail_namespace *ns;
        struct mailbox *box;
        const char *storage_name;
+       enum mailbox_name_status status;
        int ret;
 
        if (ACL_USER_CONTEXT(cmd->client->user) == NULL) {
@@ -65,10 +66,15 @@ acl_mailbox_open_as_admin(struct client_command_context *cmd, const char *name)
                return NULL;
        }
 
-       ns = client_find_namespace(cmd, name, &storage_name, NULL);
+       ns = client_find_namespace(cmd, name, &storage_name, &status);
        if (ns == NULL)
                return NULL;
 
+       if (status == MAILBOX_NAME_INVALID) {
+               client_fail_mailbox_name_status(cmd, name, NULL, status);
+               return NULL;
+       }
+
        /* Force opening the mailbox so that we can give a nicer error message
           if mailbox isn't selectable but is listable. */
        box = mailbox_alloc(ns->list, storage_name, ACL_MAILBOX_FLAGS |