dovecot-1.2: acl: Fixes to handling extended ACL names.

dovecot at dovecot.org dovecot at dovecot.org
Wed Nov 19 20:03:47 EET 2008


details:   http://hg.dovecot.org/dovecot-1.2/rev/645af8d240d6
changeset: 8455:645af8d240d6
user:      Timo Sirainen <tss at iki.fi>
date:      Wed Nov 19 20:03:43 2008 +0200
description:
acl: Fixes to handling extended ACL names.

diffstat:

1 file changed, 14 insertions(+), 7 deletions(-)
src/plugins/acl/acl-backend-vfile.c |   21 ++++++++++++++-------

diffs (46 lines):

diff -r ba5f7a4b89d6 -r 645af8d240d6 src/plugins/acl/acl-backend-vfile.c
--- a/src/plugins/acl/acl-backend-vfile.c	Wed Nov 19 20:03:33 2008 +0200
+++ b/src/plugins/acl/acl-backend-vfile.c	Wed Nov 19 20:03:43 2008 +0200
@@ -337,9 +337,12 @@ acl_parse_rights(pool_t pool, const char
 
 	if (*acl != '\0') {
 		/* parse our own extended ACLs */
-		i_assert(*acl == ':');
-
-		names = t_strsplit_spaces(acl, ", ");
+		if (*acl != ':') {
+			*error_r = "Missing ':' prefix in ACL extensions";
+			return NULL;
+		}
+
+		names = t_strsplit_spaces(acl + 1, ", ");
 		for (; *names != NULL; names++) {
 			const char *name = p_strdup(pool, *names);
 			array_append(&rights, &name, 1);
@@ -373,9 +376,9 @@ acl_object_vfile_parse_line(struct acl_o
 	rights.global = global;
 
 	right_names = acl_parse_rights(aclobj->rights_pool, p, &error);
-	if (*line != '-') {
+	if (*line != '-')
 		rights.rights = right_names;
-	} else {
+	else {
 		line++;
 		rights.neg_rights = right_names;
 	}
@@ -988,8 +991,12 @@ static void vfile_write_rights_list(stri
 		if (acl_letter_map[j].name == NULL) {
 			/* fallback to full name */
 			str_append_c(dest, ' ');
-			str_append(dest, rights[j]);
-		}
+			str_append(dest, rights[i]);
+		}
+	}
+	if (pos + 1 < str_len(dest)) {
+		c2[0] = ':';
+		str_insert(dest, pos + 1, c2);
 	}
 }
 


More information about the dovecot-cvs mailing list