Bug 187005 - [PATCH] mail/mailscanner: Update to current stable version
Summary: [PATCH] mail/mailscanner: Update to current stable version
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: Normal Affects Only Me
Assignee: Chris Rees
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-02-24 13:20 UTC by Kevin Kobb
Modified: 2014-02-28 20:10 UTC (History)
0 users

See Also:


Attachments
file.diff (16.34 KB, patch)
2014-02-24 13:20 UTC, Kevin Kobb
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Kevin Kobb 2014-02-24 13:20:00 UTC
MailScanner port is not at the current stable version. Also has some nasty tmp file bugs reported by brad@comstyle.com.

Fix: See attached patch file.

Patch attached with submission follows:
How-To-Repeat: Check port versus upstream release. Look for stale temp files in SpamAssassin-Temp directory.
Comment 1 Edwin Groothuis freebsd_committer 2014-02-24 13:20:08 UTC
Class Changed
From-To: update->maintainer-update

Fix category (submitter is maintainer) (via the GNATS Auto Assign Tool)
Comment 2 Edwin Groothuis freebsd_committer 2014-02-24 13:20:10 UTC
Responsible Changed
From-To: freebsd-ports-bugs->crees

crees@ wants this port PRs (via the GNATS Auto Assign Tool)
Comment 3 Chris Rees freebsd_committer 2014-02-24 21:16:06 UTC
State Changed
From-To: open->feedback

Thanks for this quick update Kevin.  I've staged the port, and also 
unmuted the install commands to match the rest of the ports tree.  Is 
that OK with you? 
http://www.bayofrum.net/~crees/patches/mailscanner-stage.diff
Comment 4 Kevin Kobb 2014-02-28 19:28:53 UTC
Fine with me if Chris wants to unmute the install. Please go ahead and 
commit any time.

Thanks
Comment 5 dfilter service freebsd_committer 2014-02-28 20:05:09 UTC
Author: crees
Date: Fri Feb 28 20:04:59 2014
New Revision: 346574
URL: http://svnweb.freebsd.org/changeset/ports/346574
QAT: https://qat.redports.org/buildarchive/r346574/

Log:
  Update to 4.84.6
  
  Fix temporary file bugs
  Pointed out by:	brad@comstyle.com
  
  PR:		ports/187005
  Submitted by:	Kevin Kobb (maintainer)
  
  Style and shebang fixes and stage.

Added:
  head/mail/mailscanner/files/patch-lib__MailScanner__CustomFunctions__LastSpam.pm   (contents, props changed)
  head/mail/mailscanner/files/patch-lib__MailScanner__CustomFunctions__Ruleset-from-Function.pm   (contents, props changed)
Modified:
  head/mail/mailscanner/Makefile
  head/mail/mailscanner/distinfo
  head/mail/mailscanner/files/CHANGES.port
  head/mail/mailscanner/files/patch-lib__MailScanner__TNEF.pm
  head/mail/mailscanner/pkg-plist

Modified: head/mail/mailscanner/Makefile
==============================================================================
--- head/mail/mailscanner/Makefile	Fri Feb 28 19:56:52 2014	(r346573)
+++ head/mail/mailscanner/Makefile	Fri Feb 28 20:04:59 2014	(r346574)
@@ -2,8 +2,8 @@
 # $FreeBSD$
 
 PORTNAME=	MailScanner
-PORTVERSION=	4.84.5
-PORTREVISION=	3
+PORTVERSION=	4.84.6
+#PORTREVISION=	0
 CATEGORIES=	mail
 MASTER_SITES=	http://www.mailscanner.info/files/4/tar/
 DISTNAME=	${PORTNAME}-install-${PORTVERSION}-${PATCHLEVEL}
@@ -38,9 +38,12 @@ RUN_DEPENDS:=	${BUILD_DEPENDS} \
 
 CONFLICTS=	MailScanner-devel-[0-9]*
 
-PATCHLEVEL=	2
+PATCHLEVEL=	1
 
