Permalink
Browse files

added ClamAV version to the X-Virus-Checked header

Signed-off-by: Robert <rspier@pobox.com>
  • Loading branch information...
1 parent 93c1a23 commit 68ecedd1ac05ce6f26d6292b1a859020f5b6c62d @msimerson msimerson committed with rspier May 2, 2010
Showing with 6 additions and 2 deletions.
  1. +6 −2 plugins/virus/clamdscan
View
@@ -1,5 +1,4 @@
#!/usr/bin/perl -w
-# $Id$
=head1 NAME
@@ -111,6 +110,7 @@ use warnings;
sub register {
my ( $self, $qp, @args ) = @_;
+ $self->log(LOGERROR, "Bad parameters for the clamdscan plugin") if @_ % 2;
%{ $self->{"_clamd"} } = @args;
# Set some sensible defaults
@@ -198,6 +198,9 @@ sub hook_data_post {
return DECLINED;
}
+ my @clamd_version = split(/\//, $clamd->version);
+ $self->{"_clamd"}->{'version'} = $clamd_version[0] || 'ClamAV';
+
my ( $path, $found ) = eval { $clamd->scan_path( $filename ) };
if ($@) {
$self->log( LOGERROR, "Error scanning mail: $@" );
@@ -218,11 +221,12 @@ sub hook_data_post {
}
}
else {
+ $transaction->header->add( 'X-Virus-Found', 'No' );
$self->log( LOGINFO, "ClamAV scan reports clean");
}
$transaction->header->add( 'X-Virus-Checked',
- "Checked by ClamAV on " . $self->qp->config("me") );
+ "Checked by $self->{'_clamd'}->{'version'} on " . $self->qp->config("me") );
return (DECLINED);
}

0 comments on commit 68ecedd

Please sign in to comment.