From 9e949f00f404d3672b1ecd7c1bfd5e8927a3301d Mon Sep 17 00:00:00 2001 From: Phil Pennock Date: Sat, 27 Aug 2011 16:01:01 -0700 Subject: [PATCH] $av_failed variable set when av_scanner deferred Patch from John Horne. Fixes bug 1078 --- doc/doc-docbook/spec.xfpt | 9 +++++++++ doc/doc-txt/ChangeLog | 4 ++++ doc/doc-txt/NewStuff | 3 +++ src/src/expand.c | 3 +++ src/src/globals.c | 1 + src/src/globals.h | 1 + src/src/malware.c | 7 ++++++- 7 files changed, 27 insertions(+), 1 deletion(-) diff --git a/doc/doc-docbook/spec.xfpt b/doc/doc-docbook/spec.xfpt index 1092cab54..aa4be5332 100644 --- a/doc/doc-docbook/spec.xfpt +++ b/doc/doc-docbook/spec.xfpt @@ -10610,6 +10610,15 @@ is empty and &$authentication_failed$& is set to &"1"&). Failure includes any negative response to an AUTH command, including (for example) an attempt to use an undefined mechanism. +.new +.vitem &$av_failed$& +.cindex "content scanning" "AV scanner failure" +This variable is available when Exim is compiled with the content-scanning +extension. It is set to &"0"& by default, but will be set to &"1"& if any +problem occurs with the virus scanner (specified by &%av_scanner%&) during +the ACL malware condition. +.wen + .vitem &$body_linecount$& .cindex "message body" "line count" .cindex "body of message" "line count" diff --git a/doc/doc-txt/ChangeLog b/doc/doc-txt/ChangeLog index bb182c9dd..6181dd2d2 100644 --- a/doc/doc-txt/ChangeLog +++ b/doc/doc-txt/ChangeLog @@ -97,6 +97,10 @@ PP/03 Implement SSL-on-connect outbound with protocol=smtps on smtp transport. PP/04 Use .dylib instead of .so for dynamic library loading on MacOS. +PP/05 Variable $av_failed, true if the AV scanner deferred. + Patch from John Horne. + Bugzilla 1078. + Exim version 4.76 ----------------- diff --git a/doc/doc-txt/NewStuff b/doc/doc-txt/NewStuff index eb1e1397e..bf247e67e 100644 --- a/doc/doc-txt/NewStuff +++ b/doc/doc-txt/NewStuff @@ -15,6 +15,9 @@ Version 4.77 2. The SMTP transport's protocol option may now be set to "smtps", to use SSL-on-connect outbound. + 3. New variable $av_failed, set true if the AV scanner deferred; ie, when + there is a problem talking to the AV scanner, or the AV scanner running. + Version 4.76 ------------ diff --git a/src/src/expand.c b/src/src/expand.c index 8dfd7a8ad..fb6d6922b 100644 --- a/src/src/expand.c +++ b/src/src/expand.c @@ -387,6 +387,9 @@ static var_entry var_table[] = { { "authenticated_id", vtype_stringptr, &authenticated_id }, { "authenticated_sender",vtype_stringptr, &authenticated_sender }, { "authentication_failed",vtype_int, &authentication_failed }, +#ifdef WITH_CONTENT_SCAN + { "av_failed", vtype_int, &av_failed }, +#endif #ifdef EXPERIMENTAL_BRIGHTMAIL { "bmi_alt_location", vtype_stringptr, &bmi_alt_location }, { "bmi_base64_tracker_verdict", vtype_stringptr, &bmi_base64_tracker_verdict }, diff --git a/src/src/globals.c b/src/src/globals.c index 92525e8d8..a5516b91d 100644 --- a/src/src/globals.c +++ b/src/src/globals.c @@ -348,6 +348,7 @@ uschar *auth_defer_user_msg = US""; uschar *auth_vars[AUTH_VARS]; int auto_thaw = 0; #ifdef WITH_CONTENT_SCAN +BOOL av_failed = FALSE; uschar *av_scanner = US"sophie:/var/run/sophie"; /* AV scanner */ #endif diff --git a/src/src/globals.h b/src/src/globals.h index 4e395e81e..4ed3950df 100644 --- a/src/src/globals.h +++ b/src/src/globals.h @@ -184,6 +184,7 @@ extern uschar *auth_defer_user_msg; /* Error message for user */ extern uschar *auth_vars[]; /* $authn variables */ extern int auto_thaw; /* Auto-thaw interval */ #ifdef WITH_CONTENT_SCAN +extern BOOL av_failed; /* TRUE if the AV process failed */ extern uschar *av_scanner; /* AntiVirus scanner to use for the malware condition */ #endif diff --git a/src/src/malware.c b/src/src/malware.c index c7cd0bcca..864564ffc 100644 --- a/src/src/malware.c +++ b/src/src/malware.c @@ -69,17 +69,22 @@ Returns: Exim message processing code (OK, FAIL, DEFER, ...) int malware(uschar **listptr) { uschar scan_filename[1024]; BOOL fits; + int ret; fits = string_format(scan_filename, sizeof(scan_filename), CS"%s/scan/%s/%s.eml", spool_directory, message_id, message_id); if (!fits) { + av_failed = TRUE; log_write(0, LOG_MAIN|LOG_PANIC, "malware filename does not fit in buffer [malware()]"); return DEFER; } - return malware_internal(listptr, scan_filename, FALSE); + ret = malware_internal(listptr, scan_filename, FALSE); + if (ret == DEFER) av_failed = TRUE; + + return ret; } -- 2.30.2