From: Timo Sirainen Date: Sun, 31 Mar 2013 13:46:11 +0000 (+0300) Subject: lib-storage: Create a default namespace for auto-created shared mail_users. X-Git-Tag: 2.2.rc4~54 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=e9081684ea0808ed427cfd2624656d5f22fbb225;p=thirdparty%2Fdovecot%2Fcore.git lib-storage: Create a default namespace for auto-created shared mail_users. Some code nowadays requires user to have prefix="" namespace. --- diff --git a/src/lib-storage/index/shared/shared-storage.c b/src/lib-storage/index/shared/shared-storage.c index 5f3ff2241d..3eca56c4f6 100644 --- a/src/lib-storage/index/shared/shared-storage.c +++ b/src/lib-storage/index/shared/shared-storage.c @@ -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 &&