Mercurial > dovecot > core-2.2
changeset 13887:11a5bb865eba
imap-acl: Don't log errors when trying to change ACLs for nonexistent mailboxes.
author | Timo Sirainen <tss@iki.fi> |
---|---|
date | Wed, 04 Jan 2012 15:22:26 +0200 |
parents | 0aa94d55dcff |
children | 4f995c6e971b |
files | src/plugins/imap-acl/imap-acl-plugin.c |
diffstat | 1 files changed, 10 insertions(+), 5 deletions(-) [+] |
line wrap: on
line diff
--- a/src/plugins/imap-acl/imap-acl-plugin.c Wed Jan 04 15:08:39 2012 +0200 +++ b/src/plugins/imap-acl/imap-acl-plugin.c Wed Jan 04 15:22:26 2012 +0200 @@ -54,6 +54,7 @@ { struct mail_namespace *ns; struct mailbox *box; + enum mailbox_existence existence = MAILBOX_EXISTENCE_NONE; int ret; if (ACL_USER_CONTEXT(cmd->client->user) == NULL) { @@ -69,12 +70,16 @@ if mailbox isn't selectable but is listable. */ box = mailbox_alloc(ns->list, name, MAILBOX_FLAG_READONLY | MAILBOX_FLAG_IGNORE_ACLS); - ret = acl_mailbox_right_lookup(box, ACL_STORAGE_RIGHT_ADMIN); - if (ret > 0) - return box; + if (mailbox_exists(box, TRUE, &existence) == 0 && + existence == MAILBOX_EXISTENCE_SELECT) { + ret = acl_mailbox_right_lookup(box, ACL_STORAGE_RIGHT_ADMIN); + if (ret > 0) + return box; + } - /* not an administrator. */ - if (acl_mailbox_right_lookup(box, ACL_STORAGE_RIGHT_LOOKUP) <= 0) { + /* mailbox doesn't exist / not an administrator. */ + if (existence != MAILBOX_EXISTENCE_SELECT || + acl_mailbox_right_lookup(box, ACL_STORAGE_RIGHT_LOOKUP) <= 0) { client_send_tagline(cmd, t_strdup_printf( "NO ["IMAP_RESP_CODE_NONEXISTENT"] " MAIL_ERRSTR_MAILBOX_NOT_FOUND, name));