1 |
slords |
1.1 |
From 68ecedd1ac05ce6f26d6292b1a859020f5b6c62d Mon Sep 17 00:00:00 2001 |
2 |
|
|
From: Matt Simerson <matt@tnpi.net> |
3 |
|
|
Date: Sun, 2 May 2010 01:48:05 -0400 |
4 |
|
|
Subject: added ClamAV version to the X-Virus-Checked header |
5 |
|
|
|
6 |
|
|
Signed-off-by: Robert <rspier@pobox.com> |
7 |
|
|
--- |
8 |
|
|
plugins/virus/clamdscan | 8 ++++++-- |
9 |
|
|
1 files changed, 6 insertions(+), 2 deletions(-) |
10 |
|
|
|
11 |
|
|
diff --git a/plugins/virus/clamdscan b/plugins/virus/clamdscan |
12 |
|
|
index a7884e7..cf6c2a2 100644 |
13 |
|
|
--- a/plugins/virus/clamdscan |
14 |
|
|
+++ b/plugins/virus/clamdscan |
15 |
|
|
@@ -1,5 +1,4 @@ |
16 |
|
|
#!/usr/bin/perl -w |
17 |
|
|
-# $Id$ |
18 |
|
|
|
19 |
|
|
=head1 NAME |
20 |
|
|
|
21 |
|
|
@@ -111,6 +110,7 @@ use warnings; |
22 |
|
|
sub register { |
23 |
|
|
my ( $self, $qp, @args ) = @_; |
24 |
|
|
|
25 |
|
|
+ $self->log(LOGERROR, "Bad parameters for the clamdscan plugin") if @_ % 2; |
26 |
|
|
%{ $self->{"_clamd"} } = @args; |
27 |
|
|
|
28 |
|
|
# Set some sensible defaults |
29 |
|
|
@@ -198,6 +198,9 @@ sub hook_data_post { |
30 |
|
|
return DECLINED; |
31 |
|
|
} |
32 |
|
|
|
33 |
|
|
+ my @clamd_version = split(/\//, $clamd->version); |
34 |
|
|
+ $self->{"_clamd"}->{'version'} = $clamd_version[0] || 'ClamAV'; |
35 |
|
|
+ |
36 |
|
|
my ( $path, $found ) = eval { $clamd->scan_path( $filename ) }; |
37 |
|
|
if ($@) { |
38 |
|
|
$self->log( LOGERROR, "Error scanning mail: $@" ); |
39 |
|
|
@@ -218,11 +221,12 @@ sub hook_data_post { |
40 |
|
|
} |
41 |
|
|
} |
42 |
|
|
else { |
43 |
|
|
+ $transaction->header->add( 'X-Virus-Found', 'No' ); |
44 |
|
|
$self->log( LOGINFO, "ClamAV scan reports clean"); |
45 |
|
|
} |
46 |
|
|
|
47 |
|
|
$transaction->header->add( 'X-Virus-Checked', |
48 |
|
|
- "Checked by ClamAV on " . $self->qp->config("me") ); |
49 |
|
|
+ "Checked by $self->{'_clamd'}->{'version'} on " . $self->qp->config("me") ); |
50 |
|
|
|
51 |
|
|
return (DECLINED); |
52 |
|
|
} |
53 |
|
|
-- |
54 |
|
|
1.7.2.2 |
55 |
|
|
|