changeset 14135:ccad37bc242f

acl: After checking we have rights to create mailbox, ignore any further ACL checks.
author Timo Sirainen <tss@iki.fi>
date Sun, 12 Feb 2012 19:16:34 +0200
parents 1a0ab868957b
children 7c36dea5605a
files src/plugins/acl/acl-mailbox.c
diffstat 1 files changed, 11 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/src/plugins/acl/acl-mailbox.c	Sun Feb 12 18:59:20 2012 +0200
+++ b/src/plugins/acl/acl-mailbox.c	Sun Feb 12 19:16:34 2012 +0200
@@ -122,13 +122,18 @@
 		   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