dovecot-2.0: dsync: Detect duplicate mailbox GUIDs and fail if i...

dovecot at dovecot.org dovecot at dovecot.org
Mon Jul 5 17:29:10 EEST 2010


details:   http://hg.dovecot.org/dovecot-2.0/rev/529e85c548a9
changeset: 11733:529e85c548a9
user:      Timo Sirainen <tss at iki.fi>
date:      Mon Jul 05 15:29:07 2010 +0100
description:
dsync: Detect duplicate mailbox GUIDs and fail if it happens.

diffstat:

 src/dsync/dsync-worker-local.c |  12 ++++++++++++
 1 files changed, 12 insertions(+), 0 deletions(-)

diffs (29 lines):

diff -r 8f6703ce6528 -r 529e85c548a9 src/dsync/dsync-worker-local.c
--- a/src/dsync/dsync-worker-local.c	Mon Jul 05 15:04:54 2010 +0100
+++ b/src/dsync/dsync-worker-local.c	Mon Jul 05 15:29:07 2010 +0100
@@ -480,6 +480,7 @@
 	uint8_t mailbox_guid[MAIL_GUID_128_SIZE];
 	struct local_dsync_mailbox_change *change;
 	struct local_dsync_dir_change *dir_change, change_lookup;
+	struct local_dsync_mailbox *old_lbox;
 	const char *const *fields;
 	unsigned int i, field_count;
 
@@ -550,6 +551,17 @@
 		array_append(&dsync_box_r->cache_fields, &field_name, 1);
 	}
 
+	old_lbox = hash_table_lookup(worker->mailbox_hash,
+				     &dsync_box_r->mailbox_guid);
+	if (old_lbox != NULL) {
+		i_error("Mailboxes don't have unique GUIDs: "
+			"%s is shared by %s and %s",
+			dsync_guid_to_str(&dsync_box_r->mailbox_guid),
+			old_lbox->storage_name, storage_name);
+		mailbox_free(&box);
+		_iter->failed = TRUE;
+		return -1;
+	}
 	local_dsync_worker_add_mailbox(worker, info->ns, storage_name,
 				       &dsync_box_r->mailbox_guid);
 	mailbox_free(&box);


More information about the dovecot-cvs mailing list