dovecot-2.2: dbox: dbox-alt-root symlink now points to the alt r...

dovecot at dovecot.org dovecot at dovecot.org
Thu Dec 13 12:24:39 EET 2012


details:   http://hg.dovecot.org/dovecot-2.2/rev/b1267f135417
changeset: 15462:b1267f135417
user:      Timo Sirainen <tss at iki.fi>
date:      Thu Dec 13 12:24:32 2012 +0200
description:
dbox: dbox-alt-root symlink now points to the alt root directory, not to mailboxes dir.
Existing mailboxes/ symlinks are silently changed to new ones. This also
means that accessing the dbox with an older version will log a warning about
the change.

diffstat:

 src/lib-storage/index/dbox-common/dbox-storage.c |  20 +++++++++++++++-----
 1 files changed, 15 insertions(+), 5 deletions(-)

diffs (49 lines):

diff -r 2125cf15b26d -r b1267f135417 src/lib-storage/index/dbox-common/dbox-storage.c
--- a/src/lib-storage/index/dbox-common/dbox-storage.c	Wed Dec 12 15:21:45 2012 +0200
+++ b/src/lib-storage/index/dbox-common/dbox-storage.c	Thu Dec 13 12:24:32 2012 +0200
@@ -30,8 +30,8 @@
 }
 
 static bool
-dbox_alt_path_has_changed(const char *root_dir,
-			  const char *alt_path, const char *alt_symlink_path)
+dbox_alt_path_has_changed(const char *root_dir, const char *alt_path,
+			  const char *alt_path2, const char *alt_symlink_path)
 {
 	const char *linkpath;
 
@@ -47,6 +47,13 @@
 			  "but currently no ALT path set", root_dir, linkpath);
 		return TRUE;
 	} else if (strcmp(linkpath, alt_path) != 0) {
+		if (strcmp(linkpath, alt_path2) == 0) {
+			/* FIXME: for backwards compatibility. old versions
+			   created the symlink to mailboxes/ directory, which
+			   was fine with sdbox, but didn't even exist with
+			   mdbox. we'll silently replace the symlink. */
+			return TRUE;
+		}
 		i_warning("dbox %s: Original ALT=%s, "
 			  "but currently ALT=%s", root_dir, linkpath, alt_path);
 		return TRUE;
@@ -56,14 +63,17 @@
 
 static void dbox_verify_alt_path(struct mailbox_list *list)
 {
-	const char *root_dir, *alt_symlink_path, *alt_path;
+	const char *root_dir, *alt_symlink_path, *alt_path, *alt_path2;
 
 	root_dir = mailbox_list_get_root_forced(list, MAILBOX_LIST_PATH_TYPE_DIR);
 	alt_symlink_path =
 		t_strconcat(root_dir, "/"DBOX_ALT_SYMLINK_NAME, NULL);
+	(void)mailbox_list_get_root_path(list, MAILBOX_LIST_PATH_TYPE_ALT_DIR,
+					 &alt_path);
 	(void)mailbox_list_get_root_path(list, MAILBOX_LIST_PATH_TYPE_ALT_MAILBOX,
-					 &alt_path);
-	if (!dbox_alt_path_has_changed(root_dir, alt_path, alt_symlink_path))
+					 &alt_path2);
+	if (!dbox_alt_path_has_changed(root_dir, alt_path, alt_path2,
+				       alt_symlink_path))
 		return;
 
 	/* unlink/create the current alt path symlink */


More information about the dovecot-cvs mailing list