From: Timo Sirainen Date: Wed, 27 Jul 2011 16:46:01 +0000 (+0300) Subject: imap-quota: Don't crash if invalid mailbox name is given to GETQUOTAROOT. X-Git-Tag: 2.0.14~24 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=d12d1accd6060eee70375f1e6122425a159114e4;p=thirdparty%2Fdovecot%2Fcore.git imap-quota: Don't crash if invalid mailbox name is given to GETQUOTAROOT. --- diff --git a/src/plugins/imap-quota/imap-quota-plugin.c b/src/plugins/imap-quota/imap-quota-plugin.c index 5ac7cef7cd..738af632fe 100644 --- a/src/plugins/imap-quota/imap-quota-plugin.c +++ b/src/plugins/imap-quota/imap-quota-plugin.c @@ -74,6 +74,7 @@ static bool cmd_getquotaroot(struct client_command_context *cmd) struct mailbox *box; struct quota_root_iter *iter; struct quota_root *root; + enum mailbox_name_status status; const char *mailbox, *storage_name, *name; string_t *quotaroot_reply, *quota_reply; @@ -81,7 +82,7 @@ static bool cmd_getquotaroot(struct client_command_context *cmd) if (!client_read_string_args(cmd, 1, &mailbox)) return FALSE; - ns = client_find_namespace(cmd, mailbox, &storage_name, NULL); + ns = client_find_namespace(cmd, mailbox, &storage_name, &status); if (ns == NULL) return TRUE; @@ -94,6 +95,10 @@ static bool cmd_getquotaroot(struct client_command_context *cmd) client_send_tagline(cmd, "NO Not showing other users' quota."); return TRUE; } + if (status == MAILBOX_NAME_INVALID) { + client_fail_mailbox_name_status(cmd, mailbox, NULL, status); + return TRUE; + } box = mailbox_alloc(ns->list, storage_name, MAILBOX_FLAG_READONLY | MAILBOX_FLAG_KEEP_RECENT);