]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
lib-storage: Fail with an error instead of crash with namespace prefix=inbox/
authorTimo Sirainen <tss@iki.fi>
Mon, 30 Sep 2013 06:04:43 +0000 (09:04 +0300)
committerTimo Sirainen <tss@iki.fi>
Mon, 30 Sep 2013 06:04:43 +0000 (09:04 +0300)
src/lib-storage/mail-storage.c

index 4e753f45c33dead55419fbc69509e1230c61b5e3..70cfbc7aa1369662a1bd7eff4d2218eab46db3e1 100644 (file)
@@ -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 {