1 $NetBSD: patch-aa,v 1.1.1.1 2009/09/22 17:41:07 taca Exp $
3 --- mailtools/scan-mail.pl.orig 2010-04-12 14:18:39.000000000 +0000
4 +++ mailtools/scan-mail.pl
9 -# scan-mail.pl is in mailtools/scan-mail.pl, add mailtools/Anomy/bin
10 -# to @INC to find Anomy::
12 -use lib "$Bin/../perl/lib";
15 use Anomy::Sanitizer ();
16 use Anomy::Sanitizer::FProt::Client ();
17 @@ -130,7 +125,7 @@ my @CONFIG_HARD = (
20 # unknown=='check next rule'
21 - SCANMAIL_SCANLIST => ['file_list_1=.*','file_list_1_policy=unknown:unknown:drop:drop', 'file_list_1_scanner = 0:1:2:builtin/fpscand %FILENAME'],
22 + SCANMAIL_SCANLIST => ['file_list_1=.*','file_list_1_policy=unknown:unknown:drop:unknown', 'file_list_1_scanner = 0:1:2:builtin/fpscand %FILENAME'],
23 SCANMAIL_BANLIST => ['file_list_2 =','file_list_2_policy=drop', 'file_list_2_scanner=0'],
24 SCANMAIL_STOPLIST => ['file_list_3 =','file_list_3_policy=save', 'file_list_3_scanner=0']
26 @@ -201,6 +196,7 @@ if (my $val = $conf->{SCANMAIL_LOGLEVEL}
27 # script, this is fugly
30 +my $datadir = "@VARDIR@";
34 @@ -210,7 +206,7 @@ my $milter_cf = '/etc/mail/sendmai
35 my $milter_conn = undef;
36 my $milter_name = 'fp-milter';
37 my $milter_pid = undef;
38 -my $fprot_milter = "$Bin/../mailtools/fp-milter";
39 +my $fprot_milter = "@FPROTDIR@/fp-milter";
41 my $postfix_ret = undef;
43 @@ -219,7 +215,8 @@ my $proxy = 0;
44 my $proxy_addr = '0.0.0.0:25';
45 my $smtp_addr = '127.0.0.1:26';
47 -my $backup_location = "$Bin/../backup/";
48 +my $backup_location = "$datadir/backup/";
49 +my $pid_file = "$datadir/run/scan-mail.pid";
51 # use this for really complex configuration of
52 # scan-mail. /etc/f-prot.conf should take care of the simple things
53 @@ -441,9 +438,11 @@ if ($daemon)
54 defined(my $pid = fork) or die "Can't fork: $!";
56 setsid or die "Can't start a new session: $!";
57 - open PID_FILE, '>/var/run/scan-mail.pid' or die "Can't open pid file: $!";
58 + open PID_FILE, ">$pid_file" or die "Can't open pid file: $!";
59 + print PID_FILE "$$\n";
62 + $SIG{'TERM'} = $SIG{'HUP'} = \&clean_up;
63 open STDERR, '>&STDOUT' or die "Can't dup stdout: $!";
66 @@ -602,6 +601,12 @@ else
68 ##[ Subroutines ]##############################################################
76 # proxy address, smtp address
79 @@ -1020,7 +1025,7 @@ sub do_scan
80 my $subdir = "/".$m.$d."/";
81 unless (-d $backup_location)
83 - unless (mkdir($backup_location,1777))
84 + unless (mkdir($backup_location,1777) or $!{'EEXIST'})
86 my $err = "Unable to create backup basedir $backup_location: $!";
88 @@ -1032,7 +1037,7 @@ sub do_scan
92 - unless (mkdir($pathto,1777))
93 + unless (mkdir($pathto,1777) or $!{'EEXIST'})
95 my $err = "Unable to create backup subdir $pathto: $!";
97 @@ -1080,7 +1085,16 @@ sub do_scan
100 # Try to delete the directory. Will fail unless it's empty.
104 + # But it cause some race, keep the directory and remove it by
105 + # another script using find command or execute same functionality
109 + # cd $backup_location
110 + # find . -type d -name '[0-1]*' -mtime +7 rmdir {} \; >/dev/null 2>&1