dovecot-2.1: lib-storage: Another try at correctly setting autoc...

dovecot at dovecot.org dovecot at dovecot.org
Tue Feb 21 22:50:31 EET 2012


details:   http://hg.dovecot.org/dovecot-2.1/rev/3007994141b6
changeset: 14182:3007994141b6
user:      Timo Sirainen <tss at iki.fi>
date:      Tue Feb 21 22:50:14 2012 +0200
description:
lib-storage: Another try at correctly setting autocreated namespace's location strings.

diffstat:

 src/lib-storage/mail-namespace.c |  14 +++++++++-----
 1 files changed, 9 insertions(+), 5 deletions(-)

diffs (42 lines):

diff -r d9a6b0991f2e -r 3007994141b6 src/lib-storage/mail-namespace.c
--- a/src/lib-storage/mail-namespace.c	Tue Feb 21 15:21:19 2012 +0200
+++ b/src/lib-storage/mail-namespace.c	Tue Feb 21 22:50:14 2012 +0200
@@ -322,6 +322,7 @@
 	struct mail_namespace *ns;
 	const struct mail_storage_settings *mail_set;
 	const char *error, *driver, *location_source;
+	bool default_location = FALSE;
 
 	i_assert(location == NULL || *location != '\0');
 
@@ -345,9 +346,9 @@
 		inbox_set->location = p_strdup(user->pool, location);
 		location_source = "mail_location parameter";
 	} else if (*mail_set->mail_location != '\0') {
-		/* don't actually set it to namespace, since we'll default to
-		   it anyway */
 		location_source = "mail_location setting";
+		inbox_set->location = mail_set->mail_location;
+		default_location = TRUE;
 	} else {
 		location_source = "environment MAIL";
 		inbox_set->location = getenv("MAIL");
@@ -362,12 +363,15 @@
 			location_source = "environment MAILDIR";
 		}
 	}
-	if (*inbox_set->location != '\0') {
+	if (default_location) {
+		/* treat this the same as if a namespace was created with
+		   default settings. dsync relies on finding a namespace
+		   without explicit location setting. */
+		unexpanded_inbox_set->location = SETTING_STRVAR_UNEXPANDED;
+	} else {
 		unexpanded_inbox_set->location =
 			p_strconcat(user->pool, SETTING_STRVAR_EXPANDED,
 				    inbox_set->location, NULL);
-	} else {
-		unexpanded_inbox_set->location = SETTING_STRVAR_UNEXPANDED;
 	}
 
 	ns->set = inbox_set;


More information about the dovecot-cvs mailing list