#362 AMaViS ignores $VIRUSERR if clamd is used

open-later
Lars Hecking
None
5
2005-06-27
2005-05-17
TobiasEgg
No

By setting $VIRUSERR (line 319 in a qmail-config) to
31, AMaViS should exit with a return value of 31 if a
virus was found. qmail would than block the virulent
message right in the smtp-dialogue.

This works fine, if clamscan is used. But if clamd is
used to scan for viruses, no return value is returned.
No other virus specific action is taken neither.

To fix it, replace Clamd-Start-Block from line 490
(with my installation, amavis 0.3.12 with qmail and
ClamAV) on with:

#
# ClamAV Daemon
#
use IO::Socket;

if ($clamd) {
do_log(2,"Using clamd");
my $sock = IO::Socket::INET->new('127.0.0.1:3310');
if (defined $sock) {
$sock->print("SCAN $TEMPDIR/parts\n");
$sock->flush;
chomp($output = $sock->getline);
$sock->close;
do_log(2,$output);
if ($output =~ /FOUND$/) { # no errors, a
virus was found
$scanner_errors = 0;
@virusname = ($output =~ /: (.+) FOUND/g);
do_virus($output);
return 1; # 'true' indicates virus found
and stops further checking
} elsif ($output =~ /OK$/) { # no
errors, no viruses
$scanner_errors = 0;
} elsif ($output =~ /ERROR$/) {
do_log(0,"Virus scanner failure:
ScannerDaemon - UNKNOWN STATUS (error code: $output)");
}
} else {
do_log(0,"Virus scanner failure: Clamd - can't
connect to daemon");
}
}

Discussion

  • TobiasEgg
    TobiasEgg
    2005-05-17

    New version for amavis/av/clamavd

     
    Attachments
  • TobiasEgg
    TobiasEgg
    2005-05-18

    Logged In: YES
    user_id=1280083

    Bug is present in amavisd too.

     
  • Rainer Link
    Rainer Link
    2005-06-27

    Logged In: YES
    user_id=34819

    Sorry for the late reply :-(

    Lars, are you willing to fix this in CVS for amavis/amavisd?
    Or do you consider both branches as dead?

    Thanks

     
  • Rainer Link
    Rainer Link
    2005-06-27

    • assigned_to: nobody --> lhecking
    • status: open --> pending-later
     
  • Rainer Link
    Rainer Link
    2005-06-27

    • status: pending-later --> open-later
     
  • Rainer Link
    Rainer Link
    2005-06-27

    Logged In: YES
    user_id=34819

    changed status from pending -> open