Hi Timo, thanks for your reply!
Timo Sirainen <t...@iki.fi> writes: > On Fri, 2009-02-06 at 12:29 +0100, Sascha Wilde wrote: >> I just recognized that the new imap-acl plugin in dovecot 1.2 does not >> know the obsolete rights 'd' and 'c' when setting. > .. >> [0] I don't like the use of static indexes witch imap_acl_letter_map but >> currently I wasn't able to decide on a more elegant solution. > > How about instead of > > array_append(rights, &imap_acl_letter_map[8].name > > something like: > > str = MAIL_ACL_CREATE; > array_append(rights, &str I gave it a try in the attached patch. Actually I considered that my self but I'm (still) not sure if this is 100% legal according to the standard. Partly this is because I haven't fully understood which information from the array "rights" is retained outside the function (by means of "rights_r"). Partly its because I'm not sure if it's ok to refer to the immediate string value used to initialize an automatic variable outside the function. In case you are sure the attached version is kosher I would indeed like it better than the first. cheers sascha -- Sascha Wilde OpenPGP key: 4BB86568 http://www.intevation.de/~wilde/ http://www.intevation.de/ Intevation GmbH, Neuer Graben 17, 49074 Osnabrück; AG Osnabrück, HR B 18998 Geschäftsführer: Frank Koormann, Bernhard Reiter, Dr. Jan-Oliver Wagner
diff -r df8bcff0ee01 src/plugins/imap-acl/imap-acl-plugin.c --- a/src/plugins/imap-acl/imap-acl-plugin.c Thu Feb 05 11:17:35 2009 +0100 +++ b/src/plugins/imap-acl/imap-acl-plugin.c Mon Feb 09 12:22:31 2009 +0100 @@ -303,6 +303,10 @@ { ARRAY_TYPE(const_string) rights; unsigned int i; + static const char *acl_k = MAIL_ACL_CREATE; + static const char *acl_x = MAIL_ACL_DELETE; + static const char *acl_e = MAIL_ACL_EXPUNGE; + static const char *acl_t = MAIL_ACL_WRITE_DELETED; t_array_init(&rights, 64); for (; *letters != '\0'; letters++) { @@ -314,9 +318,22 @@ } } if (imap_acl_letter_map[i].name == NULL) { - *error_r = t_strdup_printf("Invalid ACL right: %c", - *letters); - return -1; + /* Handling of obsolete rights as virtual + * rights according to RFC 4314 */ + switch (*letters) { + case 'c': + array_append(&rights, &acl_k, 1); + array_append(&rights, &acl_x, 1); + break; + case 'd': + array_append(&rights, &acl_e, 1); + array_append(&rights, &acl_t, 1); + break; + default: + *error_r = t_strdup_printf("Invalid ACL right: %c", + *letters); + return -1; + } } } (void)array_append_space(&rights);
pgpu5IqqFyVyR.pgp
Description: PGP signature