From: Timo Sirainen Date: Wed, 4 Aug 2010 16:18:54 +0000 (+0100) Subject: imap-acl: Don't allow accessing "" as mailbox. X-Git-Tag: 2.0.rc4~4 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=72d6e6f03b5f8c0ce15f75994fb42ff37e8db0b6;p=thirdparty%2Fdovecot%2Fcore.git imap-acl: Don't allow accessing "" as mailbox. --- diff --git a/src/plugins/imap-acl/imap-acl-plugin.c b/src/plugins/imap-acl/imap-acl-plugin.c index d17312450d..0d70b366d0 100644 --- a/src/plugins/imap-acl/imap-acl-plugin.c +++ b/src/plugins/imap-acl/imap-acl-plugin.c @@ -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 |