]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
lib-storage: Fixed crashing on accessing shared mailboxes.
authorTimo Sirainen <tss@iki.fi>
Fri, 11 Jun 2010 15:14:47 +0000 (16:14 +0100)
committerTimo Sirainen <tss@iki.fi>
Fri, 11 Jun 2010 15:14:47 +0000 (16:14 +0100)
--HG--
branch : HEAD

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

index 4b5e70e0fc7f7bfb76b558f2c4fc0c694683e145..afeae7aa888dcc02aa001164c0d28409555cbff1 100644 (file)
@@ -43,6 +43,8 @@ shared_storage_create(struct mail_storage *_storage, struct mail_namespace *ns,
        }
        driver = t_strdup_until(ns->set->location, p);
        storage->location = p_strdup(_storage->pool, ns->set->location);
+       storage->unexpanded_location =
+               p_strdup(_storage->pool, ns->unexpanded_set->location);
        storage->storage_class = mail_storage_find_class(driver);
        if (storage->storage_class == NULL) {
                *error_r = t_strconcat("Unknown shared storage driver: ",
@@ -123,7 +125,7 @@ int shared_storage_get_namespace(struct mail_namespace **_ns,
        };
        struct var_expand_table *tab;
        struct mail_namespace *new_ns, *ns = *_ns;
-       struct mail_namespace_settings *ns_set;
+       struct mail_namespace_settings *ns_set, *unexpanded_ns_set;
        struct mail_user *owner;
        const char *domain = NULL, *username = NULL, *userdomain = NULL;
        const char *name, *p, *next, **dest, *error;
@@ -276,6 +278,13 @@ int shared_storage_get_namespace(struct mail_namespace **_ns,
        ns_set->list = "yes";
        new_ns->set = ns_set;
 
+       unexpanded_ns_set =
+               p_new(user->pool, struct mail_namespace_settings, 1);
+       *unexpanded_ns_set = *ns_set;
+       unexpanded_ns_set->location =
+               p_strdup(user->pool, storage->unexpanded_location);
+       new_ns->unexpanded_set = unexpanded_ns_set;
+
        if (mail_storage_create(new_ns, NULL, _storage->flags, &error) < 0) {
                mailbox_list_set_critical(list, "Namespace '%s': %s",
                                          new_ns->prefix, error);
index a6f7e0410970b43fb72d2fafb2a09138bb6ee665..b2b5cc8750a5e55ed11118630deb40ee333febb4 100644 (file)
@@ -8,7 +8,7 @@ struct shared_storage {
        union mailbox_list_module_context list_module_ctx;
 
        const char *ns_prefix_pattern;
-       const char *location;
+       const char *location, *unexpanded_location;
 
        struct mail_storage *storage_class;
 };