dovecot-2.1: acl: After checking we have rights to create mailbo...

dovecot at dovecot.org dovecot at dovecot.org
Sun Feb 12 19:16:50 EET 2012


details:   http://hg.dovecot.org/dovecot-2.1/rev/ccad37bc242f
changeset: 14135:ccad37bc242f
user:      Timo Sirainen <tss at iki.fi>
date:      Sun Feb 12 19:16:34 2012 +0200
description:
acl: After checking we have rights to create mailbox, ignore any further ACL checks.

diffstat:

 src/plugins/acl/acl-mailbox.c |  17 +++++++++++------
 1 files changed, 11 insertions(+), 6 deletions(-)

diffs (28 lines):

diff -r 1a0ab868957b -r ccad37bc242f src/plugins/acl/acl-mailbox.c
--- 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


More information about the dovecot-cvs mailing list