dovecot-2.2: dsync: Allow syncing same mail root dirs if indexes...

dovecot at dovecot.org dovecot at dovecot.org
Tue Mar 26 22:41:48 EET 2013


details:   http://hg.dovecot.org/dovecot-2.2/rev/0c52fb39ca3d
changeset: 16118:0c52fb39ca3d
user:      Timo Sirainen <tss at iki.fi>
date:      Tue Mar 26 22:40:57 2013 +0200
description:
dsync: Allow syncing same mail root dirs if indexes are different.
Fixes dsyncing with storages that have no mail root dirs.

diffstat:

 src/doveadm/dsync/doveadm-dsync.c |  23 +++++++++++++++--------
 1 files changed, 15 insertions(+), 8 deletions(-)

diffs (41 lines):

diff -r 494d1a69fc1c -r 0c52fb39ca3d src/doveadm/dsync/doveadm-dsync.c
--- a/src/doveadm/dsync/doveadm-dsync.c	Tue Mar 26 22:39:38 2013 +0200
+++ b/src/doveadm/dsync/doveadm-dsync.c	Tue Mar 26 22:40:57 2013 +0200
@@ -276,6 +276,16 @@
 	return TRUE;
 }
 
+static bool paths_are_equal(struct mail_user *user1, struct mail_user *user2,
+			    enum mailbox_list_path_type type)
+{
+	const char *path1, *path2;
+
+	return mailbox_list_get_root_path(user1->namespaces->list, type, &path1) &&
+		mailbox_list_get_root_path(user2->namespaces->list, type, &path2) &&
+		strcmp(path1, path2) == 0;
+}
+
 static int
 cmd_dsync_run_local(struct dsync_cmd_context *ctx, struct mail_user *user,
 		    struct dsync_brain *brain, struct dsync_ibc *ibc2)
@@ -315,15 +325,12 @@
 		mail_user_unref(&user2);
 		return -1;
 	}
-	if (mailbox_list_get_root_path(user->namespaces->list,
-				       MAILBOX_LIST_PATH_TYPE_MAILBOX,
-				       &path1) &&
-	    mailbox_list_get_root_path(user2->namespaces->list,
-				       MAILBOX_LIST_PATH_TYPE_MAILBOX,
-				       &path2) &&
-	    strcmp(path1, path2) == 0) {
+	if (paths_are_equal(user, user2, MAILBOX_LIST_PATH_TYPE_MAILBOX) &&
+	    paths_are_equal(user, user2, MAILBOX_LIST_PATH_TYPE_INDEX)) {
 		i_error("Both source and destination mail_location "
-			"points to same directory: %s", path1);
+			"points to same directory: %s",
+			mailbox_list_get_root_forced(user->namespaces->list,
+						     MAILBOX_LIST_PATH_TYPE_MAILBOX));
 		ctx->ctx.exit_code = EX_CONFIG;
 		mail_user_unref(&user2);
 		return -1;


More information about the dovecot-cvs mailing list