View | Details | Raw Unified | Return to bug 187005
Collapse All | Expand All

(-)mailscanner/Makefile (-3 / +3 lines)
Lines 2-9 Link Here
2
# $FreeBSD: head/mail/mailscanner/Makefile 327742 2013-09-20 19:59:12Z bapt $
2
# $FreeBSD: head/mail/mailscanner/Makefile 327742 2013-09-20 19:59:12Z bapt $
3
3
4
PORTNAME=	MailScanner
4
PORTNAME=	MailScanner
5
PORTVERSION=	4.84.5
5
PORTVERSION=	4.84.6
6
PORTREVISION=	3
6
#PORTREVISION=	0
7
CATEGORIES=	mail
7
CATEGORIES=	mail
8
MASTER_SITES=	http://www.mailscanner.info/files/4/tar/
8
MASTER_SITES=	http://www.mailscanner.info/files/4/tar/
9
DISTNAME=	${PORTNAME}-install-${PORTVERSION}-${PATCHLEVEL}
9
DISTNAME=	${PORTNAME}-install-${PORTVERSION}-${PATCHLEVEL}
Lines 38-44 Link Here
38
38
39
CONFLICTS=	MailScanner-devel-[0-9]*
39
CONFLICTS=	MailScanner-devel-[0-9]*
40
40
41
PATCHLEVEL=	2
41
PATCHLEVEL=	1
42
42
43
USES=		perl5
43
USES=		perl5
44
44
(-)mailscanner/distinfo (-2 / +2 lines)
Lines 1-2 Link Here
1
SHA256 (MailScanner-install-4.84.5-2.tar.gz) = 3467a53159cc95a8b4f93a326a59e2d3acc0ad6f90f048f048742fe13ac741f1
1
SHA256 (MailScanner-install-4.84.6-1.tar.gz) = 566b6e2abf86de1acdff4f7fc5e6112aebab986954532a25f69b9f576ec70077
2
SIZE (MailScanner-install-4.84.5-2.tar.gz) = 9510489
2
SIZE (MailScanner-install-4.84.6-1.tar.gz) = 9524836
(-)mailscanner/files/CHANGES.port (+7 lines)
Lines 1-3 Link Here
1
Version 4.84.6
2
==============
3
- Upgrade to 4.84.6
4
- Added some patches for tmp file bugs
5
  reported/provided by brad@comstyle.com
6
  from the OpenBSD port and GitHub repository.
7
1
Version 4.84.5_3 (not bumped)
8
Version 4.84.5_3 (not bumped)
2
================
9
================
3
- Use OptionsNG
10
- Use OptionsNG
(-)mailscanner/files/patch-lib__MailScanner__CustomFunctions__LastSpam.pm (+20 lines)
Line 0 Link Here
1
--- ./lib/MailScanner/CustomFunctions/LastSpam.pm.orig	2011-08-20 08:24:49.000000000 -0400
2
+++ ./lib/MailScanner/CustomFunctions/LastSpam.pm	2014-02-21 04:11:09.000000000 -0500
3
@@ -32,7 +32,6 @@
4
 my $Debug = 0; # Set to 1 to enable debug output to STDERR
5
 #my $tmpfilename = "/tmp/MailScanner.LastSpam.$$.conf"; # Temp MS.conf file
6
 # Temp MS.conf file
7
-my($tmpfh, $tmpfilename) = tempfile("MailScanner.LastSpam.XXXXXX", TMPDIR => 1, UNLINK => 0);
8
 my %modtime = (); # Time domain list magic word file was last changed
9
 my %filename = (); # Map Config option to magic word file
10
 my %magicwords = {}; # Map Config option --> domains --> magic words
