[exim-cvs] $av_failed variable set when av_scanner deferred

Página Principal
Apagar esta mensagem
Responder a esta mensagem
Autor: Exim Git Commits Mailing List
Data:  
Para: exim-cvs
Assunto: [exim-cvs] $av_failed variable set when av_scanner deferred
Gitweb: http://git.exim.org/exim.git/commitdiff/9e949f00f404d3672b1ecd7c1bfd5e8927a3301d
Commit:     9e949f00f404d3672b1ecd7c1bfd5e8927a3301d
Parent:     e12f8c3248614077e92c7ba23386e1f36d570c8f
Author:     Phil Pennock <pdp@???>
AuthorDate: Sat Aug 27 16:01:01 2011 -0700
Committer:  Phil Pennock <pdp@???>
CommitDate: Sat Aug 27 16:01:01 2011 -0700


    $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 deletions(-)


diff --git a/doc/doc-docbook/spec.xfpt b/doc/doc-docbook/spec.xfpt
index 1092cab..aa4be53 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 bb182c9..6181dd2 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 eb1e139..bf247e6 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 8dfd7a8..fb6d692 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 92525e8..a5516b9 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 4e395e8..4ed3950 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 c7cd0bc..864564f 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;
}