dovecot-2.1: imap-acl: Don't log errors when trying to change AC...

dovecot at dovecot.org dovecot at dovecot.org
Wed Jan 4 15:22:36 EET 2012


details:   http://hg.dovecot.org/dovecot-2.1/rev/11a5bb865eba
changeset: 13887:11a5bb865eba
user:      Timo Sirainen <tss at iki.fi>
date:      Wed Jan 04 15:22:26 2012 +0200
description:
imap-acl: Don't log errors when trying to change ACLs for nonexistent mailboxes.

diffstat:

 src/plugins/imap-acl/imap-acl-plugin.c |  15 ++++++++++-----
 1 files changed, 10 insertions(+), 5 deletions(-)

diffs (33 lines):

diff -r 0aa94d55dcff -r 11a5bb865eba src/plugins/imap-acl/imap-acl-plugin.c
--- 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));


More information about the dovecot-cvs mailing list