11
@@ -550,8 +549,7 @@
12
 sub SetupRuleset {
13
   my($opkeyword) = @_;
14
 
15
-  my $fh = new FileHandle;
16
-  $fh->open("> $tmpfilename") or die "$!";
17
+  my($fh, $tmpfilename) = tempfile("MailScanner.LastSpam.XXXXXX", TMPDIR => 1, UNLINK => 0);
18
   my $rf = $rulesetfilename{$opkeyword};
19
   #print STDERR "RF = $rf\n";
20
   #print STDERR $opkeyword . " = $rf\n";
(-)mailscanner/files/patch-lib__MailScanner__CustomFunctions__Ruleset-from-Function.pm (+20 lines)
Line 0 Link Here
1
--- ./lib/MailScanner/CustomFunctions/Ruleset-from-Function.pm.orig	2011-08-20 08:25:42.000000000 -0400
2
+++ ./lib/MailScanner/CustomFunctions/Ruleset-from-Function.pm	2014-02-21 04:16:55.000000000 -0500
3
@@ -31,7 +31,6 @@
4
 
5
 my $Debug = 0; # Set to 1 to enable debug output to STDERR
6
 #my $tmpfilename = "/tmp/MailScanner.$$.conf"; # Temp MS.conf file
7
-my($tmpfh, $tmpfilename) = tempfile("MailScanner.XXXXXX", TMPDIR => 1, UNLINK => 0);
8
 
9
 
10
 
11
@@ -60,8 +59,7 @@
12
   my $option = 'virusscanning'; # External (MailScanner.conf-version)
13
 
14
   # Make the temporary 1-line MailScanner.conf file, use it and delete it
15
-  my $fh = new FileHandle;
16
-  $fh->open("> $tmpfilename") or die "$!";
17
+  my($fh, $tmpfilename) = tempfile("MailScanner.XXXXXX", TMPDIR => 1, UNLINK => 0);
18
   print $fh $option . " = $ruleset\n";
19
   $fh->close;
20
 
(-)mailscanner/files/patch-lib__MailScanner__TNEF.pm (-10 / +100 lines)
Lines 1-20 Link Here
1
--- ./lib/MailScanner/TNEF.pm.orig	2011-08-20 08:32:02.000000000 -0400
1
--- ./lib/MailScanner/TNEF.pm.orig	2013-06-17 09:29:16.000000000 -0400
2
+++ ./lib/MailScanner/TNEF.pm	2012-03-15 11:28:31.000000000 -0400
2
+++ ./lib/MailScanner/TNEF.pm	2014-02-21 04:03:15.000000000 -0500
3
@@ -229,15 +229,14 @@
3
@@ -229,18 +229,25 @@
4
 
4
 
5
   # Create the subdir to unpack it into
5
   # Create the subdir to unpack it into
6
   #my $unpackdir = "tnef.$$";
6
   #my $unpackdir = "tnef.$$";
7
-  my ($tmpfh, $unpackdir) = tempfile("tnefXXXXXX", TMPDIR => $dir, UNLINK => 0);
7
-  my ($tmpfh, $unpackdir) = tempfile("tnefXXXXXX", TMPDIR => $dir, UNLINK => 0);
8
-  $dir =~ s,^.*/,,;
8
-  # This line shouldn't be here any more! $dir =~ s,^.*/,,;
9
+  my $unpackdir = tempdir("tnefXXXXXX");
9
-  $unpackdir = $message->MakeNameSafe($unpackdir, $dir);
10
   $unpackdir = $message->MakeNameSafe($unpackdir, $dir);
10
-  unless (mkdir "$dir/$unpackdir", 0777) {
11
   unless (mkdir "$dir/$unpackdir", 0777) {
11
+  my $unpackdir = tempdir("tnefXXXXXX", DIR => $dir);
12
+  unless (-d $unpackdir) {
12
     MailScanner::Log::WarnLog("Trying to unpack %s in message %s, could not create subdirectory %s, failed to unpack TNEF message", $tnefname, $message->{id},
13
     MailScanner::Log::WarnLog("Trying to unpack %s in message %s, could not create subdirectory %s, failed to unpack TNEF message", $tnefname, $message->{id},
13
                               "$dir/$unpackdir");
14
-                              "$dir/$unpackdir");
15
+                              "$unpackdir");
14
     return 0;
16
     return 0;
15
   }
17
   }
16
-  chmod 0700, "$dir/$unpackdir";
18
-  chmod 0700, "$dir/$unpackdir";
17
+  chmod 0770, "$dir/$unpackdir";
19
+  # Convert Incoming Work Permissions to an octal value and add search.
20
+  my $perms = oct(sprintf("%s", MailScanner::Config::Value('workperms')))
21
+    | 0111;
22
+  chmod $perms, $unpackdir;
23
+  # Try to set Incoming Work User and Group.
24
+  my $uname = MailScanner::Config::Value('workuser');
25
+  my $gname = MailScanner::Config::Value('workgroup');
26
+  my $uid = $uname?getpwnam($uname):-1;
27
+  my $gid = $gname?getgrnam($gname):-1;
28
+  chown $uid, $gid, $unpackdir;
18
 
29
 
19
   my $cmd = MailScanner::Config::Value('tnefexpander') .
30
   my $cmd = MailScanner::Config::Value('tnefexpander') .
20
             " -f $dir/$tnefname -C $dir/$unpackdir --overwrite";
31
-            " -f $dir/$tnefname -C $dir/$unpackdir --overwrite";
32
+            " -f $dir/$tnefname -C $unpackdir --overwrite";
33
 
34
   my($kid);
35
   my($TimedOut, $PipeReturn, $pid);
36
@@ -311,15 +318,15 @@
37
 
38
     unless (MailScanner::Config::Value('replacetnef',$message) =~ /[12]/) {
39
       # Just need to move all the unpacked files into the main attachments dir
40
-      my $dirh = new DirHandle "$dir/$unpackdir";
41
+      my $dirh = new DirHandle "$$unpackdir";
42
       return 0 unless defined $dirh;
43
       while (defined(my $unpacked = $dirh->read)) {
44
-        next unless -f "$dir/$unpackdir/$unpacked";
45
+        next unless -f "$$unpackdir/$unpacked";
46
         # Add a 't' to the safename to mark it as a tnef member.
47
         my $safe = $message->MakeNameSafe('t'.$unpacked, $dir);
48
         # This will cause big problems as $safe has a type, and shouldn't!
49
         $message->{file2parent}{$safe} = $tnefname;
50
-        my $name1 = "$dir/$unpackdir/$unpacked";
51
+        my $name1 = "$unpackdir/$unpacked";
52
         $name1 =~ /(.*)/;
53
         $name1 = $1;
54
         my $name2 = "$dir/$safe";
55
@@ -333,19 +340,21 @@
56
         $safe =~ s#^(.*/)([^/])([^/]+)$#$1$3#; # I assert $2 will equal 't'.
57
         $message->{file2parent}{$safe} = $tnefname;
58
       }
59
-      rmdir "$dir/$unpackdir"; # Directory should be empty now
60
+      # The following may result in a warning from a virus scanner that
61
+      # tries to lstat the directory, but it was empty so it can be ignored.
62
+      rmdir "$$unpackdir"; # Directory should be empty now
63
       return 1;
64
     }
65
     #print STDERR "In TNEF External Decoder\n";
66
 
67
-    my $dirh = new DirHandle "$dir/$unpackdir";
68
+    my $dirh = new DirHandle "$unpackdir";
69
     return 0 unless defined $dirh;
70
     my($type, $encoding);
71
     $message->{entity}->make_multipart;
72
     my($safename, @replacements, $unpacked);
73
     while (defined($unpacked = $dirh->read)) {
74
-      #print STDERR "Directory entry is \"$unpacked\" in \"$dir/$unpackdir\"\n";
75
-      next unless -f "$dir/$unpackdir/$unpacked";
76
+      #print STDERR "Directory entry is \"$unpacked\" in \"$unpackdir\"\n";
77
+      next unless -f "$unpackdir/$unpacked";
78
       # Add a 't' to the safename to mark it as a tnef member.
79
       $safename = $message->MakeNameSafe('t'.$unpacked, $dir);
80
       if (/^msg[\d-]+\.txt$/) {
81
@@ -353,15 +362,15 @@
82
       } else {
83
         ($type, $encoding) = ("application/octet-stream", "base64");
84
       }
85
-      #print STDERR "Renaming '$dir/$unpackdir/$unpacked' to '$dir/$safename'\n";
86
-      my $oldname = "$dir/$unpackdir/$unpacked";
87
+      #print STDERR "Renaming '$unpackdir/$unpacked' to '$dir/$safename'\n";
88
+      my $oldname = "$unpackdir/$unpacked";
89
       my $newname = "$dir/$safename";
90
       $oldname =~ /^(.*)$/;
91
       $oldname = $1;
92
       $newname =~ /^(.*)$/;
93
       $newname = $1;
94
       rename $oldname, $newname;
95
-      #rename "$dir/$unpackdir/$unpacked", "$dir/$safename";
96
+      #rename "$unpackdir/$unpacked", "$dir/$safename";
97
       # JKF 20090421 CHMOD, then CHOWN and CHGRP it if necessary.
98
       chmod $perms, $newname;
99
       #chmod $perms, "$dir/$safename";
100
@@ -381,7 +390,9 @@
101
     $message->{bodymodified} = 1;
102
     $message->{foundtnefattachments} = 1;
103
     undef $dirh;
104
-    rmdir "$dir/$unpackdir"; # Directory should be empty now
105
+    # The following may result in a warning from a virus scanner that
106
+    # tries to lstat the directory, but it was empty so it can be ignored.
107
+    rmdir "$unpackdir"; # Directory should be empty now
108
     #$message->{entity}->dump_skeleton();
109
 
110
     MailScanner::Log::InfoLog("Message %s added TNEF contents %s",
(-)mailscanner/files/patch-lib__bitdefender-wrapper (+19 lines)
Line 0 Link Here
1
--- ./lib/bitdefender-wrapper.orig	2011-08-20 08:20:04.000000000 -0400
2
+++ ./lib/bitdefender-wrapper	2014-02-21 04:19:02.000000000 -0500
3
@@ -34,7 +34,6 @@
4
 extras=''
5
 
6
 #LogFile=/tmp/log.bdc.$$
7
-LogFile=$(mktemp) || { echo "$0: Cannot create temporary file" >&2; exit 1; }
8
 
9
 if [ -x ${PackageDir}/bdscan ]; then
10
   # Version 7.5 is installed
11
@@ -60,7 +59,7 @@
12
 fi
13
 
14
 umask 077
15
-rm -f $LogFile
16
+LogFile=$(mktemp) || { echo "$0: Cannot create temporary file" >&2; exit 1; }
17
 ${PackageDir}/$prog --log=$LogFile $extras "$@" >/dev/null 2>&1
18
 cat $LogFile
19
 rm -f $LogFile
(-)mailscanner/files/patch-lib__clamav-wrapper (+55 lines)
Line 0 Link Here
1
--- ./lib/clamav-wrapper.orig	2011-08-20 08:32:02.000000000 -0400
2
+++ ./lib/clamav-wrapper	2014-02-21 04:21:05.000000000 -0500
3
@@ -52,7 +52,6 @@
4
 # You may want to check this script for bash-isms
5
 
6
 #TempDir="/tmp/clamav.$$"
7
-TempDir=$(mktemp) || { echo "$0: Cannot make name for temporary dir" >&2; exit 1; }
8
 ClamUser="clamav"
9
 ClamGroup="clamav"
10
 
11
@@ -99,23 +98,23 @@
12
 # LESS COMMON unpackers, which probably aren't installed by default
13
 # (hence disabled)
14
 # Uncomment ONE of the following lines if you have unrar installed
15
-#ExtraScanOptions="$ExtraScanOptions --unrar"  
16
+ExtraScanOptions="$ExtraScanOptions --unrar"  
17
 #ExtraScanOptions="$ExtraScanOptions --unrar=/path/to/unrar" 
18
 
19
 # Uncomment ONE of the following lines if you have unarj installed
20
-#ExtraScanOptions="$ExtraScanOptions --unarj"  
21
+ExtraScanOptions="$ExtraScanOptions --unarj"  
22
 #ExtraScanOptions="$ExtraScanOptions --unarj=/path/to/unarj" 
23
 
24
 # Uncomment ONE of the following lines if you have unace installed
25
-#ExtraScanOptions="$ExtraScanOptions --unace"  
26
+ExtraScanOptions="$ExtraScanOptions --unace"  
27
 #ExtraScanOptions="$ExtraScanOptions --unace=/path/to/unace" 
28
 
29
 # Uncomment ONE of the following lines if you have lha installed
30
-#ExtraScanOptions="$ExtraScanOptions --lha"  
31
+ExtraScanOptions="$ExtraScanOptions --lha"  
32
 #ExtraScanOptions="$ExtraScanOptions --lha=/path/to/lha" 
33
 
34
 # Uncomment ONE of the following lines if you have zoo installed
35
-#ExtraScanOptions="$ExtraScanOptions --zoo"  
36
+ExtraScanOptions="$ExtraScanOptions --zoo"  
37
 #ExtraScanOptions="$ExtraScanOptions --zoo=/path/to/unzoo" 
38
 
39
 # Now increase the allowed expansion size of zip files
40
@@ -140,14 +139,10 @@
41
 PATH=$PATH:/usr/ucb
42
 export PATH
43
 
44
-# Check if the tmpdir exists, if so delete so we start with a clean slate
45
-if [ -x "${TempDir}" ]; then
46
-	rm -rf ${TempDir} >/dev/null 2>&1
47
-fi
48
 
49
 # Make the Temp dir
50
 umask 0077
51
-mkdir "${TempDir}" >/dev/null 2>&1
52
+TempDir=$(mktemp -d) || { echo "$0: Cannot create temporary dir" >&2; exit 1; }
53
 
54
 # In case we get interupted....
55
 trap "rm -rf ${TempDir}" EXIT
(-)mailscanner/files/patch-lib__kaspersky-wrapper (+50 lines)
Line 0 Link Here
1
--- ./lib/kaspersky-wrapper.orig	2011-08-20 08:32:02.000000000 -0400
2
+++ ./lib/kaspersky-wrapper	2014-02-21 04:22:39.000000000 -0500
3
@@ -42,14 +42,13 @@
4
 Scanner=kav4fs/bin/kav4fs-kavscanner
5
 if [ -x ${PackageDir}/$Scanner ]; then
6
   #Report=/tmp/kavoutput.tmp.$$
7
-  Report=$(mktemp) || { echo "$0: Cannot create temporary file" >&2; exit 1; }
8
   ScanOptions="-xp -i0" # Don't report progress, don't attempt to clean
9
   if [ "x$1" = "x-IsItInstalled" ]; then
10
     exit 0
11
   fi
12
 
13
   Args=`echo "$@" | sed -e 's/ -I/ -i/g; s/^-I/-i/g; s/-- / /g;'`
14
-  rm -f $Report
15
+  Report=$(mktemp) || { echo "$0: Cannot create temporary file" >&2; exit 1; }
16
   # 29/09/05 JKF Removed -j3 on advice from Kaspersky users
17
   ${PackageDir}/$Scanner $ScanOptions -o$Report -q "$@"
18
   cat $Report
19
@@ -61,14 +60,13 @@
20
 Scanner=kav4unix/bin/kavscanner
21
 if [ -x ${PackageDir}/$Scanner ]; then
22
   #Report=/tmp/kavoutput.tmp.$$
23
-  Report=$(mktemp) || { echo "$0: Cannot create temporary file" >&2; exit 1; }
24
   ScanOptions="-xp -i0" # Don't report progress, don't attempt to clean
25
   if [ "x$1" = "x-IsItInstalled" ]; then
26
     exit 0
27
   fi
28
 
29
   Args=`echo "$@" | sed -e 's/ -I/ -i/g; s/^-I/-i/g; s/-- / /g;'`
30
-  rm -f $Report
31
+  Report=$(mktemp) || { echo "$0: Cannot create temporary file" >&2; exit 1; }
32
   # 29/09/05 JKF Removed -j3 on advice from Kaspersky users
33
   ${PackageDir}/$Scanner $ScanOptions -o$Report -q "$@"
34
   cat $Report
35
@@ -80,14 +78,13 @@
36
 Scanner=bin/kavscanner
37
 if [ -x ${PackageDir}/$Scanner ]; then
38
   #Report=/tmp/kavoutput.tmp.$$
39
-  Report=$(mktemp) || { echo "$0: Cannot create temporary file" >&2; exit 1; }
40
   ScanOptions="-xp -i0" # Don't report progress, don't attempt to clean
41
   if [ "x$1" = "x-IsItInstalled" ]; then
42
     exit 0
43
   fi
44
 
45
   Args=`echo "$@" | sed -e 's/ -I/ -i/g; s/^-I/-i/g; s/-- / /g;'`
46
-  rm -f $Report
47
+  Report=$(mktemp) || { echo "$0: Cannot create temporary file" >&2; exit 1; }
48
   # 29/09/05 JKF Removed -j3 on advice from Kaspersky users
49
   ${PackageDir}/$Scanner $ScanOptions -o$Report -q "$@"
50
   cat $Report
(-)mailscanner/files/patch-lib__trend-autoupdate (+11 lines)
Line 0 Link Here
1
--- ./lib/trend-autoupdate.orig	2011-08-20 08:27:46.000000000 -0400
2
+++ ./lib/trend-autoupdate	2014-02-21 04:24:23.000000000 -0500
3
@@ -16,7 +16,7 @@
4
 shift
5
 
6
 #TEMPDIR=/tmp/trend-update.$$
7
-TEMPDIR=$(mktemp) || { echo "$0: Cannot create temporary file" >&2; exit 1; }
8
+TEMPDIR=$(mktemp -d) || { echo "$0: Cannot create temporary file" >&2; exit 1; }
9
 # In case it's a link
10
 rm -f $TEMPDIR >/dev/null 2>&1
11
 # In case it's a dir

Return to bug 187005