[Mimedefang] (no subject)

Cormack, Ken ken.cormack at roadway.com
Fri Aug 24 16:55:53 EDT 2007


David,

Below is a patch I'd like considered for future releases.  The patch file
shown below (and attached) is against mimedefang.pl.in, in the new 2.63
release of MIMEDefang.  It simply defines a global variable in
mimedefang.pl, that can then be referenced in mimedefang-filter.  It's
purpose is to allow tracking, on systems that may run more than one virus
scanning engine, to see WHICH installed virus scanner flagged a particular
email.  I know you're not a fan of "more global variables", but I've found
this one valuable, and other may as well.

The patch allows lines such as the following (marked with ==>> below), to be
added to filter_begin

::snip
    # Higher level of paranoia - takes care of "suspicious" objects
    # $FoundVirus = ($action eq "quarantine");
    if ($FoundVirus) {
      md_graphdefang_log ('virus', $VirusName, $RelayAddr);

      # Added this next line, to log which scanner found the virus.
      # This required patching mimedefang.pl to provide $VirusScanner
==>>  md_graphdefang_log ('scanner_name', $VirusScanner, $VirusName);
::snip::

And...

::snip::
    if ($action eq 'tempfail') {
      action_tempfail ('Problem running virus-scanner');
==>>  md_syslog ('warning', "$QueueID: Problem running virus scanner
$VirusScanner: code=$code, category=$category, action=$action");
    }
  }
::snip::

Ken

Patch shown below...

--- mimedefang.pl.in.orig	2007-08-13 09:50:18.000000000 -0400
+++ mimedefang.pl.in	2007-08-20 10:04:12.000000000 -0400
@@ -31,7 +31,7 @@
 package main;
 
 # My deepest apologies for this mess of globals...
-use vars qw($AddWarningsInline @StatusTags
+use vars qw($AddWarningsInline @StatusTags $VirusScanner
 	    $Action $Administrator $AdminName $AdminAddress $DoStatusTags
 	    $Changed $CSSHost $DaemonAddress $DaemonName
 	    $DefangCounter $Domain $EntireMessageQuarantined
@@ -2453,7 +2453,7 @@
 #  Runs the NAI Virus Scan program on the entity. (http://www.nai.com)
 #***********************************************************************
 sub entity_contains_virus_nai ($) {
-
+    $VirusScanner = "NAI" ;
     unless ($Features{'Virus:NAI'}) {
 	md_syslog('err', "$MsgID: NAI Virus Scan not installed on this
system");
 	return (wantarray ? (1, 'not-installed', 'tempfail') : 1);
@@ -2493,7 +2493,7 @@
 #  Runs the NAI Virus Scan program on the working directory
 #***********************************************************************
 sub message_contains_virus_nai () {
-
+    $VirusScanner = "NAI" ;
     unless ($Features{'Virus:NAI'}) {
 	md_syslog('err', "$MsgID: NAI Virus Scan not installed on this
system");
 	return (wantarray ? (1, 'not-installed', 'tempfail') : 1);
@@ -2574,7 +2574,7 @@
 #  Runs the Bitdefender program on the entity. (http://www.bitdefender.com)
 #***********************************************************************
 sub entity_contains_virus_bdc ($) {
-
+    $VirusScanner = "BDC" ;
     unless($Features{'Virus:BDC'}) {
 	md_syslog('err', "$MsgID: Bitdefender not installed on this
system");
 	return (wantarray ? (1, 'not-installed', 'tempfail') : 1);
@@ -2615,7 +2615,7 @@
 #  Runs the Bitdefender program on the working directory
 #***********************************************************************
 sub message_contains_virus_bdc () {
-
+    $VirusScanner = "BDC" ;
     unless($Features{'Virus:BDC'}) {
 	md_syslog('err', "$MsgID: Bitdefender not installed on this
system");
 	return (wantarray ? (1, 'not-installed', 'tempfail') : 1);
@@ -2653,7 +2653,7 @@
 #  Runs the Command Anti-Virus program. (http://www.commandsoftware.com)
 #***********************************************************************
 sub entity_contains_virus_csav ($) {
-
+    $VirusScanner = "CSAV" ;
     unless($Features{'Virus:CSAV'}) {
 	md_syslog('err', "$MsgID: Command Anti-Virus not installed on this
system");
 	return (wantarray ? (1, 'not-installed', 'tempfail') : 1);
@@ -2693,7 +2693,7 @@
 #  Runs the Command Anti-Virus program on the working directory
 #***********************************************************************
 sub message_contains_virus_csav () {
-
+    $VirusScanner = "CSAV" ;
     unless($Features{'Virus:CSAV'}) {
 	md_syslog('err', "$MsgID: Command Anti-Virus not installed on this
system");
 	return (wantarray ? (1, 'not-installed', 'tempfail') : 1);
@@ -2753,7 +2753,7 @@
 #  Runs the F-Secure Anti-Virus program. (http://www.f-secure.com)
 #***********************************************************************
 sub entity_contains_virus_fsav ($) {
-
+    $VirusScanner = "FSAV" ;
     unless($Features{'Virus:FSAV'}) {
 	md_syslog('err', "$MsgID: F-Secure Anti-Virus not installed on this
system");
 	return (wantarray ? (1, 'not-installed', 'tempfail') : 1);
@@ -2793,7 +2793,7 @@
 #  Runs the F-Secure Anti-Virus program on the working directory
 #***********************************************************************
 sub message_contains_virus_fsav () {
-
+    $VirusScanner = "FSAV" ;
     unless($Features{'Virus:FSAV'}) {
 	md_syslog('err', "$MsgID: F-Secure Anti-Virus not installed on this
system");
 	return (wantarray ? (1, 'not-installed', 'tempfail') : 1);
@@ -3009,6 +3009,7 @@
 #  Scans the entity using Symantec CarrierScan
 #***********************************************************************
 sub entity_contains_virus_carrier_scan ($;$) {
+    $VirusScanner = "CARRIER" ;
     my($entity) = shift;
     my($host) = $CSSHost;
     $host = shift if (@_ > 0);
@@ -3033,6 +3034,7 @@
 #  Scans the entity using Symantec CarrierScan
 #***********************************************************************
 sub message_contains_virus_carrier_scan (;$) {
+    $VirusScanner = "CARRIER" ;
     my($host) = $CSSHost;
     $host = shift if (@_ > 0);
     $host = '127.0.0.1:7777:local' if (!defined($host));
@@ -3261,6 +3263,7 @@
 #  the entity.
 #***********************************************************************
 sub entity_contains_virus_fprotd ($;$) {
+    $VirusScanner = "FPROTD" ;
     my ($entity) = shift;
 
     if (!defined($entity->bodyhandle)) {
@@ -3289,6 +3292,7 @@
 #  the entire message.
 #***********************************************************************
 sub message_contains_virus_fprotd (;$) {
+    $VirusScanner = "FPROTD" ;
     return item_contains_virus_fprotd ("$CWD/Work", $_[0]);
 }
 
@@ -3302,7 +3306,7 @@
 #  Runs the H+BEDV Antivir program on the entity. (http://www.hbedv.com)
 #***********************************************************************
 sub entity_contains_virus_hbedv ($) {
-
+    $VirusScanner = "HBEDV" ;
     unless($Features{'Virus:HBEDV'}) {
 	md_syslog('err', "$MsgID: H+BEDV not installed on this system");
 	return (wantarray ? (1, 'not-installed', 'tempfail') : 1);
@@ -3339,7 +3343,7 @@
 #  Runs the H+BEDV Antivir program on the working directory
 #***********************************************************************
 sub message_contains_virus_hbedv () {
-
+    $VirusScanner = "HBEDV" ;
     unless($Features{'Virus:HBEDV'}) {
 	md_syslog('err', "$MsgID: H+BEDV not installed on this system");
 	return (wantarray ? (1, 'not-installed', 'tempfail') : 1);
@@ -3383,7 +3387,7 @@
 #  Runs the Vexira program on the entity. (http://www.centralcommand.com)
 #***********************************************************************
 sub entity_contains_virus_vexira ($) {
-
+    $VirusScanner = "VEXIRA" ;
     unless($Features{'Virus:VEXIRA'}) {
 	md_syslog('err', "$MsgID: Vexira not installed on this system");
 	return (wantarray ? (1, 'not-installed', 'tempfail') : 1);
@@ -3420,7 +3424,7 @@
 #  Runs the Vexira program on the working directory
 #***********************************************************************
 sub message_contains_virus_vexira () {
-
+    $VirusScanner = "VEXIRA" ;
     unless($Features{'Virus:VEXIRA'}) {
 	md_syslog('err', "$MsgID: Vexira not installed on this system");
 	return (wantarray ? (1, 'not-installed', 'tempfail') : 1);
@@ -3466,7 +3470,7 @@
 #  Runs the Sophos Sweep program on the entity.
 #***********************************************************************
 sub entity_contains_virus_sophos ($) {
-
+    $VirusScanner = "SOPHOS" ;
     unless($Features{'Virus:SOPHOS'}) {
 	md_syslog('err', "$MsgID: Sophos Sweep not installed on this
system");
 	return (wantarray ? (1, 'not-installed', 'tempfail') : 1);
@@ -3502,7 +3506,7 @@
 #  Runs the Sophos Sweep program on the working directory
 #***********************************************************************
 sub message_contains_virus_sophos () {
-
+    $VirusScanner = "SOPHOS" ;
     unless($Features{'Virus:SOPHOS'}) {
 	md_syslog('err', "$MsgID: Sophos Sweep not installed on this
system");
 	return (wantarray ? (1, 'not-installed', 'tempfail') : 1);
@@ -3552,6 +3556,7 @@
 #  Runs the clamav program on the entity.
 #***********************************************************************
 sub entity_contains_virus_clamav ($) {
+    $VirusScanner = "CLAMAV" ;
     unless ($Features{'Virus:CLAMAV'}) {
 	md_syslog('err', "$MsgID: clamav not installed on this system");
 	return (wantarray ? (1, 'not-installed', 'tempfail') : 1);
@@ -3589,6 +3594,7 @@
 #  Runs the clamscan program on the working directory
 #***********************************************************************
 sub message_contains_virus_clamav () {
+    $VirusScanner = "CLAMAV" ;
     unless ($Features{'Virus:CLAMAV'}) {
 	md_syslog('err', "$MsgID: clamav not installed on this system");
 	return (wantarray ? (1, 'not-installed', 'tempfail') : 1);
@@ -3632,6 +3638,7 @@
 #  Runs the Kaspersky 5.x aveclient program on the entity.
 #***********************************************************************
 sub entity_contains_virus_avp5 ($) {
+    $VirusScanner = "AVP5" ;
     unless ($Features{'Virus:AVP5'}) {
 	md_syslog('err', "$MsgID: Kaspersky aveclient not installed on this
system");
 	return (wantarray ? (1, 'not-installed', 'tempfail') : 1);
@@ -3669,6 +3676,7 @@
 #  Runs the Kaspersky 5.x aveclient program on the working directory
 #***********************************************************************
 sub message_contains_virus_avp5 () {
+    $VirusScanner = "AVP5" ;
     unless ($Features{'Virus:AVP5'}) {
 	md_syslog('err', "$MsgID: Kaspersky aveclient not installed on this
system");
 	return (wantarray ? (1, 'not-installed', 'tempfail') : 1);
@@ -3737,6 +3745,7 @@
 #  Runs the Kaspersky kavscanner program on the entity.
 #***********************************************************************
 sub entity_contains_virus_kavscanner ($) {
+    $VirusScanner = "KAVSCANNER" ;
     unless ($Features{'Virus:KAVSCANNER'}) {
 	md_syslog('err', "$MsgID: Kaspersky kavscanner not installed on this
system");
 	return (wantarray ? (1, 'not-installed', 'tempfail') : 1);
@@ -3775,6 +3784,7 @@
 #  Runs the Kaspersky 5.x aveclient program on the working directory
 #***********************************************************************
 sub message_contains_virus_kavscanner () {
+    $VirusScanner = "KAVSCANNER" ;
     unless ($Features{'Virus:KAVSCANNER'}) {
 	md_syslog('err', "$MsgID: Kaspersky aveclient not installed on this
system");
 	return (wantarray ? (1, 'not-installed', 'tempfail') : 1);
@@ -3829,7 +3839,7 @@
 #  Runs the AvpLinux program on the entity.
 #***********************************************************************
 sub entity_contains_virus_avp ($) {
-
+    $VirusScanner = "AVP" ;
     unless ($Features{'Virus:AVP'}) {
 	md_syslog('err', "$MsgID: AVP AvpLinux not installed on this
system");
 	return (wantarray ? (1, 'not-installed', 'tempfail') : 1);
@@ -3879,7 +3889,7 @@
 #  Runs the AVP AvpLinux program on the working directory
 #***********************************************************************
 sub message_contains_virus_avp () {
-
+    $VirusScanner = "AVP" ;
     unless ($Features{'Virus:AVP'}) {
 	md_syslog('err', "$MsgID: AVP AvpLinux not installed on this
system");
 	return (wantarray ? (1, 'not-installed', 'tempfail') : 1);
@@ -3958,6 +3968,7 @@
 #  Runs the F-PROT program on the entity. (http://www.f-prot.com)
 #***********************************************************************
 sub entity_contains_virus_fprot ($) {
+    $VirusScanner = "FPROT" ;
     unless ($Features{'Virus:FPROT'}) {
 	md_syslog('err', "$MsgID: F-RISK FPROT not installed on this
system");
 	return (wantarray ? (1, 'not-installed', 'tempfail') : 1);
@@ -3997,6 +4008,7 @@
 #  Runs the F-RISK f-prot program on the working directory
 #***********************************************************************
 sub message_contains_virus_fprot () {
+    $VirusScanner = "FPROT" ;
     unless ($Features{'Virus:FPROT'}) {
 	md_syslog('err', "$MsgID: F-RISK f-prot not installed on this
system");
 	return (wantarray ? (1, 'not-installed', 'tempfail') : 1);
@@ -4064,6 +4076,7 @@
 #  Runs the vscan program on the entity.
 #***********************************************************************
 sub entity_contains_virus_trend ($) {
+    $VirusScanner = "TREND" ;
     unless ($Features{'Virus:TREND'}) {
 	md_syslog('err', "$MsgID: TREND vscan not installed on this
system");
 	return (wantarray ? (1, 'not-installed', 'tempfail') : 1);
@@ -4101,6 +4114,7 @@
 #  Runs the Trend vscan program on the working directory
 #***********************************************************************
 sub message_contains_virus_trend () {
+    $VirusScanner = "TREND" ;
     unless ($Features{'Virus:TREND'}) {
 	md_syslog('err', "$MsgID: TREND Filescanner or Interscan  not
installed on this system");
 	return (wantarray ? (1, 'not-installed', 'tempfail') : 1);
@@ -4145,7 +4159,7 @@
 #  Runs the NVCC Anti-Virus program. (http://www.norman.no/)
 #***********************************************************************
 sub entity_contains_virus_nvcc ($) {
-
+    $VirusScanner = "NVCC" ;
     unless($Features{'Virus:NVCC'}) {
 	md_syslog('err', "$MsgID: Norman Virus Control (NVCC) not installed
on this system");
 	return (wantarray ? (1, 'not-installed', 'tempfail') : 1);
@@ -4186,7 +4200,7 @@
 #  (http://www.norman.no/)
 #***********************************************************************
 sub message_contains_virus_nvcc () {
-
+    $VirusScanner = "NVCC" ;
     unless($Features{'Virus:NVCC'}) {
 	md_syslog('err', "$MsgID: Norman Virus Control (NVCC) not installed
on this system");
 	return (wantarray ? (1, 'not-installed', 'tempfail') : 1);
@@ -4241,6 +4255,7 @@
 #  on the entity.
 #***********************************************************************
 sub entity_contains_virus_sophie ($;$) {
+    $VirusScanner = "SOPHIE" ;
     my ($entity) = shift;
     my ($sophie_sock) = $SophieSock;
     $sophie_sock = shift if (@_ > 0);
@@ -4310,6 +4325,7 @@
 #  on the entire message.
 #***********************************************************************
 sub message_contains_virus_sophie (;$) {
+    $VirusScanner = "SOPHIE" ;
     my ($sophie_sock) = $SophieSock;
     $sophie_sock = shift if (@_ > 0);
     $sophie_sock = "@SPOOLDIR@/sophie" if (!defined($sophie_sock));
@@ -4369,6 +4385,7 @@
 #  on the entity.
 #***********************************************************************
 sub entity_contains_virus_clamd ($;$) {
+    $VirusScanner = "CLAMD" ;
     my ($entity) = shift;
     my ($clamd_sock) = $ClamdSock;
     $clamd_sock = shift if (@_ > 0);
@@ -4439,6 +4456,7 @@
 #  on the entire message.
 #***********************************************************************
 sub message_contains_virus_clamd (;$) {
+    $VirusScanner = "CLAMD" ;
     my ($clamd_sock) = $ClamdSock;
     $clamd_sock = shift if (@_ > 0);
     $clamd_sock = "@SPOOLDIR@/clamd.sock" if (!defined($clamd_sock));
@@ -4540,6 +4558,7 @@
 #  on the entity.
 #***********************************************************************
 sub entity_contains_virus_trophie ($;$) {
+    $VirusScanner = "TROPHIE" ;
     my ($entity) = shift;
     my ($trophie_sock) = $TrophieSock;
     $trophie_sock = shift if (@_ > 0);
@@ -4591,6 +4610,7 @@
 #  on the entire message.
 #***********************************************************************
 sub message_contains_virus_trophie (;$) {
+    $VirusScanner = "TROPHIE" ;
     my ($trophie_sock) = $TrophieSock;
     $trophie_sock = shift if (@_ > 0);
     $trophie_sock = "@SPOOLDIR@/trophie" if (!defined($trophie_sock));
-------------- next part --------------
A non-text attachment was scrubbed...
Name: mimedefang.pl.in.patch
Type: application/octet-stream
Size: 14880 bytes
Desc: mimedefang.pl.in.patch
URL: <https://lists.mimedefang.org/pipermail/mimedefang_lists.mimedefang.org/attachments/20070824/bfb366a5/attachment.obj>


More information about the MIMEDefang mailing list