dovecot-2.2: lib-storage: Added ALTNOCHECK option to mail_location.

dovecot at dovecot.org dovecot at dovecot.org
Wed Sep 26 18:01:30 EEST 2012


details:   http://hg.dovecot.org/dovecot-2.2/rev/a14f1d2e2b45
changeset: 15159:a14f1d2e2b45
user:      Timo Sirainen <tss at iki.fi>
date:      Mon Sep 24 14:42:38 2012 +0300
description:
lib-storage: Added ALTNOCHECK option to mail_location.
By default Dovecot verifies that $rootdir/dbox-alt-root symlink matches the
ALT directory location, and logs an error if not. This is mainly to avoid
accidents during initial configuration when for example alt dir was set in
global mail_location but was forgotten to be set in userdb reply's
mail_location. The ALTNOCHECK setting simply doesn't check or create this
symlink, giving a (very) small performance improvement.

diffstat:

 src/lib-storage/index/dbox-common/dbox-storage.c |  3 ++-
 src/lib-storage/mailbox-list.c                   |  6 +++++-
 src/lib-storage/mailbox-list.h                   |  2 ++
 3 files changed, 9 insertions(+), 2 deletions(-)

diffs (48 lines):

diff -r cc7906697d19 -r a14f1d2e2b45 src/lib-storage/index/dbox-common/dbox-storage.c
--- a/src/lib-storage/index/dbox-common/dbox-storage.c	Mon Sep 24 14:33:52 2012 +0300
+++ b/src/lib-storage/index/dbox-common/dbox-storage.c	Mon Sep 24 14:42:38 2012 +0300
@@ -107,7 +107,8 @@
 		storage->attachment_fs = fs_init(name, args, &fs_set);
 	} T_END;
 
-	dbox_verify_alt_path(ns->list);
+	if (!ns->list->set.alt_dir_nocheck)
+		dbox_verify_alt_path(ns->list);
 	return 0;
 }
 
diff -r cc7906697d19 -r a14f1d2e2b45 src/lib-storage/mailbox-list.c
--- a/src/lib-storage/mailbox-list.c	Mon Sep 24 14:33:52 2012 +0300
+++ b/src/lib-storage/mailbox-list.c	Mon Sep 24 14:42:38 2012 +0300
@@ -163,6 +163,7 @@
 	list->set.mailbox_dir_name =
 		p_strdup(list->pool, set->mailbox_dir_name);
 	list->set.alt_dir = p_strdup(list->pool, set->alt_dir);
+	list->set.alt_dir_nocheck = set->alt_dir_nocheck;
 
 	if (*set->mailbox_dir_name == '\0')
 		list->set.mailbox_dir_name = "";
@@ -294,7 +295,10 @@
 			dest = &set_r->control_dir;
 		else if (strcmp(key, "ALT") == 0)
 			dest = &set_r->alt_dir;
-		else if (strcmp(key, "LAYOUT") == 0)
+		else if (strcmp(key, "ALTNOCHECK") == 0) {
+			set_r->alt_dir_nocheck = TRUE;
+			continue;
+		} else if (strcmp(key, "LAYOUT") == 0)
 			dest = &set_r->layout;
 		else if (strcmp(key, "SUBSCRIPTIONS") == 0)
 			dest = &set_r->subscription_fname;
diff -r cc7906697d19 -r a14f1d2e2b45 src/lib-storage/mailbox-list.h
--- a/src/lib-storage/mailbox-list.h	Mon Sep 24 14:33:52 2012 +0300
+++ b/src/lib-storage/mailbox-list.h	Mon Sep 24 14:42:38 2012 +0300
@@ -145,6 +145,8 @@
 	char escape_char;
 	/* Use UTF-8 mailbox names on filesystem instead of mUTF-7 */
 	bool utf8;
+	/* Don't check/create the alt-dir symlink. */
+	bool alt_dir_nocheck;
 };
 
 struct mailbox_info {


More information about the dovecot-cvs mailing list