dovecot-2.0-pigeonhole: Fixed bug in the logging of action resul...

pigeonhole at rename-it.nl pigeonhole at rename-it.nl
Thu Jan 14 19:03:11 EET 2010


details:   http://hg.rename-it.nl/dovecot-2.0-pigeonhole/rev/079c69045afc
changeset: 1204:079c69045afc
user:      Stephan Bosch <stephan at rename-it.nl>
date:      Thu Jan 14 10:21:34 2010 +0100
description:
Fixed bug in the logging of action results. The new varexpand error handler was not properly tested.

diffstat:

 src/lib-sieve/sieve-error.c  |  22 +++++++++++++++++++---
 src/lib-sieve/sieve-result.c |  15 +++++++++++++--
 2 files changed, 32 insertions(+), 5 deletions(-)

diffs (95 lines):

diff -r a80a49e6756e -r 079c69045afc src/lib-sieve/sieve-error.c
--- a/src/lib-sieve/sieve-error.c	Wed Jan 13 21:07:26 2010 +0100
+++ b/src/lib-sieve/sieve-error.c	Thu Jan 14 10:21:34 2010 +0100
@@ -872,6 +872,9 @@
 	pool_t pool;
 	struct sieve_prefix_ehandler *ehandler;
 
+	if ( parent == NULL )
+		return NULL;
+
 	pool = pool_alloconly_create("sieve_prefix_error_handler", 256);	
 	ehandler = p_new(pool, struct sieve_prefix_ehandler, 1);
 	ehandler->parent = parent;
@@ -879,6 +882,8 @@
 	ehandler->prefix = p_strdup(pool, prefix);
 
 	sieve_error_handler_init(&ehandler->handler, pool, parent->max_errors);
+    ehandler->handler.log_info = parent->log_info;
+    ehandler->handler.log_debug = parent->log_debug;
 
 	ehandler->handler.verror = sieve_prefix_verror;
 	ehandler->handler.vwarning = sieve_prefix_vwarning;
@@ -908,12 +913,13 @@
 (struct sieve_varexpand_ehandler *ehandler,
 	const char *location, const char *fmt, va_list args) 
 {
-	struct var_expand_table *table = array_get_modifiable(&ehandler->table, NULL);
+	unsigned int count;
+	struct var_expand_table *table = array_get_modifiable(&ehandler->table, &count);
 	string_t *str = t_str_new(256);
 
 	/* Fill in substitution items */
-	table[0].value = location;
-	table[1].value = t_strdup_vprintf(fmt, args);
+	table[0].value = t_strdup_vprintf(fmt, args);
+	table[1].value = location;
 
 	/* Expand variables */
 	var_expand(str, ehandler->format, table);
@@ -982,6 +988,14 @@
 	struct var_expand_table *entry;
 	int i;
 
+	if ( parent == NULL )
+		return NULL;
+
+	if ( format == NULL ) {
+		sieve_error_handler_ref(parent);
+		return parent;
+	}
+
 	pool = pool_alloconly_create("sieve_varexpand_error_handler", 256);	
 	ehandler = p_new(pool, struct sieve_varexpand_ehandler, 1);
 	ehandler->parent = parent;
@@ -989,6 +1003,8 @@
 	p_array_init(&ehandler->table, pool, 10);
 
 	sieve_error_handler_init(&ehandler->handler, pool, parent->max_errors);
+	ehandler->handler.log_info = parent->log_info;
+	ehandler->handler.log_debug = parent->log_debug;
 
 	entry = array_append_space(&ehandler->table);
 	entry->key = '$';
diff -r a80a49e6756e -r 079c69045afc src/lib-sieve/sieve-result.c
--- a/src/lib-sieve/sieve-result.c	Wed Jan 13 21:07:26 2010 +0100
+++ b/src/lib-sieve/sieve-result.c	Thu Jan 14 10:21:34 2010 +0100
@@ -24,6 +24,12 @@
 #include <stdio.h>
 
 /*
+ * Defaults
+ */
+
+#define DEFAULT_ACTION_LOG_FORMAT "msgid=%m: %$"
+
+/*
  * Types
  */
  
@@ -893,8 +899,13 @@
 	if ( result->action_env.ehandler != NULL ) 
 		sieve_error_handler_unref(&result->action_env.ehandler);
 
-	result->action_env.ehandler = sieve_varexpand_ehandler_create
-		(result->ehandler, senv->action_log_format, tab);
+	if ( senv->action_log_format != NULL ) {
+		result->action_env.ehandler = sieve_varexpand_ehandler_create
+			(result->ehandler, senv->action_log_format, tab);
+	} else {
+		result->action_env.ehandler = sieve_varexpand_ehandler_create
+            (result->ehandler, DEFAULT_ACTION_LOG_FORMAT, tab);
+	}
 }
 
 static bool _sieve_result_implicit_keep


More information about the dovecot-cvs mailing list