From 68ecedd1ac05ce6f26d6292b1a859020f5b6c62d Mon Sep 17 00:00:00 2001 From: Matt Simerson Date: Sun, 2 May 2010 01:48:05 -0400 Subject: added ClamAV version to the X-Virus-Checked header Signed-off-by: Robert --- plugins/virus/clamdscan | 8 ++++++-- 1 files changed, 6 insertions(+), 2 deletions(-) diff --git a/plugins/virus/clamdscan b/plugins/virus/clamdscan index a7884e7..cf6c2a2 100644 --- a/plugins/virus/clamdscan +++ b/plugins/virus/clamdscan @@ -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); } -- 1.7.2.2