changeset 11931:85bdc6f6ff30

imap-acl: Don't allow accessing "" as mailbox.
author Timo Sirainen <tss@iki.fi>
date Wed, 04 Aug 2010 17:18:54 +0100
parents eb1f471a924d
children ad0ef9c40381
files src/plugins/imap-acl/imap-acl-plugin.c
diffstat 1 files changed, 7 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/src/plugins/imap-acl/imap-acl-plugin.c	Wed Aug 04 16:54:17 2010 +0100
+++ b/src/plugins/imap-acl/imap-acl-plugin.c	Wed Aug 04 17:18:54 2010 +0100
@@ -58,6 +58,7 @@
 	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 @@
 		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 |