From: Timo Sirainen Date: Wed, 19 Nov 2008 18:03:43 +0000 (+0200) Subject: acl: Fixes to handling extended ACL names. X-Git-Tag: 1.2.alpha4~34 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=4213f20d2086ad5d3d1d82b5476fa1e9efdbb394;p=thirdparty%2Fdovecot%2Fcore.git acl: Fixes to handling extended ACL names. --HG-- branch : HEAD --- diff --git a/src/plugins/acl/acl-backend-vfile.c b/src/plugins/acl/acl-backend-vfile.c index 500440eea5..6af9c0077f 100644 --- a/src/plugins/acl/acl-backend-vfile.c +++ b/src/plugins/acl/acl-backend-vfile.c @@ -337,9 +337,12 @@ acl_parse_rights(pool_t pool, const char *acl, const char **error_r) if (*acl != '\0') { /* parse our own extended ACLs */ - i_assert(*acl == ':'); + if (*acl != ':') { + *error_r = "Missing ':' prefix in ACL extensions"; + return NULL; + } - names = t_strsplit_spaces(acl, ", "); + 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_object_vfile *aclobj, bool global, 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,9 +991,13 @@ static void vfile_write_rights_list(string_t *dest, const char *const *rights) 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); + } } static void