[PATCH] Please decide, p5-MIME-Tools

Martin Blapp mb at imp.ch
Fri Sep 17 03:02:13 PDT 2004


Hi Portsmgr,

I ask for permission to fix this port so it users installing 5.3 can
actually use it with perl < 5.6.1. If we don't do anything a lot
of users will complain !

http://www.freebsd.org/cgi/query-pr.cgi?pr=ports/71525
http://www.freebsd.org/cgi/query-pr.cgi?pr=ports/71593

Either we update the port to p5-MIME-Tools 5.413:

http://www.freebsd.org/cgi/query-pr.cgi?pr=ports/71810

or we apply those two patches here:

http://www.freebsd.org/cgi/query-pr.cgi?pr=ports/71360 (Fix package List)

and replace the patch p5-MIME-Tools/files/patch-Filer.pm-whitespace

with (This is the Filer.pm which is in p5-MIME-Tools 5.413) This
fixes ports/71525 and ports/71593.

--- lib/MIME/Parser/Filer.pm    Thu Nov 23 06:04:03 2000
+++ lib/MIME/Parser/Filer.pm    Thu Aug 26 00:42:18 2004
@@ -328,7 +328,9 @@

     * it is empty
     * it is a string of dots: ".", "..", etc.
-    * it contains a known "path" character: '/' '\' ':' '[' ']'
+    * it contains characters not in the set: "A" - "Z", "a" - "z",
+      "0" - "9", "-", "_", "+", "=", ".", ",", "@", "#",
+      "$", and " ".
     * it is too long

 If you just want to change this behavior, you should override
@@ -357,11 +359,11 @@
     $self->debug("is this evil? '$name'");

     return 1 if (!defined($name) or ($name eq ''));   ### empty
+    return 1 if ($name =~ m{(^\s)|(\s+\Z)});  ### leading/trailing whitespace
     return 1 if ($name =~ m{^\.+\Z});         ### dots
-    return 1 if ($name =~ tr{\\/:[]}{});      ### path characters
+    return 1 if ($name =~ /[^-A-Z0-9_+=.,@\#\$\% ]/i); # Only allow good chars
     return 1 if ($self->{MPF_MaxName} and
                 (length($name) > $self->{MPF_MaxName}));
-
     $self->debug("it's ok");
     0;
 }
@@ -402,6 +404,9 @@
     my ($root, $ext) = (($last =~ /^(.*)\.([^\.]+)\Z/)
                        ? ($1, $2)
                        : ($last, ''));
+    ### Delete leading and trailing whitespace
+    $root =~ s/^\s+//;
+    $ext  =~ s/\s+$//;
     $root = substr($root, 0, ($self->{MPF_TrimRoot} || 14));
     $ext  = substr($ext,  0, ($self->{MPF_TrimExt}  ||  3));
     $ext =~ /^\w+$/ or $ext = "dat";
@@ -411,6 +416,13 @@
        return $trunc;
     }

+    ### Remove all bad characters
+    $trunc =~ s/([^-A-Z0-9_+=.,@\#\$ ])/sprintf("%%%02X", unpack("C", $1))/ige;
+    if (!$self->evil_filename($trunc)) {
+       $self->debug("looks like I can use a munged version of the truncated
last path element");
+       return $trunc;
+    }
+
     ### Hope that works:
     undef;
 }
@@ -918,5 +930,5 @@

 =head1 VERSION

-$Revision: 5.406 $
+$Revision: 1.5 $

Martin

Martin Blapp, <mb at imp.ch> <mbr at FreeBSD.org>
------------------------------------------------------------------
ImproWare AG, UNIXSP & ISP, Zurlindenstrasse 29, 4133 Pratteln, CH
Phone: +41 61 826 93 00 Fax: +41 61 826 93 01
PGP: <finger -l mbr at freebsd.org>
PGP Fingerprint: B434 53FC C87C FE7B 0A18 B84C 8686 EF22 D300 551E
------------------------------------------------------------------
-------------- next part --------------
--- lib/MIME/Parser/Filer.pm	Thu Nov 23 06:04:03 2000
+++ lib/MIME/Parser/Filer.pm	Thu Aug 26 00:42:18 2004
@@ -328,7 +328,9 @@
 
     * it is empty
     * it is a string of dots: ".", "..", etc.
-    * it contains a known "path" character: '/' '\' ':' '[' ']'
+    * it contains characters not in the set: "A" - "Z", "a" - "z",
+      "0" - "9", "-", "_", "+", "=", ".", ",", "@", "#",
+      "$", and " ".
     * it is too long
 
 If you just want to change this behavior, you should override 
@@ -357,11 +359,11 @@
     $self->debug("is this evil? '$name'");
 
     return 1 if (!defined($name) or ($name eq ''));   ### empty
+    return 1 if ($name =~ m{(^\s)|(\s+\Z)});  ### leading/trailing whitespace
     return 1 if ($name =~ m{^\.+\Z});         ### dots
-    return 1 if ($name =~ tr{\\/:[]}{});      ### path characters
+    return 1 if ($name =~ /[^-A-Z0-9_+=.,@\#\$\% ]/i); # Only allow good chars
     return 1 if ($self->{MPF_MaxName} and 
 		 (length($name) > $self->{MPF_MaxName}));
-    
     $self->debug("it's ok");
     0;
 }
@@ -402,6 +404,9 @@
     my ($root, $ext) = (($last =~ /^(.*)\.([^\.]+)\Z/) 
 			? ($1, $2)
 			: ($last, ''));
+    ### Delete leading and trailing whitespace
+    $root =~ s/^\s+//;
+    $ext  =~ s/\s+$//;
     $root = substr($root, 0, ($self->{MPF_TrimRoot} || 14));
     $ext  = substr($ext,  0, ($self->{MPF_TrimExt}  ||  3));
     $ext =~ /^\w+$/ or $ext = "dat";
@@ -411,6 +416,13 @@
 	return $trunc;
     }
         
+    ### Remove all bad characters
+    $trunc =~ s/([^-A-Z0-9_+=.,@\#\$ ])/sprintf("%%%02X", unpack("C", $1))/ige;
+    if (!$self->evil_filename($trunc)) {
+	$self->debug("looks like I can use a munged version of the truncated last path element");
+	return $trunc;
+    }
+
     ### Hope that works:
     undef;
 }
@@ -918,5 +930,5 @@
 
 =head1 VERSION
 
-$Revision: 5.406 $
+$Revision: 1.5 $
 


More information about the freebsd-ports mailing list