dovecot-2.2: acl: Global ACL file used only the first matching r...

dovecot at dovecot.org dovecot at dovecot.org
Wed May 7 14:12:54 UTC 2014


details:   http://hg.dovecot.org/dovecot-2.2/rev/7a08a481c133
changeset: 17333:7a08a481c133
user:      Timo Sirainen <tss at iki.fi>
date:      Wed May 07 17:12:19 2014 +0300
description:
acl: Global ACL file used only the first matching rights line, not merging all the matches.

diffstat:

 src/plugins/acl/acl-global-file.c |  45 +++++++++++++++++---------------------
 1 files changed, 20 insertions(+), 25 deletions(-)

diffs (61 lines):

diff -r 774e486a94ab -r 7a08a481c133 src/plugins/acl/acl-global-file.c
--- a/src/plugins/acl/acl-global-file.c	Wed May 07 16:41:34 2014 +0300
+++ b/src/plugins/acl/acl-global-file.c	Wed May 07 17:12:19 2014 +0300
@@ -155,8 +155,24 @@
 	return 0;
 }
 
-static struct acl_global_rights *
-acl_global_file_find_rights(struct acl_global_file *file, const char *vname)
+void acl_global_file_get(struct acl_global_file *file, const char *vname,
+			 pool_t pool, ARRAY_TYPE(acl_rights) *rights_r)
+{
+	struct acl_global_rights *global_rights;
+	const struct acl_rights *rights;
+	struct acl_rights *new_rights;
+
+	array_foreach_modifiable(&file->rights, global_rights) {
+		if (!wildcard_match(vname, global_rights->vpattern))
+			continue;
+		array_foreach(&global_rights->rights, rights) {
+			new_rights = array_append_space(rights_r);
+			acl_rights_dup(rights, pool, new_rights);
+		}
+	}
+}
+
+bool acl_global_file_have_any(struct acl_global_file *file, const char *vname)
 {
 	struct acl_global_rights *rights;
 
@@ -164,28 +180,7 @@
 
 	array_foreach_modifiable(&file->rights, rights) {
 		if (wildcard_match(vname, rights->vpattern))
-			return rights;
+			return TRUE;
 	}
-	return NULL;
+	return FALSE;
 }
-
-void acl_global_file_get(struct acl_global_file *file, const char *vname,
-			 pool_t pool, ARRAY_TYPE(acl_rights) *rights_r)
-{
-	struct acl_global_rights *global_rights;
-	const struct acl_rights *rights;
-	struct acl_rights *new_rights;
-
-	global_rights = acl_global_file_find_rights(file, vname);
-	if (global_rights == NULL)
-		return;
-	array_foreach(&global_rights->rights, rights) {
-		new_rights = array_append_space(rights_r);
-		acl_rights_dup(rights, pool, new_rights);
-	}
-}
-
-bool acl_global_file_have_any(struct acl_global_file *file, const char *vname)
-{
-	return acl_global_file_find_rights(file, vname) != NULL;
-}


More information about the dovecot-cvs mailing list