[Dovecot] [patch] 'c' and 'd' in setacl
Matvey Soloviev
blackhole89 at gmail.com
Fri Feb 6 14:01:44 EET 2009
Hello everyone,
while I understand (and am glad to see) that the codebase evolved almost
beyond recognition since I submitted it, from a superficial glance over the
present code, I get the impression that it might be better to employ an
additional check along the lines of what I had done in the piece of
equivalent 1.1.x code I attached (forgive the Windows-style linebreaks and
space-based indentations, I copypasted from PuTTY to Notepad...) to prevent
adding the same right to the array twice when parsing a letters string that
contains both the obsolete rights and any of the regular rights it aliases
to (e.g. "xc"). Of course, something like that might be silently intercepted
later in the code by now in a change of action that eluded my sight; in that
case, the submitted code should work fine.
Either way, I am happy to see this is still being worked on.
Regards,
Matvey.
2009/2/6 Sascha Wilde <wilde at intevation.de>
> Hi Timo,
> Hi *,
>
> I just recognized that the new imap-acl plugin in dovecot 1.2 does not
> know the obsolete rights 'd' and 'c' when setting. According to RFC
> 4314 section 2.1.1.:
>
> If a client includes the "d" right in a rights list, then it MUST be
> treated as if the client had included every member of the "delete"
> right.
>
> and
>
> If a client includes the "c" right in a rights list, then it MUST be
> treated as if the client had included every member of the "create"
> right.
>
> Unfortunatly there are actually clients which depend on this behavior.
>
> I attached a rather rough[0] patch which implements this.
>
> cheers
> sascha
>
> [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.
> --
> Sascha Wilde OpenPGP key: 4BB86568
> http://www.intevation.de/~wilde/ <http://www.intevation.de/%7Ewilde/>
> 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
>
>
-------------- next part --------------
bool has[11]={0,0,0,0,0,0,0,0,0,0};
/* parse IMAP ACL list */
while (*acl == ' ' || *acl == '\t')
acl++;
t_array_init(&rights, 64);
while (*acl != '\0' && *acl != ' ' && *acl != '\t' && *acl != ':') {
for (i = 0; acl_letter_map[i].letter != '\0'; i++) {
if (acl_letter_map[i].letter == *acl)
break;
}
if (acl_letter_map[i].letter == '\0') {
if(*acl == 'c') {
// FIXME
if(!has[8]) {
array_append(&rights, &acl_letter_map[8].name, 1); //k
has[8]=1;
}
if(!has[9]) {
array_append(&rights, &acl_letter_map[9].name, 1); //x
has[9]=1;
}
acl++;
continue;
} else if(*acl == 'd') {
// FIXME
if(!has[7]) {
array_append(&rights, &acl_letter_map[7].name, 1); //e
has[7]=1;
}
if(!has[4]) {
array_append(&rights, &acl_letter_map[4].name, 1); //t
has[4]=1;
}
acl++;
continue;
}
*error_r = t_strdup_printf("Unknown ACL '%c'", *acl);
return NULL;
}
has[i]=1;
array_append(&rights, &acl_letter_map[i].name, 1);
acl++;
}
More information about the dovecot
mailing list