]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
lib-storage: Create a default namespace for auto-created shared mail_users.
authorTimo Sirainen <tss@iki.fi>
Sun, 31 Mar 2013 13:46:11 +0000 (16:46 +0300)
committerTimo Sirainen <tss@iki.fi>
Sun, 31 Mar 2013 13:46:11 +0000 (16:46 +0300)
Some code nowadays requires user to have prefix="" namespace.

src/lib-storage/index/shared/shared-storage.c

index 5f3ff2241ddb5042827b2676d088dd161028aca3..3eca56c4f6602893ce083b99578f020759240cac 100644 (file)
@@ -318,11 +318,19 @@ int shared_storage_get_namespace(struct mail_namespace **_ns,
                p_strdup(user->pool, storage->unexpanded_location);
        new_ns->unexpanded_set = unexpanded_ns_set;
 
+       /* We need to create a prefix="" namespace for the owner */
+       if (mail_namespaces_init_location(owner, str_c(location), &error) < 0) {
+               mail_namespace_destroy(new_ns);
+               mail_user_unref(&owner);
+               return -1;
+       }
+
        if (mail_storage_create(new_ns, NULL, _storage->flags |
                                MAIL_STORAGE_FLAG_NO_AUTOVERIFY, &error) < 0) {
                mailbox_list_set_critical(list, "Namespace '%s': %s",
                                          new_ns->prefix, error);
                mail_namespace_destroy(new_ns);
+               mail_user_unref(&owner);
                return -1;
        }
        if ((new_ns->flags & NAMESPACE_FLAG_UNUSABLE) == 0 &&