From 3481c572b379260a57ebfafb46eee0600780add3 Mon Sep 17 00:00:00 2001 From: Jeremy Harris Date: Mon, 22 Jun 2015 13:21:04 +0100 Subject: [PATCH] Fix support of $spam_ variables at delivery time. Bug 1647 This change is forced on us by the documentation claiming clearly the support is there, though the code does not and never has. The doc change that introduced the claim is 7d9f747b5ef8 --- doc/doc-docbook/spec.xfpt | 9 ++++++++- src/src/spool_in.c | 6 ++++++ src/src/spool_out.c | 4 +++- 3 files changed, 17 insertions(+), 2 deletions(-) diff --git a/doc/doc-docbook/spec.xfpt b/doc/doc-docbook/spec.xfpt index e61bc1e6e..6c3d155d9 100644 --- a/doc/doc-docbook/spec.xfpt +++ b/doc/doc-docbook/spec.xfpt @@ -31196,7 +31196,11 @@ it always return &"true"& by appending &`:true`& to the username. .cindex "spam scanning" "returned variables" When the &%spam%& condition is run, it sets up a number of expansion -variables. These variables are saved with the received message, thus they are +variables. +.new +Except for &$spam_report$&, +.wen +these variables are saved with the received message so are available for use at delivery time. .vlist @@ -31219,6 +31223,9 @@ headers, since MUAs can match on such strings. .vitem &$spam_report$& A multiline text table, containing the full SpamAssassin report for the message. Useful for inclusion in headers or reject messages. +.new +This variable is only usable in a DATA-time ACL. +.wen .new .vitem &$spam_action$& diff --git a/src/src/spool_in.c b/src/src/spool_in.c index 1a5bf4ec8..fdc83e5a7 100644 --- a/src/src/spool_in.c +++ b/src/src/spool_in.c @@ -298,6 +298,8 @@ tls_in.ocsp = OCSP_NOT_REQ; #endif #ifdef WITH_CONTENT_SCAN +spam_bar = NULL; +spam_score = NULL; spam_score_int = NULL; #endif @@ -573,6 +575,10 @@ for (;;) if (Ustrncmp(p, "ender_set_untrusted", 19) == 0) sender_set_untrusted = TRUE; #ifdef WITH_CONTENT_SCAN + else if (Ustrncmp(p, "pam_bar ", 8) == 0) + spam_bar = string_copy(big_buffer + 10); + else if (Ustrncmp(p, "pam_score ", 10) == 0) + spam_score = string_copy(big_buffer + 12); else if (Ustrncmp(p, "pam_score_int ", 14) == 0) spam_score_int = string_copy(big_buffer + 16); #endif diff --git a/src/src/spool_out.c b/src/src/spool_out.c index 92bf0aa64..39d0fea25 100644 --- a/src/src/spool_out.c +++ b/src/src/spool_out.c @@ -218,7 +218,9 @@ if (sender_local) fprintf(f, "-local\n"); if (local_error_message) fprintf(f, "-localerror\n"); if (local_scan_data != NULL) fprintf(f, "-local_scan %s\n", local_scan_data); #ifdef WITH_CONTENT_SCAN -if (spam_score_int != NULL) fprintf(f,"-spam_score_int %s\n", spam_score_int); +if (spam_bar) fprintf(f,"-spam_bar %s\n", spam_bar); +if (spam_score) fprintf(f,"-spam_score %s\n", spam_score); +if (spam_score_int) fprintf(f,"-spam_score_int %s\n", spam_score_int); #endif if (deliver_manual_thaw) fprintf(f, "-manual_thaw\n"); if (sender_set_untrusted) fprintf(f, "-sender_set_untrusted\n"); -- 2.30.2