dovecot-2.0: acl: When looking up ACL defaults, use global/local...

dovecot at dovecot.org dovecot at dovecot.org
Sun Aug 16 03:42:28 EEST 2009


details:   http://hg.dovecot.org/dovecot-2.0/rev/f906b5dbc5fb
changeset: 9800:f906b5dbc5fb
user:      Timo Sirainen <tss at iki.fi>
date:      Sat Aug 15 20:41:55 2009 -0400
description:
acl: When looking up ACL defaults, use global/local default files if they exist.

diffstat:

1 file changed, 10 insertions(+), 25 deletions(-)
src/plugins/acl/acl-api.c |   35 ++++++++++-------------------------

diffs (56 lines):

diff -r 529b02c56ebe -r f906b5dbc5fb src/plugins/acl/acl-api.c
--- a/src/plugins/acl/acl-api.c	Sat Aug 15 20:21:40 2009 -0400
+++ b/src/plugins/acl/acl-api.c	Sat Aug 15 20:41:55 2009 -0400
@@ -31,21 +31,13 @@ int acl_object_have_right(struct acl_obj
 	struct acl_backend *backend = aclobj->backend;
 	const struct acl_mask *have_mask;
 
-	if (*aclobj->name == '\0') {
-		/* we want to look up default rights */
+	if (backend->v.object_refresh_cache(aclobj) < 0)
+		return -1;
+
+	have_mask = acl_cache_get_my_rights(backend->cache, aclobj->name);
+	if (have_mask == NULL) {
 		if (acl_backend_get_default_rights(backend, &have_mask) < 0)
 			return -1;
-	} else {
-		if (backend->v.object_refresh_cache(aclobj) < 0)
-			return -1;
-
-		have_mask = acl_cache_get_my_rights(backend->cache,
-						    aclobj->name);
-		if (have_mask == NULL) {
-			if (acl_backend_get_default_rights(backend,
-							   &have_mask) < 0)
-				return -1;
-		}
 	}
 
 	return acl_cache_mask_isset(have_mask, right_idx);
@@ -89,20 +81,13 @@ static int acl_object_get_my_rights_real
 	struct acl_backend *backend = aclobj->backend;
 	const struct acl_mask *mask;
 
-	if (*aclobj->name == '\0') {
-		/* we want to look up default rights */
+	if (backend->v.object_refresh_cache(aclobj) < 0)
+		return -1;
+
+	mask = acl_cache_get_my_rights(backend->cache, aclobj->name);
+	if (mask == NULL) {
 		if (acl_backend_get_default_rights(backend, &mask) < 0)
 			return -1;
-	} else {
-		if (backend->v.object_refresh_cache(aclobj) < 0)
-			return -1;
-
-		mask = acl_cache_get_my_rights(backend->cache,
-					       aclobj->name);
-		if (mask == NULL) {
-			if (acl_backend_get_default_rights(backend, &mask) < 0)
-				return -1;
-		}
 	}
 
 	*rights_r = acl_backend_mask_get_names(backend, mask, pool);


More information about the dovecot-cvs mailing list