diff --git a/src/lib-sieve/plugins/vacation/cmd-vacation.c b/src/lib-sieve/plugins/vacation/cmd-vacation.c index 4f096ce55cba6426f520476de738da9cef4a4841..9e862fa0c06215a6ea9b6f9114ebd6b5e6ddbb19 100644 --- a/src/lib-sieve/plugins/vacation/cmd-vacation.c +++ b/src/lib-sieve/plugins/vacation/cmd-vacation.c @@ -821,7 +821,7 @@ static bool act_vacation_send FILE *f; const char *outmsgid; const char *const *headers; - int references; + int ret; /* Check smpt functions just to be sure */ @@ -854,23 +854,26 @@ static bool act_vacation_send rfc2822_header_field_printf(f, "Subject", "%s", str_sanitize(ctx->subject, 256)); - references = mail_get_headers + /* Compose proper in-reply-to and references headers */ + + ret = mail_get_headers (aenv->msgdata->mail, "references", &headers); if ( msgdata->id != NULL ) { rfc2822_header_field_write(f, "In-Reply-To", msgdata->id); - if ( references >= 0 ) + if ( ret >= 0 && headers[0] != NULL ) rfc2822_header_field_write (f, "References", t_strconcat(headers[0], " ", msgdata->id, NULL)); else rfc2822_header_field_write(f, "References", msgdata->id); - } else if ( references > 0 ) { + } else if ( ret >= 0 && headers[0] != NULL ) { rfc2822_header_field_write(f, "References", headers[0]); } rfc2822_header_field_write(f, "Auto-Submitted", "auto-replied (vacation)"); rfc2822_header_field_write(f, "Precedence", "bulk"); + rfc2822_header_field_write(f, "MIME-Version", "1.0"); if ( !ctx->mime ) { @@ -936,12 +939,15 @@ static bool act_vacation_commit } /* Did whe respond to this user before? */ - act_vacation_hash(msgdata, ctx, dupl_hash); - if (senv->duplicate_check(dupl_hash, sizeof(dupl_hash), senv->username)) - { - sieve_result_log(aenv, "discarded duplicate vacation response to <%s>", - str_sanitize(msgdata->return_path, 128)); - return TRUE; + if ( senv->duplicate_check != NULL ) { + act_vacation_hash(msgdata, ctx, dupl_hash); + + if ( senv->duplicate_check(dupl_hash, sizeof(dupl_hash), senv->username) ) + { + sieve_result_log(aenv, "discarded duplicate vacation response to <%s>", + str_sanitize(msgdata->return_path, 128)); + return TRUE; + } } /* Are we trying to respond to a mailing list ? */ @@ -1051,8 +1057,9 @@ static bool act_vacation_commit str_sanitize(msgdata->return_path, 128)); /* Mark as replied */ - senv->duplicate_mark(dupl_hash, sizeof(dupl_hash), senv->username, - ioloop_time + ctx->days * (24 * 60 * 60)); + if ( senv->duplicate_mark != NULL ) + senv->duplicate_mark(dupl_hash, sizeof(dupl_hash), senv->username, + ioloop_time + ctx->days * (24 * 60 * 60)); return TRUE; } diff --git a/src/lib-sieve/sieve-actions.c b/src/lib-sieve/sieve-actions.c index bd5e1d26507cd06a6daaec2298a690c4457e2feb..1cf734dfea2ae3c2a3c61bf428303c9cd01a5bff 100644 --- a/src/lib-sieve/sieve-actions.c +++ b/src/lib-sieve/sieve-actions.c @@ -361,6 +361,7 @@ static bool act_store_commit if ( trans->namespace == NULL ) { if ( aenv->scriptenv->namespaces == NULL ) { act_store_log_status(trans, aenv, FALSE, status); + *keep = FALSE; return TRUE; } diff --git a/src/lib-sieve/sieve-result.c b/src/lib-sieve/sieve-result.c index 5c2c945d48959d812df84e404c43f86ac6a8af5b..e0c0ab7251c8eb3562ef0fd063e84498b0805533 100644 --- a/src/lib-sieve/sieve-result.c +++ b/src/lib-sieve/sieve-result.c @@ -704,8 +704,8 @@ int sieve_result_execute bool keep = TRUE; if ( act->commit != NULL ) - commit_ok = act->commit(act, &result->action_env, rac->tr_context, &keep) && - commit_ok; + commit_ok = act->commit + (act, &result->action_env, rac->tr_context, &keep) && commit_ok; /* Execute post_commit event of side effects */ rsef = rac->seffects != NULL ? rac->seffects->first_effect : NULL; diff --git a/src/testsuite/testsuite-result.c b/src/testsuite/testsuite-result.c index 9bdfedee27d8ea601974b7ddf600ef0ce7635ca4..bfa95fbb20fa9ad5168d4a7bc0c7ad2bf1c3c2d5 100644 --- a/src/testsuite/testsuite-result.c +++ b/src/testsuite/testsuite-result.c @@ -10,13 +10,11 @@ #include "testsuite-common.h" #include "testsuite-result.h" -unsigned int _testsuite_result_index; /* Yuck */ static struct sieve_result *_testsuite_result; void testsuite_result_init(void) { _testsuite_result = NULL; - _testsuite_result_index = 0; } void testsuite_result_deinit(void) diff --git a/tests/execute/actions.svtest b/tests/execute/actions.svtest index c5dbee76911718abc7934d6a0e0ebfc8c1d25402..cf3b1a0ffe68a32f7704df693249026dbf4e8680 100644 --- a/tests/execute/actions.svtest +++ b/tests/execute/actions.svtest @@ -13,11 +13,11 @@ Test. test "Fileinto" { if not test_script_compile "actions/fileinto.sieve" { - test_fail "compile failed"; + test_fail "script compile failed"; } if not test_script_run { - test_fail "execute failed"; + test_fail "script run failed"; } if not test_result :count "eq" :comparator "i;ascii-numeric" "3" { @@ -35,6 +35,10 @@ test "Fileinto" { if not test_result :index 3 "store" { test_fail "third action is not 'store'"; } + + if not test_result_execute { + test_fail "result execute failed"; + } } test "Redirect" { @@ -65,5 +69,9 @@ test "Redirect" { if not test_result :index 4 "redirect" { test_fail "fourth action is not 'redirect'"; } + + if not test_result_execute { + test_fail "result execute failed"; + } } diff --git a/tests/extensions/imapflags/execute.svtest b/tests/extensions/imapflags/execute.svtest index 35cc95924e33620ff114938c4125f4b65ff4be86..dac5c763bbfcd79edeea51ccf99dbcbbd93d77fe 100644 --- a/tests/extensions/imapflags/execute.svtest +++ b/tests/extensions/imapflags/execute.svtest @@ -12,4 +12,8 @@ test "Flags Side Effect" { if not test_script_run { test_fail "script execute failed"; } + + if not test_result_execute { + test_fail "result execute failed"; + } } diff --git a/tests/extensions/reject/execute.svtest b/tests/extensions/reject/execute.svtest index 911a978aa06a104b2d2774d8d47d92e660da2ae7..bf3f629adb1520e3c62e0602e5488a3e3bdabb92 100644 --- a/tests/extensions/reject/execute.svtest +++ b/tests/extensions/reject/execute.svtest @@ -13,11 +13,11 @@ Test. test "Execute" { if not test_script_compile "execute/basic.sieve" { - test_fail "compile failed"; + test_fail "script compile failed"; } if not test_script_run { - test_fail "execute failed"; + test_fail "script run failed"; } if not test_result :count "eq" :comparator "i;ascii-numeric" "1" { @@ -27,4 +27,8 @@ test "Execute" { if not test_result :index 1 "reject" { test_fail "reject action missing from result"; } + + if not test_result_execute { + test_fail "result execute failed"; + } } diff --git a/tests/extensions/vacation/execute.svtest b/tests/extensions/vacation/execute.svtest index 0b68b44f85f37904601568ca586049cda38e856d..ed6dc53bb44e1d37c04258ed773d6392a083277c 100644 --- a/tests/extensions/vacation/execute.svtest +++ b/tests/extensions/vacation/execute.svtest @@ -8,7 +8,7 @@ test "Action" { } if not test_script_run { - test_fail "script execute failed"; + test_fail "script run failed"; } if not test_result :count "eq" :comparator "i;ascii-numeric" "2" { @@ -22,6 +22,10 @@ test "Action" { if not test_result :index 2 "store" { test_fail "store action is missing in result"; } + + if not test_result_execute { + test_fail "result execute failed"; + } } test "No :handle specified" { @@ -32,4 +36,8 @@ test "No :handle specified" { if not test_script_run { test_fail "script execute failed"; } + + if not test_result_execute { + test_fail "result execute failed"; + } }