From: Timo Sirainen Date: Mon, 30 Sep 2013 06:04:43 +0000 (+0300) Subject: lib-storage: Fail with an error instead of crash with namespace prefix=inbox/ X-Git-Tag: 2.2.7~100 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=a31d634ec358e49e342d85f6f5c859fb961d83b3;p=thirdparty%2Fdovecot%2Fcore.git lib-storage: Fail with an error instead of crash with namespace prefix=inbox/ --- diff --git a/src/lib-storage/mail-storage.c b/src/lib-storage/mail-storage.c index 4e753f45c3..70cfbc7aa1 100644 --- a/src/lib-storage/mail-storage.c +++ b/src/lib-storage/mail-storage.c @@ -664,8 +664,18 @@ struct mailbox *mailbox_alloc(struct mailbox_list *list, const char *vname, server's internal configuration. */ if (vname[5] == '\0') vname = "INBOX"; - else if (vname[5] == mail_namespace_get_sep(list->ns)) + else if (vname[5] != mail_namespace_get_sep(list->ns)) + /* not INBOX prefix */ ; + else if (strncasecmp(list->ns->prefix, vname, 6) == 0 && + strncmp(list->ns->prefix, "INBOX", 5) != 0) { + mailbox_list_set_critical(list, + "Invalid server configuration: " + "Namespace prefix=%s must be uppercase INBOX", + list->ns->prefix); + open_error = MAIL_ERROR_TEMP; + } else { vname = t_strconcat("INBOX", vname + 5, NULL); + } } T_BEGIN {