From fa59d87d4825cc16e7d38d2f4e8b71cd057ee85f Mon Sep 17 00:00:00 2001 From: Gerfried Fuchs Date: Wed, 17 Feb 2010 20:53:36 +0100 Subject: [PATCH] Imported Upstream version 2.7.1 --- ChangeLog | 34 ++++++ NEWS | 25 +++++ contrib/README.patches | 15 ++- contrib/t-prot-r1.261-gol.diff | 187 +++++++++++++++++++++++++++++++++ t-prot | 22 ++-- t-prot.1 | 8 +- 6 files changed, 275 insertions(+), 16 deletions(-) create mode 100644 NEWS create mode 100644 contrib/t-prot-r1.261-gol.diff diff --git a/ChangeLog b/ChangeLog index 70a1414..0efeca9 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,37 @@ +2009-08-24 20:32 Jochen Striepe + + * t-prot: Release as t-prot v2.7. + +2009-08-24 17:20 Jochen Striepe + + * t-prot: Cosmetics. + +2009-08-24 17:17 Jochen Striepe + + * t-prot: Cosmetics. + +2009-08-24 12:15 Jochen Striepe + + * t-prot: Andreas Kneib had problems with some Microsoft Outlook + gargabe and submitted a one-liner. Thanks! + +2009-08-24 02:07 Jochen Striepe + + * t-prot: Release as t-prot v2.6. + +2009-08-24 01:44 Jochen Striepe + + * t-prot.1: Update dates. + +2009-08-24 01:43 Jochen Striepe + + * t-prot.1: Fix a typo, thanks to Gerfried Fuchs. + +2009-08-24 01:42 Jochen Striepe + + * t-prot: Fix a typo, thanks to Michael Hunger. Tweak the MS-TOFU + pattern, thanks to Simon Ruderich. + 2007-09-19 11:32 Jochen Striepe * t-prot, t-prot.1: Updated time stamps, released as v2.5. diff --git a/NEWS b/NEWS new file mode 100644 index 0000000..5a43d23 --- /dev/null +++ b/NEWS @@ -0,0 +1,25 @@ +T-PROT AND SUPPORT FOR GETOPT::LONG +=================================== + +Most distributions (it seems to me) are quite eager to abandon Getopt::Mixed, +having Getopt::Long in the official Perl package, which does everything the +former module did. Getopt::Mixed is unmaintained and marked deprecated by +its author, so why keep it? + +The answer is simple: because it's much faster (GNU time(1) tells me 28% +faster for running my complete t-prot release test suite consisting of +real-life emails) than anything I could get out of Getopt::Long. Plus, +from my point of view, there are no problems having a package installed +that is well-tested and just works fine (you don't need updates and more +new shiny features if the software just does what you want it to do). + +So we have the choice between easy maintainance and better performance. + + +For the time being, I made my choice and keep sticking to Getopt::Mixed as +long as it works as-is with current stable perl versions. That does not mean +I don't see the merits of a well-maintained standard module, which is already +available on any perl system out there. Thus, a patch is provided to allow +easy migration to Getopt::Long for anyone who likes this better. I hope +this solution is fine for everyone. + diff --git a/contrib/README.patches b/contrib/README.patches index ea7af00..f9791d2 100644 --- a/contrib/README.patches +++ b/contrib/README.patches @@ -25,6 +25,17 @@ to decide if some specific feature makes it into vanilla t-prot. RECENT PATCHES ============== +t-prot-*-gol.diff +================= +Getopt::Mixed is abandoned and marked deprecated by its author, and many +distributions would like nothing better than to get rid of it. Using this +patch, you can make t-prot use Getopt::Long (which comes bundled with +standard perl). + +If you know how to deal with the serious performance impacts Getopt::Long +brings along, please drop me an email. Thanks. + + t-prot-*-mutt15*.diff and t-prot-*-gpg1*.diff ============================================= You want to be on the bleeding edge, using a developer version of mutt? @@ -75,8 +86,8 @@ This patch is no longer available -- starting with v1.12 it is merged into vanilla t-prot. Thanks to everyone who sent bug reports or gave feedback. -t-prot-*-gol.diff -================= +t-prot-*-gol.diff (first version) +================================= This patch is no longer available. The feedback to Debian Bug #193937 came only from two people: the Debian diff --git a/contrib/t-prot-r1.261-gol.diff b/contrib/t-prot-r1.261-gol.diff new file mode 100644 index 0000000..a73a077 --- /dev/null +++ b/contrib/t-prot-r1.261-gol.diff @@ -0,0 +1,187 @@ +--- t-prot 2009-08-24 22:32:11.000000000 +0200 ++++ t-prot-gol 2009-08-24 22:37:25.000000000 +0200 +@@ -4,7 +4,7 @@ + require 5.006; + use strict; + use Fcntl qw(O_EXCL O_WRONLY O_CREAT); +-use Getopt::Mixed qw(nextOption); ++use Getopt::Long qw(:config gnu_getopt no_ignore_case); + use constant VER => '2.7'; + use constant REV => ''; + use constant REL => q$Revision: 1.261 $=~m/(\d+(?:\.\d+)+)/; +@@ -925,83 +925,82 @@ + (0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0); + my $ifile = '-'; # use STDIN if nothing specified + ++# temp vals: ++my ($_t1, $_t2, $_t3, $_t4, $_t5, $_t6, $_t7, $_t8, $_t9, $_ta, $_tb) = undef; ++ + # get command line params: +-Getopt::Mixed::init('a A=s c d e h i=s k L=s l m M=s o=s P=s p:s r S:i'. +- ' s t v w bigq:s body check:s debug>d diff ftr-ad ftr-ml groupwise'. +- ' help>h kminl=i kmaxl=i kdiff=i lax-security locale=s max-lines=i'. +- ' ms-smart mua>M pgp-short pgp-move pgp-move-vrf sigsmax:i spass'. +- ' version>v'); +-while (my ($opt, $val, $pretty) = nextOption()) { +- if ($opt eq 'a') { $ad = 1; } +- elsif ($opt eq 'A') { $ads = $val; } +- elsif ($opt eq 'bigq') { +- if ($val !~ /^(?:(\d+)(?:,(\d+))?)?$/) { help(); } +- $bigqn = $1?$1:30; +- $bigqx = $2?$2:10; +- if ($bigqn<=0 || $bigqx<=0 || $bigqn<=$bigqx) { help(); } +- } +- elsif ($opt eq 'body') { $nohdr = 1; $hdrs = 1; } +- elsif ($opt eq 'c') { $cr = 1; } +- elsif ($opt eq 'check') { +- $check = 1; +- while ($val && $val =~ s/^([^,\s]+)(?:,(\S+))?$/$2/) { +- my $foo = $1; ++if (!Getopt::Long::GetOptions( ++ 'a' => \$ad, ++ 'A=s' => \$ads, ++ 'bigq:s' => \$_t1, ++ 'c' => \$cr, ++ 'check:s' => \$_t9, ++ 'debug|d' => \$sysl, ++ 'diff' => \$diff, ++ 'e' => \$elli, ++ 'ftr-ad' => \$ftr_ad, ++ 'ftr-ml' => \$ftr_ml, ++ 'groupwise' => \$gw, ++ 'help|h' => \$_t2, ++ 'i=s' => \$ifile, ++ 'k' => \$kamm, ++ 'kminl=i' => \$_t3, ++ 'kmaxl=i' => \$_t4, ++ 'kdiff=i' => \$_t5, ++ 'L=s' => \$footers, ++ 'l' => \$ml, ++ 'lax-security' => \$lax, ++ 'locale=s' => \$locale, ++ 'max-lines=i' => \$maxlines, ++ 'ms-smart' => \$ms_smart, ++ 'mua|M=s' => \$_t7, ++ 'm' => \$ms, ++ 'o=s' => \$ofile, ++ 'P=s' => \$boun, ++ 'p:s' => \$_t8, ++ 'pgp-short' => \$pgpshort, ++ 'pgp-move' => \$pgpmove, ++ 'pgp-move-vrf' => \$pgpmovevrf, ++ 'r' => \$hdrs, ++ 'S:i' => \$_t6, ++ 's' => \$sig, ++ 'sigsmax:i' => \$_ta, ++ 'spass' => \$spass, ++ 't' => \$trad, ++ 'version|v' => \$_tb, ++ 'w' => \$trsp ++ )) { ++ help(); ++} + +- if ($foo =~ /^ratio=(0?\.\d+)$/) { +- $check_ratio = $1?$1:1; +- } +- } ++# clean up temp vals: ++if (defined $_t1) { ++ if ($_t1 !~ /^(?:(\d+)(?:,(\d+))?)?$/) { help(); } ++ $bigqn = $1?$1:30; ++ $bigqx = $2?$2:10; ++ if ($bigqn<=0 || $bigqx<=0 || $bigqn<=$bigqx) { help(); } ++} ++if (defined $_t2) { help(); } ++if (defined $_t3) { $kminl = $_t3; $kamm = 1; } ++if (defined $_t4) { $kmaxl = $_t4; $kamm = 1; } ++if (defined $_t5) { $kdiff = $_t5; $kamm = 1; } ++if (defined $_t6) { $lsig = $_t6 ? $_t6 : $maxsig; } ++if (defined $_t7) { ++ $mua = lc($_t7); ++ # mutt still displays the message when ^C'ing pgp verification: ++ if ($mua eq 'mutt') { $SIG{'INT'} = 'sigint_handler'; } ++} ++if (defined $_t8) { $mda = $_t8 ? $_t8 : '1'; } ++if (defined $_t9) { ++ $check = 1; ++ while ($_t9 && $_t9 =~ s/^([^,\s]+)(?:,(\S+))?$/$2/) { ++ my $foo = $1; ++ if ($foo =~ /^ratio=(0?\.\d+)$/) { $check_ratio = $1?$1:1; } + } +- elsif ($opt eq 'd') { $sysl = 1; } +- elsif ($opt eq 'diff') { $diff = 1; } +- elsif ($opt eq 'e') { $elli = 1; } +- elsif ($opt eq 'ftr-ad') { $ftr_ad = 1; $ad = 1; } +- elsif ($opt eq 'ftr-ml') { $ftr_ml = 1; $ml = 1; } +- elsif ($opt eq 'groupwise') { $gw = 1; } +- elsif ($opt eq 'i') { $ifile = $val; } +- elsif ($opt eq 'k') { $kamm = 1; } +- elsif ($opt eq 'kminl') { $kminl = $val; $kamm = 1; } +- elsif ($opt eq 'kmaxl') { $kmaxl = $val; $kamm = 1; } +- elsif ($opt eq 'kdiff') { $kdiff = $val; $kamm = 1; } +- elsif ($opt eq 'L') { $footers = $val; } +- elsif ($opt eq 'l') { $ml = 1; } +- elsif ($opt eq 'lax-security') { $lax = 1; } +- elsif ($opt eq 'locale') { $locale = $val; } +- elsif ($opt eq 'm') { $ms = 1; } +- elsif ($opt eq 'max-lines') { $maxlines = $val; } +- elsif ($opt eq 'ms-smart') { $ms_smart = 1; $ms = 1; } +- elsif ($opt eq 'M') { +- $mua = lc($val); +- +- if ($mua eq 'mutt') { +- # mutt still displays the message when ^C'ing pgp verification: +- $SIG{'INT'} = 'sigint_handler'; +- } +- } +- elsif ($opt eq 'o') { $ofile = $val; } +- elsif ($opt eq 'P') { $boun = $val; } +- elsif ($opt eq 'p') { $mda = $val ? $val : '1'; } +- elsif ($opt eq 'pgp-short') { $pgpshort = 1; } +- elsif ($opt eq 'pgp-move') { $pgpmove = 1; } +- elsif ($opt eq 'pgp-move-vrf') { $pgpmovevrf = 1; } +- elsif ($opt eq 'r') { $hdrs = 1; } +- elsif ($opt eq 'S') { $lsig = $val ? $val : $maxsig; } +- elsif ($opt eq 's') { $sig = 1; } +- elsif ($opt eq 'sigsmax') { $sign = $val ? $val : undef; } +- elsif ($opt eq 'spass') { $spass = 1; } +- elsif ($opt eq 't') { $trad = 1; } +- elsif ($opt eq 'v') { version(); } +- elsif ($opt eq 'w') { $trsp = 1; } +- else { help(); } + } +-Getopt::Mixed::cleanup(); +-if (($ml && $footers eq '')|| # no -l without -L +- ($ad && $ads eq '')|| # no -a without -A +- ($nohdr && $pgpshort)|| # --body and --pgp-short are like oil and water +- ($ifile eq '')|| # no empty -i +- ($ofile eq '')) # no empty -o +-{ help(); } +- ++if (defined $_ta) { $sign = $_ta ? $_ta : undef; } ++if (defined $_tb) { version(); } ++if ($ms_smart) { $ms = 1; } + + if ($mua eq 'mutt') { + if (defined $locale && $locale ne '' && $locale ne 'C' && $locale ne 'POSIX') { +@@ -1063,11 +1062,15 @@ + m/^([^%]*)/; + } + } +- +-} +-else { +- if ($ms_smart || $pgpshort || $pgpmove || $pgpmovevrf) { help(); } + } ++elsif ($ms_smart || $pgpshort || $pgpmove || $pgpmovevrf) { help(); } ++ ++if (($ml && $footers eq '')|| # no -l without -L ++ ($ad && $ads eq '')|| # no -a without -A ++ ($nohdr && $pgpshort)|| # --body and --pgp-short are like oil and water ++ ($ifile eq '')|| # no empty -i ++ ($ofile eq '')) # no empty -o ++{ help(); } + + + # Read message: diff --git a/t-prot b/t-prot index dca0ac3..bf3a0a1 100755 --- a/t-prot +++ b/t-prot @@ -1,13 +1,13 @@ #!/usr/bin/perl -w -# $Id: t-prot,v 1.255 2007/09/19 11:32:58 jochen Exp $ +# $Id: t-prot,v 1.261 2009/08/24 20:32:11 jochen Exp $ require 5.006; use strict; use Fcntl qw(O_EXCL O_WRONLY O_CREAT); use Getopt::Mixed qw(nextOption); -use constant VER => '2.5'; +use constant VER => '2.7'; use constant REV => ''; -use constant REL => q$Revision: 1.255 $=~m/(\d+(?:\.\d+)+)/; +use constant REL => q$Revision: 1.261 $=~m/(\d+(?:\.\d+)+)/; # MTA expecting mail on STDIN # (you might have to adjust this if using a different MTA) use constant SENDMAIL => '/usr/sbin/sendmail -oi'; @@ -108,7 +108,7 @@ sub help { --kminl=n min. line length for wrapped line; requires -k --kmaxl=n max. line length for wrapped line; requires -k --kdiff=n max. length difference between wrapped lines; req. -k - -L=DIRECTORY mailling list footer directory, treat mailing list + -L=DIRECTORY mailing list footer directory, treat mailing list footers as signature -l delete mailing list footer; requires -L --lax-security use unsafe writing method; USE ON YOUR OWN RISK! @@ -178,12 +178,12 @@ sub remove_footers { for (my $z=0; $z<=$#l; $z++) { chomp($l[$z]); } if (defined $V) { - WIPE: for (my $z=scalar(@$L)-scalar(@l); $z>=0; $z--) - { + WIPE: for (my $z=scalar(@$L)-scalar(@l); $z>=0; $z--) { if (scalar(@l)+$z<=scalar(@$L)) { my $y = 0; for(my $x=1; $x<=scalar(@l); $x++) { - if (index($$L[scalar(@$L)-$x-$z], $l[scalar(@l)-$x])!=0) { + if (index($$L[scalar(@$L)-$x-$z], + $l[scalar(@l)-$x])!=0) { $y = 1; } } @@ -255,11 +255,12 @@ sub decomb { (index($$L[$x+1], $indent)!=0) && ($$L[$x+1] !~ /^$/) && ($$L[$x+1] !~ /^[\s^]/) && - ($$L[$x] !~ /-$/) && + ($$L[$x] !~ /-$/) && ($$L[$x+1] !~ /^\Q[...]\E\s*$/) && ($mua ne 'mutt' || $$L[$x+1] !~ /^(?:\e[^\a]+\a)?\[-- /) && (length($$L[$x])+index($$L[$x+1], ' ')>$max || - (index($$L[$x+1], ' ')<0 && length($$L[$x])+length($$L[$x+1])>$max)) && + (index($$L[$x+1], ' ')<0 && + length($$L[$x])+length($$L[$x+1])>$max)) && (length($$L[$x])+length($$L[$x+1])<$kmaxl) && (length($$L[$x])+length($$L[$x+1])>$kminl) && (length($$L[$x])-length($$L[$x+1])>$kdiff) && @@ -702,6 +703,7 @@ sub process_msg { my @tofu = ('Original Message', 'Original-Nachricht', 'Ursprüngliche Nachricht', + 'Ursprüngliche Nachricht', 'Ursprungliche Nachricht', 'Mensagem original', 'Ursprungligt meddelande', @@ -715,7 +717,7 @@ sub process_msg { DONE: for ($x=0; $x>>[^\<]+<[^\>]+> \d\d?\/\d\d?\/\d\d? \d\d?:\d\d [AP]M >>>/ || $$lines[$x] =~ /^>>> On [A-Z][a-z][a-z]?, [A-Z][a-z][a-z]? \d\d?, \d\d\d\d at [ \d]\d:\d\d [AP]M, in message/))) { diff --git a/t-prot.1 b/t-prot.1 index c732e3d..a503ce0 100644 --- a/t-prot.1 +++ b/t-prot.1 @@ -1,6 +1,6 @@ -.\" $Id: t-prot.1,v 1.132 2007/09/19 11:32:59 jochen Exp $ +.\" $Id: t-prot.1,v 1.134 2009/08/24 01:44:27 jochen Exp $ .\" -.TH T-PROT "1" "September 2007" "T-PROT" +.TH T-PROT "1" "August 2009" "T-PROT" .SH NAME t-prot \- TOFU Protection - Display Filter for RFC 2822 messages .SH SYNOPSIS @@ -553,9 +553,9 @@ Text coming now is not. Written by Jochen Striepe . .SH COPYRIGHT All of the documentation and software included in the t-prot releases -is copyrighted by Jochen Striepe (except when explicitely stated otherwise). +is copyrighted by Jochen Striepe (except when explicitly stated otherwise). .PP -Copyright \(co 2001-2007 Jochen Striepe. All rights reserved. +Copyright \(co 2001-2009 Jochen Striepe. All rights reserved. .PP Redistribution and use, with or without modification, are permitted provided that the following conditions are met: -- 2.39.2