dovecot-2.2: acl: Fixed listing users who have only INBOX shared...

dovecot at dovecot.org dovecot at dovecot.org
Sun May 20 03:26:35 EEST 2012


details:   http://hg.dovecot.org/dovecot-2.2/rev/20c9446e537e
changeset: 14549:20c9446e537e
user:      Timo Sirainen <tss at iki.fi>
date:      Mon May 07 23:39:01 2012 +0300
description:
acl: Fixed listing users who have only INBOX shared and mail_shared_explicit_inbox=no

diffstat:

 src/plugins/acl/acl-shared-storage.c |  20 +++++++++++++++++++-
 1 files changed, 19 insertions(+), 1 deletions(-)

diffs (37 lines):

diff -r d3acee47cee4 -r 20c9446e537e src/plugins/acl/acl-shared-storage.c
--- a/src/plugins/acl/acl-shared-storage.c	Mon May 07 08:36:54 2012 +0300
+++ b/src/plugins/acl/acl-shared-storage.c	Mon May 07 23:39:01 2012 +0300
@@ -12,6 +12,24 @@
 
 #define SHARED_NS_RETRY_SECS (60*60)
 
+static bool acl_ns_prefix_exists(struct mail_namespace *ns)
+{
+	struct mailbox *box;
+	const char *vname;
+	enum mailbox_existence existence;
+	bool ret;
+
+	if (ns->list->mail_set->mail_shared_explicit_inbox)
+		return FALSE;
+
+	vname = t_strndup(ns->prefix, ns->prefix_len-1);
+	box = mailbox_alloc(ns->list, vname, 0);
+	ret = mailbox_exists(box, FALSE, &existence) == 0 &&
+		existence == MAILBOX_EXISTENCE_SELECT;
+	mailbox_free(&box);
+	return ret;
+}
+
 static void
 acl_shared_namespace_add(struct mail_namespace *ns,
 			 struct mail_storage *storage, const char *userdomain)
@@ -56,7 +74,7 @@
 		break;
 	(void)mailbox_list_iter_deinit(&iter);
 
-	if (info == NULL) {
+	if (info == NULL && !acl_ns_prefix_exists(new_ns)) {
 		/* no visible mailboxes, remove the namespace */
 		mail_namespace_destroy(new_ns);
 	}


More information about the dovecot-cvs mailing list