dovecot-2.2: acl: Don't unnecessarily rewrite dovecot-acl file w...

dovecot at dovecot.org dovecot at dovecot.org
Tue Mar 19 14:00:59 EET 2013


details:   http://hg.dovecot.org/dovecot-2.2/rev/45999b94692c
changeset: 16047:45999b94692c
user:      Timo Sirainen <tss at iki.fi>
date:      Tue Mar 19 14:00:21 2013 +0200
description:
acl: Don't unnecessarily rewrite dovecot-acl file when re-adding the same ACL.

diffstat:

 src/plugins/acl/acl-backend-vfile.c |  14 ++++++++++++--
 1 files changed, 12 insertions(+), 2 deletions(-)

diffs (31 lines):

diff -r 3e4c4f9c230b -r 45999b94692c src/plugins/acl/acl-backend-vfile.c
--- a/src/plugins/acl/acl-backend-vfile.c	Tue Mar 19 13:59:22 2013 +0200
+++ b/src/plugins/acl/acl-backend-vfile.c	Tue Mar 19 14:00:21 2013 +0200
@@ -992,6 +992,7 @@
 		       const struct acl_rights_update *update)
 {
 	struct acl_rights right;
+	bool c1, c2;
 
 	if (update->modify_mode == ACL_MODIFY_MODE_REMOVE &&
 	    update->neg_modify_mode == ACL_MODIFY_MODE_REMOVE) {
@@ -1003,8 +1004,17 @@
 	right.id_type = update->rights.id_type;
 	right.identifier = p_strdup(aclobj->rights_pool,
 				    update->rights.identifier);
-	array_insert(&aclobj->rights, idx, &right, 1);
-	return vfile_object_modify_right(aclobj, idx, update);
+
+	c1 = modify_right_list(aclobj->rights_pool, &right.rights,
+			       update->rights.rights, update->modify_mode);
+	c2 = modify_right_list(aclobj->rights_pool, &right.neg_rights,
+			       update->rights.neg_rights,
+			       update->neg_modify_mode);
+	if (c1 || c2) {
+		array_insert(&aclobj->rights, idx, &right, 1);
+		return TRUE;
+	}
+	return FALSE;
 }
 
 static void vfile_write_rights_list(string_t *dest, const char *const *rights)


More information about the dovecot-cvs mailing list