dovecot-2.2: lib-storage: mailbox_list_index=yes wasn't working ...

dovecot at dovecot.org dovecot at dovecot.org
Thu Apr 11 16:55:03 EEST 2013


details:   http://hg.dovecot.org/dovecot-2.2/rev/309abf35676e
changeset: 16279:309abf35676e
user:      Timo Sirainen <tss at iki.fi>
date:      Thu Apr 11 16:54:53 2013 +0300
description:
lib-storage: mailbox_list_index=yes wasn't working with ACLs.

diffstat:

 src/lib-storage/list/mailbox-list-index.c |  20 +++++++++++++++++++-
 1 files changed, 19 insertions(+), 1 deletions(-)

diffs (37 lines):

diff -r 17b037da123b -r 309abf35676e src/lib-storage/list/mailbox-list-index.c
--- a/src/lib-storage/list/mailbox-list-index.c	Thu Apr 11 16:19:35 2013 +0300
+++ b/src/lib-storage/list/mailbox-list-index.c	Thu Apr 11 16:54:53 2013 +0300
@@ -536,7 +536,7 @@
 	return 0;
 }
 
-static void mailbox_list_index_created(struct mailbox_list *list)
+static void mailbox_list_index_created_last(struct mailbox_list *list)
 {
 	struct mailbox_list_index *ilist;
 	bool has_backing_store;
@@ -643,6 +643,24 @@
 	mailbox_list_index_backend_init_mailbox(box);
 }
 
+static struct mail_storage_hooks mailbox_list_index_hooks_last = {
+	.mailbox_list_created = mailbox_list_index_created_last
+};
+static bool mailbox_list_index_hooks_last_added = FALSE;
+
+static void mailbox_list_index_created(struct mailbox_list *list ATTR_UNUSED)
+{
+	/* We want our mailbox list index hooks to be called just before the
+	   backend methods are called. Most importantly the ACL plugin's hooks
+	   must be called before us, otherwise we'll end up skipping them and
+	   showing all the mailboxes. So we do this dual-registration where
+	   this second one gets us into the correct position. */
+	if (!mailbox_list_index_hooks_last_added) {
+		mailbox_list_index_hooks_last_added = TRUE;
+		mail_storage_hooks_add_internal(&mailbox_list_index_hooks_last);
+	}
+}
+
 static struct mail_storage_hooks mailbox_list_index_hooks = {
 	.mailbox_list_created = mailbox_list_index_created,
 	.mail_namespaces_added = mailbox_list_index_namespaces_added,


More information about the dovecot-cvs mailing list