changeset 12274:b0e4edc4d79a

acl: Log mailbox names that are skipped due to missing lookup right with mail_debug=yes
author Timo Sirainen <tss@iki.fi>
date Fri, 15 Oct 2010 15:13:59 +0100
parents b277b71fb57f
children 4933c3095ee2
files src/plugins/acl/acl-mailbox-list.c
diffstat 1 files changed, 13 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/src/plugins/acl/acl-mailbox-list.c	Fri Oct 15 15:09:18 2010 +0100
+++ b/src/plugins/acl/acl-mailbox-list.c	Fri Oct 15 15:13:59 2010 +0100
@@ -202,15 +202,18 @@
 	struct acl_mailbox_list *alist = ACL_LIST_CONTEXT(ctx->ctx.list);
 	const struct mailbox_info *info;
 
-	do {
-		info = alist->module_ctx.super.iter_next(ctx->super_ctx);
-		if (info == NULL)
-			return NULL;
+	while ((info = alist->module_ctx.super.iter_next(ctx->super_ctx)) != NULL) {
 		/* if we've a list of mailboxes with LOOKUP rights, skip the
 		   mailboxes not in the list (since we know they can't be
 		   visible to us). */
-	} while (ctx->lookup_boxes != NULL &&
-		 mailbox_tree_lookup(ctx->lookup_boxes, info->name) == NULL);
+		if (ctx->lookup_boxes == NULL ||
+		    mailbox_tree_lookup(ctx->lookup_boxes, info->name) != NULL)
+			break;
+		if (ctx->ctx.list->ns->user->mail_debug) {
+			i_debug("acl: Mailbox not in dovecot-acl-list: %s",
+				info->name);
+		}
+	}
 
 	return info;
 }
@@ -378,6 +381,10 @@
 			return NULL;
 		}
 		/* skip to next one */
+		if (ctx->ctx.list->ns->user->mail_debug) {
+			i_debug("acl: No lookup right to mailbox: %s",
+				info->name);
+		}
 	}
 	return info == NULL ? NULL : &ctx->info;
 }