dovecot-2.2: acl: Create struct acl_mailbox also for shared root...

dovecot at dovecot.org dovecot at dovecot.org
Thu Jul 3 17:43:37 UTC 2014


details:   http://hg.dovecot.org/dovecot-2.2/rev/5f21c78cd7b2
changeset: 17589:5f21c78cd7b2
user:      Timo Sirainen <tss at iki.fi>
date:      Thu Jul 03 20:42:08 2014 +0300
description:
acl: Create struct acl_mailbox also for shared root namespace mailboxes.
This fixes crashes where imap_acl code attempts to access ACLs for
nonexistent mailboxes inside shared root namespace. Alternatively the
imap_acl plugin could have checked the nonexistence of ACLs but this is
probably easier and more guaranteed to work.

diffstat:

 src/plugins/acl/acl-mailbox.c |  5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)

diffs (29 lines):

diff -r 51274bf2a47d -r 5f21c78cd7b2 src/plugins/acl/acl-mailbox.c
--- a/src/plugins/acl/acl-mailbox.c	Thu Jul 03 20:28:16 2014 +0300
+++ b/src/plugins/acl/acl-mailbox.c	Thu Jul 03 20:42:08 2014 +0300
@@ -561,6 +561,7 @@
 	struct acl_mailbox_list *alist = ACL_LIST_CONTEXT(box->list);
 	struct mailbox_vfuncs *v = box->vlast;
 	struct acl_mailbox *abox;
+	bool ignore_acls = (box->flags & MAILBOX_FLAG_IGNORE_ACLS) != 0;
 
 	if (alist == NULL) {
 		/* ACLs disabled */
@@ -570,7 +571,7 @@
 	if (mail_namespace_is_shared_user_root(box->list->ns)) {
 		/* this is the root shared namespace, which itself doesn't
 		   have any existing mailboxes. */
-		return;
+		ignore_acls = TRUE;
 	}
 
 	abox = p_new(box->pool, struct acl_mailbox, 1);
@@ -582,7 +583,7 @@
 						 mailbox_get_name(box));
 
 	v->free = acl_mailbox_free;
-	if ((box->flags & MAILBOX_FLAG_IGNORE_ACLS) == 0) {
+	if (ignore_acls) {
 		abox->acl_enabled = TRUE;
 		v->is_readonly = acl_is_readonly;
 		v->exists = acl_mailbox_exists;


More information about the dovecot-cvs mailing list