From 079c5271b74d047658bb9d3ccb24f64308fe7584 Mon Sep 17 00:00:00 2001 From: Stephan Bosch <stephan@rename-it.nl> Date: Sun, 3 Mar 2013 17:35:37 +0100 Subject: [PATCH] LDA Sieve plugin: fixed bug in opening script files for multiscript. Used sieve_script_create instead of sieve_script_create_open. Changed plugin debug output a bit as well. --- src/lib-sieve/sieve-script.c | 2 ++ src/plugins/lda-sieve/lda-sieve-plugin.c | 11 +++++++++-- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/src/lib-sieve/sieve-script.c b/src/lib-sieve/sieve-script.c index e627125f2..c1e5d41f4 100644 --- a/src/lib-sieve/sieve-script.c +++ b/src/lib-sieve/sieve-script.c @@ -240,6 +240,7 @@ struct sieve_script *sieve_script_create script = script_class->v.alloc(); sieve_script_init(script, svinst, script_class, data, name, ehandler); + script->location = p_strdup(script->pool, location); return script; } @@ -268,6 +269,7 @@ int sieve_script_open return -1; } + script->location = NULL; if ( script->v.open(script, location, options, &error) < 0 ) { if ( error_r == NULL ) { if ( error == SIEVE_ERROR_NOT_FOUND ) diff --git a/src/plugins/lda-sieve/lda-sieve-plugin.c b/src/plugins/lda-sieve/lda-sieve-plugin.c index 47925b08b..99f755381 100644 --- a/src/plugins/lda-sieve/lda-sieve-plugin.c +++ b/src/plugins/lda-sieve/lda-sieve-plugin.c @@ -217,7 +217,7 @@ static int lda_sieve_multiscript_get_scripts files = array_get(&script_files, &count); for ( i = 0; i < count; i++ ) { - struct sieve_script *script = sieve_script_create + struct sieve_script *script = sieve_script_create_open (svinst, files[i], NULL, ehandler, &error); if ( script == NULL ) { @@ -529,14 +529,21 @@ static int lda_sieve_multiscript_execute /* Open */ + if ( debug ) { + sieve_sys_debug + (svinst, "opening script %d of %d from %s", i+1, count, + sieve_script_location(script)); + } + if ( (sbin=lda_sieve_open(srctx, script, cpflags, &error)) == NULL ) break; /* Execute */ - if ( debug ) + if ( debug ) { sieve_sys_debug (svinst, "executing script from %s", sieve_get_source(sbin)); + } more = sieve_multiscript_run(mscript, sbin, ehandler, rtflags, final); -- GitLab