-USES=		perl5
+USES=		perl5 shebangfix
+SHEBANG_FILES=	bin/[^c]* bin/clean* \
+		lib/[^M]* lib/${PORTNAME}/[^C]* lib/${PORTNAME}/*.p[ml] \
+		lib/${PORTNAME}.pm lib/${PORTNAME}/CustomFunctions/*
 
 WRKSRC=		${WRKDIR}/${PORTNAME}-install-${PORTVERSION}
 SUB_FILES=	MailScanner.8 pkg-message pkg-install pkg-deinstall
@@ -51,9 +54,6 @@ SUB_LIST=	DATADIR=${DATADIR} \
 		ETC_FILES="${ETC_FILES}" \
 		MCP_FILES="${MCP_FILES}"
 
-MAN8=		MailScanner.8
-MLINKS=		MailScanner.8 mailscanner.8
-
 OPTIONS_DEFINE=		SPAMASSASSIN CLAMAV CLAMAVMODULE BDC
 SPAMASSASSIN_DESC=	Install SpamAssassin
 CLAMAV_DESC=		Install ClamAV
@@ -62,7 +62,6 @@ BDC_DESC=		Install BitDefender
 
 OPTIONS_DEFAULT=	SPAMASSASSIN CLAMAV
 
-NO_STAGE=	yes
 .include <bsd.port.options.mk>
 
 .if ${PORT_OPTIONS:MSPAMASSASSIN}
@@ -202,16 +201,16 @@ do-build:
 
 do-install:
 	@${ECHO_MSG} -n ">> Installing files in ${PREFIX}/sbin..."
-	@${INSTALL_SCRIPT} ${WRKSRC}/bin/MailScanner ${PREFIX}/sbin/mailscanner
-	@${LN} -s ${PREFIX}/sbin/mailscanner ${PREFIX}/sbin/MailScanner
+	${INSTALL_SCRIPT} ${WRKSRC}/bin/MailScanner ${STAGEDIR}${PREFIX}/sbin/mailscanner
+	${LN} -sf ${PREFIX}/sbin/mailscanner ${STAGEDIR}${PREFIX}/sbin/MailScanner
 	@${ECHO_MSG} " [DONE]"
 	@${ECHO_MSG} -n \
 		">> Installing files in ${PREFIX}/libexec/MailScanner..."
-	@${MKDIR} -m ${BINMODE} ${PREFIX}/libexec/MailScanner
-	@cd ${WRKSRC}/lib && ${FIND} * -name "*-wrapper" -exec \
-		${INSTALL_SCRIPT} {} ${PREFIX}/libexec/MailScanner/{}.sample \;
-	@cd ${WRKSRC}/lib && ${FIND} * -name "*-autoupdate" -exec \
-		${INSTALL_SCRIPT} {} ${PREFIX}/libexec/MailScanner/{}.sample \;
+	${MKDIR} ${STAGEDIR}${PREFIX}/libexec/MailScanner
+	cd ${WRKSRC}/lib && ${FIND} * -name "*-wrapper" -exec \
+		${INSTALL_SCRIPT} {} ${STAGEDIR}${PREFIX}/libexec/MailScanner/{}.sample \;
+	cd ${WRKSRC}/lib && ${FIND} * -name "*-autoupdate" -exec \
+		${INSTALL_SCRIPT} {} ${STAGEDIR}${PREFIX}/libexec/MailScanner/{}.sample \;
 .for FILE in analyse_SpamAssassin_cache clean.SA.cache clean.quarantine \
 		mailscanner_create_locks processing_messages_alert Quick.Peek \
 		update_bad_phishing_emails update_phishing_sites \
@@ -219,74 +218,72 @@ do-install:
 		cron/update_bad_phishing_sites.cron update_virus_scanners \
 		cron/update_virus_scanners.cron update_spamassassin \
 		cron/update_spamassassin.cron
-	@${INSTALL_SCRIPT} ${WRKSRC}/bin/${FILE} \
-		${PREFIX}/libexec/MailScanner/
+	${INSTALL_SCRIPT} ${WRKSRC}/bin/${FILE} \
+		${STAGEDIR}${PREFIX}/libexec/MailScanner/
 .endfor
 	@${ECHO_MSG} " [DONE]"
 	@${ECHO_MSG} -n ">> Installing files in ${PREFIX}/etc/MailScanner..."
-	@${MKDIR} -m ${BINMODE} ${PREFIX}/etc/MailScanner
+	${MKDIR} ${STAGEDIR}${PREFIX}/etc/MailScanner
 .for FILE in ${ETC_FILES}
-	@${INSTALL_DATA} ${WRKSRC}/etc/${FILE} \
-		${PREFIX}/etc/MailScanner/${FILE}.sample
+	${INSTALL_DATA} ${WRKSRC}/etc/${FILE} \
+		${STAGEDIR}${PREFIX}/etc/MailScanner/${FILE}.sample
 .endfor
-	@${MKDIR} ${PREFIX}/etc/MailScanner/rules
-	@cd ${WRKSRC}/etc/rules \
+	${MKDIR} ${STAGEDIR}${PREFIX}/etc/MailScanner/rules
+	cd ${WRKSRC}/etc/rules \
 		&& ${INSTALL_DATA} EXAMPLES README \
-			${PREFIX}/etc/MailScanner/rules
+			${STAGEDIR}${PREFIX}/etc/MailScanner/rules
 .for RULES in spam.whitelist.rules bounce.rules max.message.size.rules
-	@${INSTALL_DATA} ${WRKSRC}/etc/rules/${RULES} \
-		${PREFIX}/etc/MailScanner/rules/${RULES}.sample
+	${INSTALL_DATA} ${WRKSRC}/etc/rules/${RULES} \
+		${STAGEDIR}${PREFIX}/etc/MailScanner/rules/${RULES}.sample
 .endfor
-	@${MKDIR} -m ${BINMODE} ${PREFIX}/etc/MailScanner/mcp
+	${MKDIR} ${STAGEDIR}${PREFIX}/etc/MailScanner/mcp
 .for FILE in ${MCP_FILES}
-	@${INSTALL_DATA} ${WRKSRC}/etc/mcp/${FILE} \
-		${PREFIX}/etc/MailScanner/mcp/${FILE}.sample
+	${INSTALL_DATA} ${WRKSRC}/etc/mcp/${FILE} \
+		${STAGEDIR}${PREFIX}/etc/MailScanner/mcp/${FILE}.sample
 .endfor
-	@${MKDIR} ${PREFIX}/etc/MailScanner/conf.d
-	@${INSTALL_DATA} ${WRKSRC}/etc/conf.d/README \
-		${PREFIX}/etc/MailScanner/conf.d/README
+	${MKDIR} ${STAGEDIR}${PREFIX}/etc/MailScanner/conf.d
+	${INSTALL_DATA} ${WRKSRC}/etc/conf.d/README \
+		${STAGEDIR}${PREFIX}/etc/MailScanner/conf.d/README
 	@${ECHO_MSG} " [DONE]"
 	@${ECHO_MSG} -n ">> Installing files in ${DATADIR}..."
-	@${MKDIR} ${DATADIR}
-	@cd ${WRKSRC}/etc && ${FIND} reports -type d ! -name "*.old" -exec \
-		${MKDIR} -m ${BINMODE} ${DATADIR}/{} \;
-	@cd ${WRKSRC}/etc \
+	${MKDIR} ${STAGEDIR}${DATADIR}
+	cd ${WRKSRC}/etc && ${FIND} reports -type d ! -name "*.old" -exec \
+		${MKDIR} ${STAGEDIR}${DATADIR}/{} \;
+	cd ${WRKSRC}/etc \
 	    && ${FIND} reports \( -type d -name "*.old" -prune \) \
 	    -o \( -type f ! \( -name "*.orig" -o -name "*.bak" \) \
-		-exec ${INSTALL_DATA} {} ${DATADIR}/{}.sample \; \)
-	@${INSTALL_SCRIPT} ${WRKSRC}/bin/upgrade_MailScanner_conf ${DATADIR}
-	@${LN} -s ${DATADIR}/upgrade_MailScanner_conf \
-		${DATADIR}/upgrade_languages_conf
+		-exec ${INSTALL_DATA} {} ${STAGEDIR}${DATADIR}/{}.sample \; \)
+	${INSTALL_SCRIPT} ${WRKSRC}/bin/upgrade_MailScanner_conf \
+		${STAGEDIR}${DATADIR}
+	${LN} -sf ${DATADIR}/upgrade_MailScanner_conf \
+		${STAGEDIR}${DATADIR}/upgrade_languages_conf
 	@${ECHO_MSG} " [DONE]"
 	@${ECHO_MSG} -n ">> Installing files in ${PREFIX}/lib..."
-	@${MKDIR} ${PREFIX}/lib/MailScanner/MailScanner/CustomFunctions
-	@${INSTALL_SCRIPT} ${WRKSRC}/lib/MailScanner.pm \
-		${PREFIX}/lib/MailScanner/MailScanner.pm
-	@cd ${WRKSRC}/lib/MailScanner \
+	${MKDIR} ${STAGEDIR}${PREFIX}/lib/MailScanner/MailScanner/CustomFunctions
+	${INSTALL_SCRIPT} ${WRKSRC}/lib/MailScanner.pm \
+		${STAGEDIR}${PREFIX}/lib/MailScanner/MailScanner.pm
+	cd ${WRKSRC}/lib/MailScanner \
 		&& ${FIND} * -type f ! -name "*.orig" -exec \
-		${INSTALL_SCRIPT} {} ${PREFIX}/lib/MailScanner/MailScanner/{} \;
+		${INSTALL_SCRIPT} {} ${STAGEDIR}${PREFIX}/lib/MailScanner/MailScanner/{} \;
 	@${ECHO_MSG} " [DONE]"
 .if ${PORT_OPTIONS:MDOCS}
 	@${ECHO_MSG} -n ">> Installing docs and manpage..."
-	@${MKDIR} ${DOCSDIR}
-	@${INSTALL_DATA} ${FILESDIR}/README.FreeBSD.port ${DOCSDIR}
-	@${INSTALL_SCRIPT} ${FILESDIR}/Sophos.install.freebsd ${DOCSDIR}
-	@cd ${WRKSRC} && ${INSTALL_DATA} ${DOC_FILES} ${DOCSDIR}
+	${MKDIR} ${STAGEDIR}${DOCSDIR}
+	${INSTALL_DATA} ${FILESDIR}/README.FreeBSD.port ${STAGEDIR}${DOCSDIR}
+	${INSTALL_SCRIPT} ${FILESDIR}/Sophos.install.freebsd ${STAGEDIR}${DOCSDIR}
+	cd ${WRKSRC} && ${INSTALL_DATA} ${DOC_FILES} ${STAGEDIR}${DOCSDIR}
 	@${REINPLACE_CMD} \
 		-e 's,%%LOCALBASE%%,${LOCALBASE},'	\
 		-e 's,%%PREFIX%%,${PREFIX},'		\
-		${DOCSDIR}/Sophos.install.freebsd
-	@${RM} -f ${DOCSDIR}/Sophos.install.freebsd.bak
+		${STAGEDIR}${DOCSDIR}/Sophos.install.freebsd
+	@${RM} -f ${STAGEDIR}${DOCSDIR}/Sophos.install.freebsd.bak
 .else
 	@${ECHO_MSG} -n ">> Installing manpage..."
 .endif
-	@cd ${WRKDIR} && \
-		${INSTALL_MAN} ${MAN8} ${MAN5PREFIX}/man/man8
+	cd ${WRKDIR} && \
+		${INSTALL_MAN} ${PORTNAME}.8 ${STAGEDIR}${PREFIX}/man/man8
+	${LN} -sf ${PREFIX}/man/man8/${PORTNAME}.8 \
+		${STAGEDIR}${PREFIX}/man/man8/${PORTNAME:L}.8
 	@${ECHO_MSG} " [DONE]"
 
-post-install:
-	@${SETENV} PKG_PREFIX=${PREFIX} \
-	    ${SH} ${PKGINSTALL} ${PKGNAME} POST-INSTALL
-	@${CAT} ${PKGMESSAGE}
-
 .include <bsd.port.mk>

Modified: head/mail/mailscanner/distinfo
==============================================================================
--- head/mail/mailscanner/distinfo	Fri Feb 28 19:56:52 2014	(r346573)
+++ head/mail/mailscanner/distinfo	Fri Feb 28 20:04:59 2014	(r346574)
@@ -1,2 +1,2 @@
-SHA256 (MailScanner-install-4.84.5-2.tar.gz) = 3467a53159cc95a8b4f93a326a59e2d3acc0ad6f90f048f048742fe13ac741f1
-SIZE (MailScanner-install-4.84.5-2.tar.gz) = 9510489
+SHA256 (MailScanner-install-4.84.6-1.tar.gz) = 566b6e2abf86de1acdff4f7fc5e6112aebab986954532a25f69b9f576ec70077
+SIZE (MailScanner-install-4.84.6-1.tar.gz) = 9524836

Modified: head/mail/mailscanner/files/CHANGES.port
==============================================================================
--- head/mail/mailscanner/files/CHANGES.port	Fri Feb 28 19:56:52 2014	(r346573)
+++ head/mail/mailscanner/files/CHANGES.port	Fri Feb 28 20:04:59 2014	(r346574)
@@ -1,3 +1,17 @@
+Version 4.84.6
+==============
+- Upgrade to 4.84.6
+- Added some patches for tmp file bugs
+  reported/provided by brad@comstyle.com
+  from the OpenBSD port and GitHub repository.
+
+Version 4.84.6
+==============
+- Upgrade to 4.84.6
+- Added some patches for tmp file bugs
+  reported/provided by brad@comstyle.com
+  from the OpenBSD port and GitHub repository.
+
 Version 4.84.5_3 (not bumped)
 ================
 - Use OptionsNG

Added: head/mail/mailscanner/files/patch-lib__MailScanner__CustomFunctions__LastSpam.pm
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/mail/mailscanner/files/patch-lib__MailScanner__CustomFunctions__LastSpam.pm	Fri Feb 28 20:04:59 2014	(r346574)
@@ -0,0 +1,20 @@
+--- ./lib/MailScanner/CustomFunctions/LastSpam.pm.orig	2011-08-20 08:24:49.000000000 -0400
++++ ./lib/MailScanner/CustomFunctions/LastSpam.pm	2014-02-21 04:11:09.000000000 -0500
+@@ -32,7 +32,6 @@
+ my $Debug = 0; # Set to 1 to enable debug output to STDERR
+ #my $tmpfilename = "/tmp/MailScanner.LastSpam.$$.conf"; # Temp MS.conf file
+ # Temp MS.conf file
+-my($tmpfh, $tmpfilename) = tempfile("MailScanner.LastSpam.XXXXXX", TMPDIR => 1, UNLINK => 0);
+ my %modtime = (); # Time domain list magic word file was last changed
+ my %filename = (); # Map Config option to magic word file
+ my %magicwords = {}; # Map Config option --> domains --> magic words
+@@ -550,8 +549,7 @@
+ sub SetupRuleset {
+   my($opkeyword) = @_;
+ 
+-  my $fh = new FileHandle;
+-  $fh->open("> $tmpfilename") or die "$!";
++  my($fh, $tmpfilename) = tempfile("MailScanner.LastSpam.XXXXXX", TMPDIR => 1, UNLINK => 0);
+   my $rf = $rulesetfilename{$opkeyword};
+   #print STDERR "RF = $rf\n";
+   #print STDERR $opkeyword . " = $rf\n";

Added: head/mail/mailscanner/files/patch-lib__MailScanner__CustomFunctions__Ruleset-from-Function.pm
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/mail/mailscanner/files/patch-lib__MailScanner__CustomFunctions__Ruleset-from-Function.pm	Fri Feb 28 20:04:59 2014	(r346574)
@@ -0,0 +1,20 @@
+--- ./lib/MailScanner/CustomFunctions/Ruleset-from-Function.pm.orig	2011-08-20 08:25:42.000000000 -0400
++++ ./lib/MailScanner/CustomFunctions/Ruleset-from-Function.pm	2014-02-21 04:16:55.000000000 -0500
+@@ -31,7 +31,6 @@
+ 
+ my $Debug = 0; # Set to 1 to enable debug output to STDERR
+ #my $tmpfilename = "/tmp/MailScanner.$$.conf"; # Temp MS.conf file
+-my($tmpfh, $tmpfilename) = tempfile("MailScanner.XXXXXX", TMPDIR => 1, UNLINK => 0);
+ 
+ 
+ 
+@@ -60,8 +59,7 @@
+   my $option = 'virusscanning'; # External (MailScanner.conf-version)
+ 
+   # Make the temporary 1-line MailScanner.conf file, use it and delete it
+-  my $fh = new FileHandle;
+-  $fh->open("> $tmpfilename") or die "$!";
++  my($fh, $tmpfilename) = tempfile("MailScanner.XXXXXX", TMPDIR => 1, UNLINK => 0);
+   print $fh $option . " = $ruleset\n";
+   $fh->close;
+ 

Modified: head/mail/mailscanner/files/patch-lib__MailScanner__TNEF.pm
==============================================================================
--- head/mail/mailscanner/files/patch-lib__MailScanner__TNEF.pm	Fri Feb 28 19:56:52 2014	(r346573)
+++ head/mail/mailscanner/files/patch-lib__MailScanner__TNEF.pm	Fri Feb 28 20:04:59 2014	(r346574)
@@ -1,20 +1,110 @@
---- ./lib/MailScanner/TNEF.pm.orig	2011-08-20 08:32:02.000000000 -0400
-+++ ./lib/MailScanner/TNEF.pm	2012-03-15 11:28:31.000000000 -0400
-@@ -229,15 +229,14 @@
+--- ./lib/MailScanner/TNEF.pm.orig	2013-06-17 09:29:16.000000000 -0400
++++ ./lib/MailScanner/TNEF.pm	2014-02-21 04:03:15.000000000 -0500
+@@ -229,18 +229,25 @@
  
    # Create the subdir to unpack it into
    #my $unpackdir = "tnef.$$";
 -  my ($tmpfh, $unpackdir) = tempfile("tnefXXXXXX", TMPDIR => $dir, UNLINK => 0);
--  $dir =~ s,^.*/,,;
-+  my $unpackdir = tempdir("tnefXXXXXX");
-   $unpackdir = $message->MakeNameSafe($unpackdir, $dir);
-   unless (mkdir "$dir/$unpackdir", 0777) {
+-  # This line shouldn't be here any more! $dir =~ s,^.*/,,;
+-  $unpackdir = $message->MakeNameSafe($unpackdir, $dir);
+-  unless (mkdir "$dir/$unpackdir", 0777) {
++  my $unpackdir = tempdir("tnefXXXXXX", DIR => $dir);
++  unless (-d $unpackdir) {
      MailScanner::Log::WarnLog("Trying to unpack %s in message %s, could not create subdirectory %s, failed to unpack TNEF message", $tnefname, $message->{id},
-                               "$dir/$unpackdir");
+-                              "$dir/$unpackdir");
++                              "$unpackdir");
      return 0;
    }
 -  chmod 0700, "$dir/$unpackdir";
