Mercurial > dovecot > core-2.2
changeset 12826:d757b13d84ff
doveadm acl set: Require non-standard rights to be prefixed with ':' char.
author | Timo Sirainen <tss@iki.fi> |
---|---|
date | Fri, 04 Mar 2011 21:21:37 +0200 |
parents | 81d799f52912 |
children | b44ec48d9425 |
files | src/plugins/acl/doveadm-acl.c |
diffstat | 1 files changed, 22 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- a/src/plugins/acl/doveadm-acl.c Fri Mar 04 20:59:31 2011 +0200 +++ b/src/plugins/acl/doveadm-acl.c Fri Mar 04 21:21:37 2011 +0200 @@ -220,6 +220,17 @@ return ctx; } +static bool is_standard_right(const char *name) +{ + unsigned int i; + + for (i = 0; all_mailbox_rights[i] != NULL; i++) { + if (strcmp(all_mailbox_rights[i], name) == 0) + return TRUE; + } + return FALSE; +} + static void cmd_acl_set_run(struct doveadm_mail_cmd_context *ctx, struct mail_user *user) { @@ -252,9 +263,17 @@ right++; dest = &dest_neg_rights; } - if (strcmp(right, "all") != 0) - array_append(dest, &right, 1); - else { + if (strcmp(right, "all") != 0) { + if (*right == ':') { + /* non-standard right */ + right++; + array_append(dest, &right, 1); + } else if (is_standard_right(right)) { + array_append(dest, &right, 1); + } else { + i_fatal("Invalid right '%s'", right); + } + } else { for (j = 0; all_mailbox_rights[j] != NULL; j++) array_append(dest, &all_mailbox_rights[j], 1); }