]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
acl: If acl_ignore_namespace is set acl_backend can be NULL
authorMarkus Valentin <markus.valentin@open-xchange.com>
Tue, 1 Jun 2021 11:10:23 +0000 (13:10 +0200)
committeraki.tuomi <aki.tuomi@open-xchange.com>
Wed, 2 Jun 2021 06:33:37 +0000 (06:33 +0000)
Allow an uninitialized acl backend when ignore_acls is set.

src/plugins/acl/acl-mailbox.c

index e0fe9a60516d7c6035e615743cf86884a524881e..159f11fea6a481ceedced057325015a20e4fd7d0 100644 (file)
@@ -84,7 +84,8 @@ static void acl_mailbox_free(struct mailbox *box)
 {
        struct acl_mailbox *abox = ACL_CONTEXT_REQUIRE(box);
 
-       acl_object_deinit(&abox->aclobj);
+       if (abox->aclobj != NULL)
+               acl_object_deinit(&abox->aclobj);
        abox->module_ctx.super.free(box);
 }
 
@@ -628,8 +629,11 @@ void acl_mailbox_allocated(struct mailbox *box)
        box->vlast = &abox->module_ctx.super;
        /* aclobj can be used for setting ACLs, even when mailbox is opened
           with IGNORE_ACLS flag */
-       abox->aclobj = acl_object_init_from_name(alist->rights.backend,
+       if (alist->rights.backend != NULL)
+               abox->aclobj = acl_object_init_from_name(alist->rights.backend,
                                                 mailbox_get_name(box));
+       else
+               i_assert(ignore_acls);
 
        v->free = acl_mailbox_free;
        if (!ignore_acls) {