~yolanda.robla/ubuntu/saucy/clamav/dep-8-tests

2 by Stephen Gran
* Change dependency versioning for clamav-milter
1
#!/usr/bin/perl
2
# Filters mail through clamav. Intented to be used as a maildrop xfilter,
3
# So it takes care to exit 0 on success, and nonzero on error. Adds a
4
# X-Virii-Status header.
5
# Contributed by Joey Hess <joeyh@debian.org> to be used with procmail
6
use strict;
7
use warnings;
8
9
$/=undef;
10
my $msg=<>;
11
0.39.1 by Michael Meskes, Stephen Gran, Michael Meskes, Michael Tautschnig
[ Stephen Gran ]
12
open (CLAM, "| clamscan --quiet -")
2 by Stephen Gran
* Change dependency versioning for clamav-milter
13
	|| die "cannot run clamscan: $!";
14
# The --mbox support is flakey and requires a From header as in a real
15
# mbox.
16
print CLAM "From foo\n";
17
print CLAM $msg;
18
close CLAM;
19
# Returns status of 1 for virii.
20
my $status= ($? >> 8 == 1) ? "yes" : "no";
21
#print STDERR "status: ".($? >> 8)." $!\n";
22
23
open (FORMAIL, "|formail -i 'X-Virii-Status: $status'")
24
	|| die "cannot run formail: $!!";
25
print FORMAIL $msg
26
	|| die "cannot write to formail: $!";
27
close FORMAIL
28
	|| die "formail failed: $!";
29
30
exit 0;