From 72d6e6f03b5f8c0ce15f75994fb42ff37e8db0b6 Mon Sep 17 00:00:00 2001 From: Timo Sirainen Date: Wed, 4 Aug 2010 17:18:54 +0100 Subject: [PATCH] imap-acl: Don't allow accessing "" as mailbox. --- src/plugins/imap-acl/imap-acl-plugin.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) 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 | -- 2.47.3