]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
acl: Create struct acl_mailbox also for shared root namespace mailboxes.
authorTimo Sirainen <tss@iki.fi>
Thu, 3 Jul 2014 17:42:08 +0000 (20:42 +0300)
committerTimo Sirainen <tss@iki.fi>
Thu, 3 Jul 2014 17:42:08 +0000 (20:42 +0300)
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.

src/plugins/acl/acl-mailbox.c

index bfe29b7f2b2ccffb0524fafac6700e438a13e668..81968cb9860eb175ab591f106ec0a85e2742631f 100644 (file)
@@ -561,6 +561,7 @@ void acl_mailbox_allocated(struct mailbox *box)
        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 @@ void acl_mailbox_allocated(struct mailbox *box)
        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 @@ void acl_mailbox_allocated(struct mailbox *box)
                                                 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;