dovecot-2.1: lib-storage: Don't try to use the same mail_storage...

dovecot at dovecot.org dovecot at dovecot.org
Fri Sep 16 16:02:09 EEST 2011


details:   http://hg.dovecot.org/dovecot-2.1/rev/cfbca51c0ade
changeset: 13468:cfbca51c0ade
user:      Timo Sirainen <tss at iki.fi>
date:      Fri Sep 16 16:01:29 2011 +0300
description:
lib-storage: Don't try to use the same mail_storage for shared storages.
This fixes having multiple independent shared namespaces.

diffstat:

 src/lib-storage/mail-storage.c |  25 +++++++++++++++++++++----
 1 files changed, 21 insertions(+), 4 deletions(-)

diffs (42 lines):

diff -r 080c8f9521d2 -r cfbca51c0ade src/lib-storage/mail-storage.c
--- a/src/lib-storage/mail-storage.c	Fri Sep 16 14:52:29 2011 +0300
+++ b/src/lib-storage/mail-storage.c	Fri Sep 16 16:01:29 2011 +0300
@@ -260,6 +260,26 @@
 	}
 }
 
+static bool
+mail_storage_match_class(struct mail_storage *storage,
+			 const struct mail_storage *storage_class,
+			 const struct mailbox_list_settings *set)
+{
+	if (strcmp(storage->name, storage_class->name) != 0)
+		return FALSE;
+
+	if ((storage->class_flags & MAIL_STORAGE_CLASS_FLAG_UNIQUE_ROOT) != 0 &&
+	    strcmp(storage->unique_root_dir, set->root_dir) != 0)
+		return FALSE;
+
+	if (strcmp(storage->name, "shared") == 0) {
+		/* allow multiple independent shared namespaces */
+		return FALSE;
+	}
+
+	return storage;
+}
+
 static struct mail_storage *
 mail_storage_find(struct mail_user *user,
 		  const struct mail_storage *storage_class,
@@ -268,10 +288,7 @@
 	struct mail_storage *storage = user->storages;
 
 	for (; storage != NULL; storage = storage->next) {
-		if (strcmp(storage->name, storage_class->name) == 0 &&
-		    ((storage->class_flags &
-		      MAIL_STORAGE_CLASS_FLAG_UNIQUE_ROOT) == 0 ||
-		     strcmp(storage->unique_root_dir, set->root_dir) == 0))
+		if (mail_storage_match_class(storage, storage_class, set))
 			return storage;
 	}
 	return NULL;


More information about the dovecot-cvs mailing list