}
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;
return FALSE;
}
}
+ *vnamep = vname;
return TRUE;
}
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));