aboutsummaryrefslogtreecommitdiffstats
path: root/mail
diff options
context:
space:
mode:
authormiwi <miwi@FreeBSD.org>2007-06-05 04:52:13 +0800
committermiwi <miwi@FreeBSD.org>2007-06-05 04:52:13 +0800
commit2ea2886bf527f8e90b1996e9f1843cc357380ce4 (patch)
tree37c963a61b713a21433e7d8438fef3cad1216e32 /mail
parentd3267f03074f6488d3cb4c5b58d160fc2e494d21 (diff)
downloadfreebsd-ports-gnome-2ea2886bf527f8e90b1996e9f1843cc357380ce4.tar.gz
freebsd-ports-gnome-2ea2886bf527f8e90b1996e9f1843cc357380ce4.tar.zst
freebsd-ports-gnome-2ea2886bf527f8e90b1996e9f1843cc357380ce4.zip
- Fixed error in auto-zip: If a message contained 2 different attachments
with exactly the same filename, the auto-zip feature would fail and MailScanner would die. Submitted by: Jan-Peter Koopmann via irc (maintainer)
Diffstat (limited to 'mail')
-rw-r--r--mail/mailscanner/Makefile1
-rw-r--r--mail/mailscanner/files/CHANGES.port6
-rw-r--r--mail/mailscanner/files/patch-lib-MailScanner-Message.pm148
3 files changed, 155 insertions, 0 deletions
diff --git a/mail/mailscanner/Makefile b/mail/mailscanner/Makefile
index 5ca8fb08ad1e..14e94f0c6217 100644
--- a/mail/mailscanner/Makefile
+++ b/mail/mailscanner/Makefile
@@ -7,6 +7,7 @@
PORTNAME= MailScanner
PORTVERSION= 4.60.8
+PORTREVISION= 2
CATEGORIES= mail
MASTER_SITES= http://www.mailscanner.info/files/4/tar/
DISTNAME= ${PORTNAME}-install-${PORTVERSION}-${PATCHLEVEL}
diff --git a/mail/mailscanner/files/CHANGES.port b/mail/mailscanner/files/CHANGES.port
index 1ef976f29576..7143079bb32d 100644
--- a/mail/mailscanner/files/CHANGES.port
+++ b/mail/mailscanner/files/CHANGES.port
@@ -1,3 +1,9 @@
+Version 4.60.8_2
+================
+- Fixed error in auto-zip: If a message contained 2 different attachments
+ with exactly the same filename, the auto-zip feature would fail and
+ MailScanner would die.
+
Version 4.60.8
==============
- update to 4.60.8
diff --git a/mail/mailscanner/files/patch-lib-MailScanner-Message.pm b/mail/mailscanner/files/patch-lib-MailScanner-Message.pm
new file mode 100644
index 000000000000..f3926a2be514
--- /dev/null
+++ b/mail/mailscanner/files/patch-lib-MailScanner-Message.pm
@@ -0,0 +1,148 @@
+--- ../MailScanner-install-4.60.8.orig/lib/MailScanner/Message.pm Mon Jun 4 21:52:14 2007
++++ lib/MailScanner/Message.pm Mon Jun 4 21:52:31 2007
+@@ -2,7 +2,7 @@
+ # MailScanner - SMTP E-Mail Virus Scanner
+ # Copyright (C) 2002 Julian Field
+ #
+-# $Id: Message.pm 3920 2007-05-28 17:20:11Z sysjkf $
++# $Id: Message.pm 3948 2007-06-04 18:25:09Z sysjkf $
+ #
+ # This program is free software; you can redistribute it and/or modify
+ # it under the terms of the GNU General Public License as published by
+@@ -57,7 +57,7 @@
+ use vars qw($VERSION);
+
+ ### The package version, both in 1.23 style *and* usable by MakeMaker:
+-$VERSION = substr q$Revision: 3920 $, 10;
++$VERSION = substr q$Revision: 3948 $, 10;
+
+ # Attributes are
+ #
+@@ -126,6 +126,7 @@
+ # %alltypes set by CombineReports
+ # %entity2parent set by CreateEntitiesHelpers
+ # %entity2file set by CreateEntitiesHelpers
++# %entity2safefile set by CreateEntitiesHelpers
+ # %file2entity set by CreateEntitiesHelpers (maps original evil names)
+ # %file2safefile set by CreateEntitiesHelpers (evil==>safe)
+ # %safefile2file set by CreateEntitiesHelpers (safe==>evil)
+@@ -1528,14 +1529,17 @@
+ $regexp = join('|', @escaped);
+ print STDERR "Regexp is \"$regexp\"\n";
+
+- # Build a list of attachment filenames
+- my($file,@files,$entity);
++ # Build a list of attachment entities
++ my($file,@files,$entity,@entitylist);
++ $this->ListLeafEntities($this->{entity}, \@entitylist);
++
+ my $totalsize = 0; # Track total size of all attachments added to zip
+- while (defined($file = $dir->read)) {
+- next if $file =~ /^\.+$/;
++ foreach $entity (@entitylist) {
++ $file = $this->{entity2safefile}{$entity};
+ next unless -f "$explodeinto/$file";
+ print STDERR "Possibly adding file $file\n";
+- $entity = $this->{file2entity}{$this->{safefile2file}{$file}};
++ print STDERR "Nasty filename is " . $this->{entity2file}{$entity} . "\n";
++ #$entity = $this->{file2entity}{$this->{safefile2file}{$file}};
+ print STDERR "Entity is $entity\n";
+ next unless $entity;
+ # Don't add the file if it's the winmail.dat file
+@@ -1589,6 +1593,7 @@
+
+ # Create all the Helpers for the new attachment
+ $this->{entity2file}{$newentity} = $newzipname;
++ $this->{entity2safefile}{$newentity} = $safezipname;
+ $this->{entity2parent}{$newentity} = 0;
+ $this->{file2entity}{$newzipname} = $newentity;
+ $this->{name2entity}{scalar($newentity)} = $newentity;
+@@ -1597,12 +1602,12 @@
+
+ # Delete the old attachments' entities
+ my($attachfile, $attachentity);
+- foreach $file (@files) {
+- $attachfile = $this->{safefile2file}{$file};
+- $attachentity = $this->{file2entity}{$attachfile};
+- $this->DeleteEntity($entity, $attachentity);
++ foreach $entity (@entitylist) {
++ $attachfile = $this->{entity2safefile}{$entity};
++ #$attachentity = $this->{file2entity}{$attachfile};
++ $this->DeleteEntity($this->{entity}, $entity);
+ # And the files themselves
+- unlink("$explodeinto/$file");
++ unlink("$explodeinto/$attachfile");
+ }
+
+ }
+@@ -1890,6 +1895,27 @@
+ if $workarea->{changeowner};
+ }
+
++sub ListLeafEntities {
++ my($message, $entity, $entitylist) = @_;
++
++ my(@parts, $part);
++
++ # Fallen off the tree?
++ return unless $entity && defined($entity->head);
++
++ # Found a leaf node
++ if ($entity && !$entity->parts) {
++ push @$entitylist, $entity;
++ return;
++ }
++
++ # Walk down each sub-tree
++ @parts = $entity->parts;
++ foreach $part (@parts) {
++ ListLeafEntities($message, $part, $entitylist);
++ }
++}
++
+ # Delete a given entity from the MIME entity tree.
+ # Have to walk the entire tree to do this.
+ # Bail out as soon as we've found it.
+@@ -2860,6 +2886,7 @@
+
+ # Put something useless in the 2 hashes so that they exist.
+ $this->{entity2file}{""} = 0;
++ $this->{entity2safefile}{""} = 0;
+ $this->{entity2parent}{""} = 0;
+ $this->{file2entity}{""} = $this->{entity}; # Root of this message
+ $this->{name2entity}{""} = 0;
+@@ -2870,6 +2897,7 @@
+ $this->{file2safefile},
+ $this->{safefile2file},
+ $this->{entity2file},
++ $this->{entity2safefile},
+ $this->{name2entity});
+ #print STDERR "In CreateEntitiesHelpers, this = $this\n";
+ #print STDERR "In CreateEntitiesHelpers, this entity = " .
+@@ -2903,7 +2931,7 @@
+ # This is recursive. This is a class function, not a normal method.
+ sub BuildFile2EntityAndEntity2File {
+ my($entity, $file2entity, $file2safefile, $safefile2file, $entity2file,
+- $name2entity) = @_;
++ $entity2safefile, $name2entity) = @_;
+
+ # Build the conversion hash from scalar(entity) --> real entity object
+ # Need to do this as objects cannot be hash keys.
+@@ -2929,6 +2957,7 @@
+ if ($headfile) {
+ $file2entity->{$headfile} = $entity if !$file2entity->{$headfile};
+ $file2safefile->{$headfile} = $path;
++ $entity2safefile->{$entity} = $path;
+ $safefile2file->{$path} = $headfile;
+ #print STDERR "File2SafeFile (\"$headfile\") = \"$path\"\n";
+ }
+@@ -2937,7 +2966,8 @@
+ @parts = $entity->parts;
+ foreach $part (@parts) {
+ BuildFile2EntityAndEntity2File($part, $file2entity, $file2safefile,
+- $safefile2file, $entity2file, $name2entity);
++ $safefile2file, $entity2file,
++ $entity2safefile, $name2entity);
+ }
+ }
+