From 3434e90d928320eaae182f2ef3d451cac8aba7c2 Mon Sep 17 00:00:00 2001 From: Stephan Bosch <stephan@rename-it.nl> Date: Wed, 29 Oct 2008 21:26:08 +0100 Subject: [PATCH] Added mail_debug messages to plugin to find problems in the sieve path specification more easily. --- src/plugins/lda-sieve/lda-sieve-plugin.c | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/src/plugins/lda-sieve/lda-sieve-plugin.c b/src/plugins/lda-sieve/lda-sieve-plugin.c index 364cd3fdc..a86aaa7dc 100644 --- a/src/plugins/lda-sieve/lda-sieve-plugin.c +++ b/src/plugins/lda-sieve/lda-sieve-plugin.c @@ -60,6 +60,8 @@ static const char *lda_sieve_get_path(void) if (script_path != NULL) { if (*script_path == '\0') { /* disabled */ + if (getenv("DEBUG") != NULL) + sieve_sys_info("empty script path, disabled"); return NULL; } @@ -82,7 +84,11 @@ static const char *lda_sieve_get_path(void) if (stat(script_path, &st) < 0) { if (errno != ENOENT) - sieve_sys_error("stat(%s) failed: %m", script_path); + sieve_sys_error("stat(%s) failed: %m " + "(using global script path in stead)", script_path); + else if (getenv("DEBUG") != NULL) + sieve_sys_info("local script path %s doesn't exist " + "(using global script path in stead)", script_path); /* use global script instead, if one exists */ script_path = getenv("SIEVE_GLOBAL_PATH"); @@ -250,8 +256,13 @@ static int lda_sieve_deliver_mail /* Find the script to execute */ script_path = lda_sieve_get_path(); - if (script_path == NULL) + if (script_path == NULL) { + if (getenv("DEBUG") != NULL) + sieve_sys_info("no valid sieve script path specified: " + "reverting to default delivery."); + return 0; + } if (getenv("DEBUG") != NULL) sieve_sys_info("using sieve path: %s", script_path); -- GitLab