]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
lib-storage: Namespace prefix shouldn't be included in all mailbox name validity...
authorTimo Sirainen <timo.sirainen@open-xchange.com>
Mon, 22 Jul 2019 11:57:34 +0000 (14:57 +0300)
committerTimo Sirainen <timo.sirainen@open-xchange.com>
Mon, 22 Jul 2019 13:03:49 +0000 (16:03 +0300)
Broken by 90c2995737cc1f3fe042993beb7b0b32e5375795

src/lib-storage/mail-storage.c

index 351b5cd9ac940684dfab5bfca1351a4bbc1c473c..324ee6b7c998bc78d9ce81d35f9470a9a67a5913 100644 (file)
@@ -1040,10 +1040,10 @@ mailbox_name_verify_extra_separators(const char *vname, char sep,
 }
 
 static bool
-mailbox_verify_name_prefix(struct mailbox *box, const char **error_r)
+mailbox_verify_name_prefix(struct mail_namespace *ns, const char **vnamep,
+                          const char **error_r)
 {
-       const char *vname = box->vname;
-       struct mail_namespace *ns = box->list->ns;
+       const char *vname = *vnamep;
 
        if (ns->prefix_len == 0)
                return TRUE;
@@ -1071,6 +1071,7 @@ mailbox_verify_name_prefix(struct mailbox *box, const char **error_r)
                        return FALSE;
                }
        }
+       *vnamep = vname;
        return TRUE;
 }
 
@@ -1085,7 +1086,9 @@ int mailbox_verify_name(struct mailbox *box)
                return 0;
        }
 
-       if (!mailbox_verify_name_prefix(box, &error)) {
+       /* Verify the namespace prefix here. Change vname to skip the prefix
+          for the following checks. */
+       if (!mailbox_verify_name_prefix(box->list->ns, &vname, &error)) {
                mail_storage_set_error(box->storage, MAIL_ERROR_PARAMS,
                        t_strdup_printf("Invalid mailbox name '%s': %s",
                                        str_sanitize(vname, 80), error));