aboutsummaryrefslogtreecommitdiffstats
path: root/mail
diff options
context:
space:
mode:
authorkuriyama <kuriyama@FreeBSD.org>2002-06-06 09:52:19 +0800
committerkuriyama <kuriyama@FreeBSD.org>2002-06-06 09:52:19 +0800
commit781cea86e122e2e7f59f605833a2ef3cb630997d (patch)
tree1b5eb02b6321a5c12f3bacf1deec45edfc8f8ca5 /mail
parentf4e7ebc36d69b8dbe64364fa835d8023797ca428 (diff)
downloadfreebsd-ports-gnome-781cea86e122e2e7f59f605833a2ef3cb630997d.tar.gz
freebsd-ports-gnome-781cea86e122e2e7f59f605833a2ef3cb630997d.tar.zst
freebsd-ports-gnome-781cea86e122e2e7f59f605833a2ef3cb630997d.zip
Apply a patch to fix some problems reported on bugtraq.
White space nits in original patch are ignored. References: http://online.securityfocus.com/archive/1/275282/2002-06-01/2002-06-07/0 Obtained from: http://www.roaringpenguin.com/mimedefang/mime-tools-patch.txt Reported by: "Mike Jakubik" <mikej@trigger.net>
Diffstat (limited to 'mail')
-rw-r--r--mail/p5-MIME-Tools/Makefile1
-rw-r--r--mail/p5-MIME-Tools/files/patch-ParamVal.pm114
-rw-r--r--mail/p5-MIME-Tools/files/patch-Words.pm11
3 files changed, 126 insertions, 0 deletions
diff --git a/mail/p5-MIME-Tools/Makefile b/mail/p5-MIME-Tools/Makefile
index 935bbe3ee519..ea373790a0d8 100644
--- a/mail/p5-MIME-Tools/Makefile
+++ b/mail/p5-MIME-Tools/Makefile
@@ -7,6 +7,7 @@
PORTNAME= p5-MIME-Tools
PORTVERSION= 5.411a
+PORTREVISION= 1
CATEGORIES= mail perl5
MASTER_SITES= ${MASTER_SITE_PERL_CPAN}
MASTER_SITE_SUBDIR= MIME
diff --git a/mail/p5-MIME-Tools/files/patch-ParamVal.pm b/mail/p5-MIME-Tools/files/patch-ParamVal.pm
new file mode 100644
index 000000000000..afc85edda148
--- /dev/null
+++ b/mail/p5-MIME-Tools/files/patch-ParamVal.pm
@@ -0,0 +1,114 @@
+--- lib/MIME/Field/ParamVal.pm.orig Sun Nov 5 04:54:49 2000
++++ lib/MIME/Field/ParamVal.pm Thu Jun 6 10:15:15 2002
+@@ -100,6 +100,9 @@
+ # token = 1*<any (ASCII) CHAR except SPACE, CTLs, or tspecials>
+ #
+ my $TSPECIAL = '()<>@,;:\</[]?="';
++
++#" Fix emacs highlighting...
++
+ my $TOKEN = '[^ \x00-\x1f\x80-\xff' . "\Q$TSPECIAL\E" . ']+';
+
+ # Encoded token:
+@@ -108,6 +111,9 @@
+ # Pattern to match spaces or comments:
+ my $SPCZ = '(?:\s|\([^\)]*\))*';
+
++# Pattern to match non-semicolon as fallback for broken MIME
++# produced by some viruses
++my $BADTOKEN = '[^;]+';
+
+ #------------------------------
+ #
+@@ -181,10 +187,40 @@
+
+ =cut
+
++sub rfc2231decode {
++ my($val) = @_;
++ my($enc, $lang, $rest);
++
++ if ($val =~ m/^([^\']*)\'([^\']*)\'(.*)$/) {
++ # SHOULD REALLY DO SOMETHING MORE INTELLIGENT WITH ENCODING!!!
++ $enc = $1;
++ $lang = $2;
++ $rest = $3;
++ $rest = rfc2231percent($rest);
++ } elsif ($val =~ m/^([^\']*)\'([^\']*)$/) {
++ $enc = $1;
++ $rest = $2;
++ $rest = rfc2231percent($rest);
++ } else {
++ $rest = rfc2231percent($val);
++ }
++ return $rest;
++}
++
++sub rfc2231percent {
++ # Do percent-subsitution
++ my($str) = @_;
++ $str =~ s/%([0-9a-fA-F]{2})/pack("c", hex($1))/ge;
++ return $str;
++}
++
+ sub parse_params {
+ my ($self, $raw) = @_;
+ my %params = ();
++ my %rfc2231params = ();
+ my $param;
++ my $val;
++ my $part;
+
+ # Get raw field, and unfold it:
+ defined($raw) or $raw = '';
+@@ -200,9 +236,47 @@
+ $raw =~ m/\G$SPCZ\;$SPCZ/og or last; # skip leading separator
+ $raw =~ m/\G($PARAMNAME)\s*=\s*/og or last; # give up if not a param
+ $param = lc($1);
+- $raw =~ m/\G(\"([^\"]+)\")|\G($TOKEN)|\G($ENCTOKEN)/g or last; # give up if no value
+- my ($qstr, $str, $token, $enctoken) = ($1, $2, $3, $4);
+- $params{$param} = defined($qstr) ? $str : (defined($token) ? $token : $enctoken);
++ $raw =~ m/\G(\"([^\"]+)\")|\G($ENCTOKEN)|\G($BADTOKEN)|\G($TOKEN)/g or last; # give up if no value"
++ my ($qstr, $str, $enctoken, $badtoken, $token) = ($1, $2, $3, $4, $5);
++ if (defined($badtoken)) {
++ # Strip leading/trailing whitespace from badtoken
++ $badtoken =~ s/^\s*//;
++ $badtoken =~ s/\s*$//;
++ }
++ $val = defined($qstr) ? $str :
++ (defined($enctoken) ? $enctoken :
++ (defined($badtoken) ? $badtoken : $token));
++
++ # Do RFC 2231 processing
++ if ($param =~ /\*/) {
++ my($name, $num);
++ # Pick out the parts of the parameter
++ if ($param =~ m/^([^*]+)\*([^*]+)\*?$/) {
++ # We have param*number* or param*number
++ $name = $1;
++ $num = $2;
++ } else {
++ # Fake a part of zero... not sure how to handle this properly
++ $param =~ s/\*//g;
++ $name = $param;
++ $num = 0;
++ }
++ # Decode the value unless it was a quoted string
++ if (!defined($qstr)) {
++ $val = rfc2231decode($val);
++ }
++ $rfc2231params{$name}{$num} .= $val;
++ } else {
++ # Make a fake "part zero" for non-RFC2231 params
++ $rfc2231params{$param}{"0"} = $val;
++ }
++ }
++
++ # Extract reconstructed parameters
++ foreach $param (keys %rfc2231params) {
++ foreach $part (sort { $a <=> $b } keys %{$rfc2231params{$param}}) {
++ $params{$param} .= $rfc2231params{$param}{$part};
++ }
+ debug " field param <$param> = <$params{$param}>";
+ }
+
diff --git a/mail/p5-MIME-Tools/files/patch-Words.pm b/mail/p5-MIME-Tools/files/patch-Words.pm
new file mode 100644
index 000000000000..d1fb41ea9759
--- /dev/null
+++ b/mail/p5-MIME-Tools/files/patch-Words.pm
@@ -0,0 +1,11 @@
+--- lib/MIME/Words.pm.orig Sat Nov 11 01:45:12 2000
++++ lib/MIME/Words.pm Thu Jun 6 10:15:15 2002
+@@ -186,7 +186,7 @@
+ $@ = ''; ### error-return
+
+ ### Collapse boundaries between adjacent encoded words:
+- $encstr =~ s{(\?\=)\r?\n[ \t](\=\?)}{$1$2}gs;
++ $encstr =~ s{(\?\=)\s*(\=\?)}{$1$2}gs;
+ pos($encstr) = 0;
+ ### print STDOUT "ENC = [", $encstr, "]\n";
+