dovecot-1.2-sieve: Fixed bug in the logging of action results. T...
pigeonhole at rename-it.nl
pigeonhole at rename-it.nl
Thu Jan 14 11:21:45 EET 2010
details: http://hg.rename-it.nl/dovecot-1.2-sieve/rev/7aaff4bc01f4
changeset: 1206:7aaff4bc01f4
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 e46147aa364a -r 7aaff4bc01f4 src/lib-sieve/sieve-error.c
--- a/src/lib-sieve/sieve-error.c Wed Jan 13 20:17:22 2010 +0100
+++ b/src/lib-sieve/sieve-error.c Thu Jan 14 10:21:34 2010 +0100
@@ -860,6 +860,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;
@@ -867,6 +870,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;
@@ -896,12 +901,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);
@@ -970,6 +976,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;
@@ -977,6 +991,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 e46147aa364a -r 7aaff4bc01f4 src/lib-sieve/sieve-result.c
--- a/src/lib-sieve/sieve-result.c Wed Jan 13 20:17:22 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