changeset 18508:a0b2217b1eab

acl: Log more debug info with mail_debug=yes
author Timo Sirainen <tss@iki.fi>
date Sun, 03 May 2015 17:07:02 +0300
parents 780a8f4544ec
children e9cf0ac3a629
files src/plugins/acl/acl-backend-vfile.c src/plugins/acl/acl-global-file.c src/plugins/acl/acl-global-file.h
diffstat 3 files changed, 12 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/src/plugins/acl/acl-backend-vfile.c	Sun May 03 16:26:46 2015 +0300
+++ b/src/plugins/acl/acl-backend-vfile.c	Sun May 03 17:07:02 2015 +0300
@@ -63,7 +63,8 @@
 			}
 		} else if (!S_ISDIR(st.st_mode)) {
 			_backend->global_file =
-				acl_global_file_init(backend->global_path, backend->cache_secs);
+				acl_global_file_init(backend->global_path, backend->cache_secs,
+						     _backend->debug);
 		}
 	}
 	if (_backend->debug) {
--- a/src/plugins/acl/acl-global-file.c	Sun May 03 16:26:46 2015 +0300
+++ b/src/plugins/acl/acl-global-file.c	Sun May 03 17:07:02 2015 +0300
@@ -30,16 +30,19 @@
 	ARRAY(struct acl_global_rights) rights;
 
 	unsigned int refresh_interval_secs;
+	bool debug;
 };
 
 struct acl_global_file *
-acl_global_file_init(const char *path, unsigned int refresh_interval_secs)
+acl_global_file_init(const char *path, unsigned int refresh_interval_secs,
+		     bool debug)
 {
 	struct acl_global_file *file;
 
 	file = i_new(struct acl_global_file, 1);
 	file->path = i_strdup(path);
 	file->refresh_interval_secs = refresh_interval_secs;
+	file->debug = debug;
 	i_array_init(&file->rights, 32);
 	file->rights_pool = pool_alloconly_create("acl global file rights", 1024);
 	return file;
@@ -198,6 +201,10 @@
 	array_foreach_modifiable(&file->rights, global_rights) {
 		if (!wildcard_match(vname, global_rights->vpattern))
 			continue;
+		if (file->debug) {
+			i_debug("Mailbox '%s' matches global ACL pattern '%s'",
+				vname, global_rights->vpattern);
+		}
 		array_foreach(&global_rights->rights, rights) {
 			new_rights = array_append_space(rights_r);
 			acl_rights_dup(rights, pool, new_rights);
--- a/src/plugins/acl/acl-global-file.h	Sun May 03 16:26:46 2015 +0300
+++ b/src/plugins/acl/acl-global-file.h	Sun May 03 17:07:02 2015 +0300
@@ -4,7 +4,8 @@
 #include "acl-api.h"
 
 struct acl_global_file *
-acl_global_file_init(const char *path, unsigned int refresh_interval_secs);
+acl_global_file_init(const char *path, unsigned int refresh_interval_secs,
+		     bool debug);
 void acl_global_file_deinit(struct acl_global_file **file);
 
 /* Read the global ACLs into memory. */