]> 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)
committerMarkus Valentin <markus.valentin@open-xchange.com>
Tue, 1 Jun 2021 11:34:48 +0000 (13:34 +0200)
Allow an uninitialized acl backend when ignore_acls is set.

src/plugins/acl/acl-mailbox.c

index 57ff423483a854ad403cba3646eb41e245d107c8..7cc8775990ee7de29389dc94f0bf20f83525e924 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);
 }
 
@@ -622,8 +623,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) {