-+  chmod 0770, "$dir/$unpackdir";
++  # Convert Incoming Work Permissions to an octal value and add search.
++  my $perms = oct(sprintf("%s", MailScanner::Config::Value('workperms')))
++    | 0111;
++  chmod $perms, $unpackdir;
++  # Try to set Incoming Work User and Group.
++  my $uname = MailScanner::Config::Value('workuser');
++  my $gname = MailScanner::Config::Value('workgroup');
++  my $uid = $uname?getpwnam($uname):-1;
++  my $gid = $gname?getgrnam($gname):-1;
++  chown $uid, $gid, $unpackdir;
  
    my $cmd = MailScanner::Config::Value('tnefexpander') .
-             " -f $dir/$tnefname -C $dir/$unpackdir --overwrite";
+-            " -f $dir/$tnefname -C $dir/$unpackdir --overwrite";
++            " -f $dir/$tnefname -C $unpackdir --overwrite";
+ 
+   my($kid);
+   my($TimedOut, $PipeReturn, $pid);
+@@ -311,15 +318,15 @@
+ 
+     unless (MailScanner::Config::Value('replacetnef',$message) =~ /[12]/) {
+       # Just need to move all the unpacked files into the main attachments dir
+-      my $dirh = new DirHandle "$dir/$unpackdir";
++      my $dirh = new DirHandle "$$unpackdir";
+       return 0 unless defined $dirh;
+       while (defined(my $unpacked = $dirh->read)) {
+-        next unless -f "$dir/$unpackdir/$unpacked";
++        next unless -f "$$unpackdir/$unpacked";
+         # Add a 't' to the safename to mark it as a tnef member.
+         my $safe = $message->MakeNameSafe('t'.$unpacked, $dir);
+         # This will cause big problems as $safe has a type, and shouldn't!
+         $message->{file2parent}{$safe} = $tnefname;
+-        my $name1 = "$dir/$unpackdir/$unpacked";
++        my $name1 = "$unpackdir/$unpacked";
+         $name1 =~ /(.*)/;
+         $name1 = $1;
+         my $name2 = "$dir/$safe";
+@@ -333,19 +340,21 @@
+         $safe =~ s#^(.*/)([^/])([^/]+)$#$1$3#; # I assert $2 will equal 't'.
+         $message->{file2parent}{$safe} = $tnefname;
+       }
+-      rmdir "$dir/$unpackdir"; # Directory should be empty now
++      # The following may result in a warning from a virus scanner that
++      # tries to lstat the directory, but it was empty so it can be ignored.
++      rmdir "$$unpackdir"; # Directory should be empty now
+       return 1;
+     }
+     #print STDERR "In TNEF External Decoder\n";
+ 
+-    my $dirh = new DirHandle "$dir/$unpackdir";
++    my $dirh = new DirHandle "$unpackdir";
+     return 0 unless defined $dirh;
+     my($type, $encoding);
+     $message->{entity}->make_multipart;
+     my($safename, @replacements, $unpacked);
+     while (defined($unpacked = $dirh->read)) {
+-      #print STDERR "Directory entry is \"$unpacked\" in \"$dir/$unpackdir\"\n";
+-      next unless -f "$dir/$unpackdir/$unpacked";
++      #print STDERR "Directory entry is \"$unpacked\" in \"$unpackdir\"\n";
++      next unless -f "$unpackdir/$unpacked";
+       # Add a 't' to the safename to mark it as a tnef member.
+       $safename = $message->MakeNameSafe('t'.$unpacked, $dir);
+       if (/^msg[\d-]+\.txt$/) {
+@@ -353,15 +362,15 @@
+       } else {
+         ($type, $encoding) = ("application/octet-stream", "base64");
+       }
+-      #print STDERR "Renaming '$dir/$unpackdir/$unpacked' to '$dir/$safename'\n";
+-      my $oldname = "$dir/$unpackdir/$unpacked";
++      #print STDERR "Renaming '$unpackdir/$unpacked' to '$dir/$safename'\n";
++      my $oldname = "$unpackdir/$unpacked";
+       my $newname = "$dir/$safename";
+       $oldname =~ /^(.*)$/;
+       $oldname = $1;
+       $newname =~ /^(.*)$/;
+       $newname = $1;
+       rename $oldname, $newname;
+-      #rename "$dir/$unpackdir/$unpacked", "$dir/$safename";
++      #rename "$unpackdir/$unpacked", "$dir/$safename";
+       # JKF 20090421 CHMOD, then CHOWN and CHGRP it if necessary.
+       chmod $perms, $newname;
+       #chmod $perms, "$dir/$safename";
+@@ -381,7 +390,9 @@
+     $message->{bodymodified} = 1;
+     $message->{foundtnefattachments} = 1;
+     undef $dirh;
+-    rmdir "$dir/$unpackdir"; # Directory should be empty now
++    # The following may result in a warning from a virus scanner that
++    # tries to lstat the directory, but it was empty so it can be ignored.
++    rmdir "$unpackdir"; # Directory should be empty now
+     #$message->{entity}->dump_skeleton();
+ 
+     MailScanner::Log::InfoLog("Message %s added TNEF contents %s",

Modified: head/mail/mailscanner/pkg-plist
==============================================================================
--- head/mail/mailscanner/pkg-plist	Fri Feb 28 19:56:52 2014	(r346573)
+++ head/mail/mailscanner/pkg-plist	Fri Feb 28 20:04:59 2014	(r346574)
@@ -134,6 +134,8 @@ libexec/MailScanner/vba32-autoupdate.sam
 libexec/MailScanner/vba32-wrapper.sample
 libexec/MailScanner/vexira-autoupdate.sample
 libexec/MailScanner/vexira-wrapper.sample
+man/man8/MailScanner.8.gz
+man/man8/mailscanner.8.gz
 sbin/mailscanner
 sbin/MailScanner
 %%DATADIR%%/reports/ca/rejection.report.txt.sample
_______________________________________________
svn-ports-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-ports-all
To unsubscribe, send any mail to "svn-ports-all-unsubscribe@freebsd.org"
Comment 6 Chris Rees freebsd_committer 2014-02-28 20:06:48 UTC
State Changed
From-To: feedback->closed

Committed. Thanks!