]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
acl: After checking we have rights to create mailbox, ignore any further ACL checks.
authorTimo Sirainen <tss@iki.fi>
Sun, 12 Feb 2012 17:16:34 +0000 (19:16 +0200)
committerTimo Sirainen <tss@iki.fi>
Sun, 12 Feb 2012 17:16:34 +0000 (19:16 +0200)
src/plugins/acl/acl-mailbox.c

index 3efa0aa528c6cb73bc3a94b717a340134f8b016e..54c0b2cf01cb69acfd48244c42d7668a519ac437 100644 (file)
@@ -122,13 +122,18 @@ acl_mailbox_create(struct mailbox *box, const struct mailbox_update *update,
                   bool directory)
 {
        struct acl_mailbox *abox = ACL_CONTEXT(box);
+       int ret;
 
-       /* we already checked permissions in list.mailbox_create_dir(). */
-       if (abox->module_ctx.super.create(box, update, directory) < 0)
-               return -1;
-
-       acl_mailbox_copy_acls_from_parent(box);
-       return 0;
+       /* we already checked permissions in list.mailbox_create_dir().
+          ignore ACLs in this mailbox until creation is complete, because
+          super.create() may call e.g. mailbox_open() which will fail since
+          we haven't yet copied ACLs to this mailbox. */
+       abox->skip_acl_checks = TRUE;
+       ret = abox->module_ctx.super.create(box, update, directory);
+       abox->skip_acl_checks = FALSE;
+       if (ret == 0)
+               acl_mailbox_copy_acls_from_parent(box);
+       return ret;
 }
 
 static int