pkgsrc/security/f-prot-antivirus6-ms-bin/patches/patch-aa
taca 3ab3c8579c Update F-PROT Antivirus packages to 6.2.3.
F-PROT Antivirus for Unix, version 6.2.3

* Fixed a problem with multiple connections in fpscand.
* Startup scripts have been tuned and improved.
* fpscand now overrides the loglevel when run in foreground mode, forces
  it to 7 (DEBUG).
* scan-mail.pl had trouble with multiple instances and temporary file cleanup,
  this had been fixed.
* The installer now has the wrapper script option for fpscan as default.
2013-03-14 16:35:32 +00:00

87 lines
2.9 KiB
Text

$NetBSD: patch-aa,v 1.3 2013/03/14 16:35:32 taca Exp $
--- mailtools/scan-mail.pl.orig 2012-12-12 08:12:57.000000000 +0000
+++ mailtools/scan-mail.pl
@@ -81,11 +81,6 @@
use strict;
-# scan-mail.pl is in mailtools/scan-mail.pl, add mailtools/Anomy/bin
-# to @INC to find Anomy::
-use FindBin '$Bin';
-use lib "$Bin/../perl/lib";
-
use Socket;
use Anomy::Sanitizer ();
use Anomy::Sanitizer::FProt::Client ();
@@ -130,7 +125,7 @@ my @CONFIG_HARD = (
my %CONFIG_SOFT = (
# unknown=='check next rule'
- SCANMAIL_SCANLIST => ['file_list_1=.*','file_list_1_policy=unknown:unknown:drop:drop', 'file_list_1_scanner = 0:1:2:builtin/fpscand %FILENAME'],
+ SCANMAIL_SCANLIST => ['file_list_1=.*','file_list_1_policy=unknown:unknown:drop:unknown', 'file_list_1_scanner = 0:1:2:builtin/fpscand %FILENAME'],
SCANMAIL_BANLIST => ['file_list_2 =','file_list_2_policy=drop', 'file_list_2_scanner=0'],
SCANMAIL_STOPLIST => ['file_list_3 =','file_list_3_policy=save', 'file_list_3_scanner=0']
);
@@ -217,6 +212,7 @@ if (my $val = $conf->{SCANMAIL_LOGLEVEL}
# script, this is fugly
#
+my $datadir = "@VARDIR@";
my $debug = 0;
my $verbose = 0;
my $quarantine = 0;
@@ -226,7 +222,7 @@ my $milter_cf = '/etc/mail/sendmai
my $milter_conn = undef;
my $milter_name = 'fp-milter';
my $milter_pid = undef;
-my $fprot_milter = "$Bin/../mailtools/fp-milter";
+my $fprot_milter = "@FPROTDIR@/fp-milter";
my $postfix = 0;
my $postfix_ret = undef;
my $server = 0;
@@ -235,7 +231,8 @@ my $proxy = 0;
my $proxy_addr = '0.0.0.0:25';
my $smtp_addr = '127.0.0.1:26';
my $backup = 0;
-my $backup_location = "$Bin/../backup/";
+my $backup_location = "$datadir/backup/";
+my $pid_file = "$datadir/run/scan-mail.pid";
# use this for really complex configuration of
# scan-mail. /etc/f-prot.conf should take care of the simple things
@@ -467,9 +464,10 @@ if ($daemon)
defined(my $pid = fork) or die "Can't fork: $!";
exit if $pid;
setsid or die "Can't start a new session: $!";
- open PID_FILE, '>/var/run/scan-mail.pid' or die "Can't open pid file: $!";
- print PID_FILE $$;
+ open PID_FILE, ">$pid_file" or die "Can't open pid file: $!";
+ print PID_FILE "$$\n";
close PID_FILE;
+ $SIG{'TERM'} = $SIG{'HUP'} = \&clean_up;
open STDERR, '>&STDOUT' or die "Can't dup stdout: $!";
}
@@ -628,6 +626,12 @@ else
##[ Subroutines ]##############################################################
+sub clean_up
+{
+ unlink($pid_file);
+ exit(0);
+}
+
# proxy address, smtp address
sub run_smtp_proxy
{
@@ -1058,7 +1062,7 @@ sub do_scan
unless(-d $pathto)
{
- unless (mkdir($pathto,1777) or $!{'EEXIST'})
+ unless (mkdir($pathto,1777) or $!{'EEXIST'})
{
my $err = "Unable to create backup subdir $pathto: $!";
syslog err => $err;