dovecot-2.0: lib-storage: Fixed crashing on accessing shared mai...

dovecot at dovecot.org dovecot at dovecot.org
Fri Jun 11 18:14:56 EEST 2010


details:   http://hg.dovecot.org/dovecot-2.0/rev/f37d19f1c0a3
changeset: 11520:f37d19f1c0a3
user:      Timo Sirainen <tss at iki.fi>
date:      Fri Jun 11 16:14:47 2010 +0100
description:
lib-storage: Fixed crashing on accessing shared mailboxes.

diffstat:

 src/lib-storage/index/shared/shared-storage.c |  11 ++++++++++-
 src/lib-storage/index/shared/shared-storage.h |   2 +-
 2 files changed, 11 insertions(+), 2 deletions(-)

diffs (47 lines):

diff -r e6185d7c9732 -r f37d19f1c0a3 src/lib-storage/index/shared/shared-storage.c
--- a/src/lib-storage/index/shared/shared-storage.c	Fri Jun 11 15:56:27 2010 +0100
+++ b/src/lib-storage/index/shared/shared-storage.c	Fri Jun 11 16:14:47 2010 +0100
@@ -43,6 +43,8 @@
 	}
 	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 @@
 	};
 	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 @@
 	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);
diff -r e6185d7c9732 -r f37d19f1c0a3 src/lib-storage/index/shared/shared-storage.h
--- a/src/lib-storage/index/shared/shared-storage.h	Fri Jun 11 15:56:27 2010 +0100
+++ b/src/lib-storage/index/shared/shared-storage.h	Fri Jun 11 16:14:47 2010 +0100
@@ -8,7 +8,7 @@
 	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;
 };


More information about the dovecot-cvs mailing list