From: Gerfried Fuchs Date: Wed, 17 Feb 2010 20:00:00 +0000 (+0100) Subject: Imported Upstream version 2.14 X-Git-Tag: upstream/2.14^0 X-Git-Url: https://git.deb.at/w?a=commitdiff_plain;h=be81225823f000a965985749c6ea8837e31b23f3;p=pkg%2Ft-prot.git Imported Upstream version 2.14 --- diff --git a/ChangeLog b/ChangeLog index 53ff83e..ededd73 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,28 @@ +2010-02-11 11:10 Jochen Striepe + + * t-prot: Release as v2.14. + +2010-02-11 11:09 Jochen Striepe + + * t-prot: Code cleanup for --pgp-short. Should get better + performance now. + +2010-02-07 22:41 Jochen Striepe + + * t-prot: Tighten --help output. + +2010-02-07 22:10 Jochen Striepe + + * t-prot.1: Add fields of usage and mention the INN2 filter file. + +2010-02-07 21:56 Jochen Striepe + + * t-prot.1: Improve word flow. + +2010-02-07 16:16 Jochen Striepe + + * t-prot.1: Another occurence of RFC 2822, update to RFC 5322. + 2010-02-07 14:31 Jochen Striepe * t-prot.1: RFC 5322 is offficial standard for the Internet Message diff --git a/NEWS b/NEWS deleted file mode 100644 index 5a43d23..0000000 --- a/NEWS +++ /dev/null @@ -1,25 +0,0 @@ -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/README b/README index 164abf3..90527c8 100644 --- a/README +++ b/README @@ -1,5 +1,5 @@ - t-prot -- TOFU protection - ========================= +T-PROT -- TOFU protection +========================= 1. What the hell is TOFU? As the man page says: @@ -15,7 +15,7 @@ Thank you! 2. What does the script do? - It detects, and when demanded hides annoying parts in rfc2822 messages: + It detects, and when demanded hides annoying parts in rfc5322 messages: TOFU, huge quoted blocks, signatures (especially when they are too long), excessive punktuation, blocks of empty lines, trailing spaces and tabs. For use inside of MTAs or MDAs it exits with appropriate libc exit codes, @@ -44,3 +44,28 @@ entire inspiration for this hack came from the "TOFU protection" line of his script on many usenet postings. + +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/t-prot-r1.246-mutt1512.diff b/contrib/t-prot-r1.246-mutt1512.diff deleted file mode 100644 index 0277ba8..0000000 --- a/contrib/t-prot-r1.246-mutt1512.diff +++ /dev/null @@ -1,102 +0,0 @@ ---- t-prot 2006-06-18 00:45:55.000000000 +0200 -+++ t-prot-M1511 2006-07-11 14:22:56.000000000 +0200 -@@ -32,7 +32,7 @@ - - $mutt_attachment $mutt_contenttype $mutt_pgpsigned $mutt_beginsigned - $mutt_pgpclearsigned $mutt_pgpclearsigstart $mutt_pgpencrypted -- $mutt_pgpoutstart $mutt_pgpoutend -+ $mutt_pgpoutstart $mutt_pgpoutend $mutt_ssloutstart $mutt_ssloutend - ); - - -@@ -69,6 +69,8 @@ - $mutt_pgpencrypted = '[-- End of PGP/MIME encrypted data --]'; - $mutt_pgpoutstart = '[-- PGP output follows (current time:'; - $mutt_pgpoutend = '[-- End of PGP output --]'; -+$mutt_ssloutstart = '[-- OpenSSL output follows'; -+$mutt_ssloutend = '[-- End of OpenSSL output --]'; - - # set the defaults to the C locale - $gpg_WARNING = 'WARNING: '; -@@ -336,7 +338,7 @@ - for (my $x=0; $x '2.13'; - use constant REV => ''; - use constant REL => q$Revision: 1.276 $=~m/(\d+(?:\.\d+)+)/; -@@ -916,84 +916,83 @@ - (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+))?$/) { -- my $foo = $1; -- $val = $2; -- -- if ($foo =~ /^ratio(?:=(0?\.\d+))?$/) { -- $check_ratio = $1?$1:0.75; -- } -- } -- } -- 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 (!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 ($mua eq 'mutt') { -- # mutt still displays the message when ^C'ing pgp verification: -- $SIG{'INT'} = 'sigint_handler'; -- } -+# 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+))?$/) { -+ my $foo = $1; -+ $_t9 = $2; -+ if ($foo =~ /^ratio(?:=(0?\.\d+))?$/) { $check_ratio = $1?$1:0.75; } - } -- 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') { -@@ -1058,6 +1057,13 @@ - - } - 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/contrib/t-prot-r1.279-mutt1512.diff b/contrib/t-prot-r1.279-mutt1512.diff new file mode 100644 index 0000000..a1d3d43 --- /dev/null +++ b/contrib/t-prot-r1.279-mutt1512.diff @@ -0,0 +1,102 @@ +--- t-prot 2010-02-11 11:41:15.000000000 +0100 ++++ t-prot-m1512 2010-02-11 11:48:49.000000000 +0100 +@@ -32,7 +32,7 @@ + + $mutt_attachment $mutt_contenttype $mutt_pgpsigned $mutt_beginsigned + $mutt_pgpclearsigned $mutt_pgpclearsigstart $mutt_pgpencrypted +- $mutt_pgpoutstart $mutt_pgpoutend ++ $mutt_pgpoutstart $mutt_pgpoutend $mutt_ssloutstart $mutt_ssloutend + ); + + +@@ -71,6 +71,8 @@ + $mutt_pgpencrypted = '[-- End of PGP/MIME encrypted data --]'; + $mutt_pgpoutstart = '[-- PGP output follows (current time:'; + $mutt_pgpoutend = '[-- End of PGP output --]'; ++$mutt_ssloutstart = '[-- OpenSSL output follows'; ++$mutt_ssloutend = '[-- End of OpenSSL output --]'; + + # set the defaults to the C locale + $gpg_WARNING = 'WARNING: '; +@@ -342,7 +344,7 @@ + for (my $x=0; $x '2.14'; + use constant REV => ''; + use constant REL => q$Revision: 1.280 $=~m/(\d+(?:\.\d+)+)/; +@@ -913,84 +913,83 @@ + (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+))?$/) { +- my $foo = $1; +- $val = $2; +- +- if ($foo =~ /^ratio(?:=(0?\.\d+))?$/) { +- $check_ratio = $1?$1:0.75; +- } +- } +- } +- 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 (!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 ($mua eq 'mutt') { +- # mutt still displays the message when ^C'ing pgp verification: +- $SIG{'INT'} = 'sigint_handler'; +- } ++# 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+))?$/) { ++ my $foo = $1; ++ $_t9 = $2; ++ if ($foo =~ /^ratio(?:=(0?\.\d+))?$/) { $check_ratio = $1?$1:0.75; } + } +- 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') { +@@ -1055,6 +1054,13 @@ + + } + 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 364af8e..21b5d21 100755 --- a/t-prot +++ b/t-prot @@ -1,13 +1,13 @@ #!/usr/bin/perl -w -# $Id: t-prot,v 1.277 2010/02/06 03:29:23 jochen Exp $ +# $Id: t-prot,v 1.280 2010/02/11 11:10:47 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.13'; +use constant VER => '2.14'; use constant REV => ''; -use constant REL => q$Revision: 1.277 $=~m/(\d+(?:\.\d+)+)/; +use constant REL => q$Revision: 1.280 $=~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'; @@ -126,8 +126,7 @@ sub help { --pgp-move-vrf move pgp output if verified and good; requires -Mmutt --pgp-short hide non-relevant pgp key uids; requires -Mmutt -r delete mail header lines - -S[=n] supress signatures with more than n lines; - default is $maxsig if n not specified + -S[=n] supress signatures with more than n lines (default $maxsig) -s delete signature --sigsmax[=n] max number of sigs tolerated, no value for unlimited --spass enable SpamAssassin workaround @@ -360,19 +359,16 @@ sub pgp { my $uid = 1; for (my $i=$x+1; $i1 && - index($$L[$i], "gpg: $gpg_aka")==0 && - index($$L[$i], $from)<0) - { - splice(@$L, $i, 1); - splice(@$V, $i, 1); - $i--; + if ($pgpshort && index($$L[$i], "gpg: $gpg_aka")==0) { + $uid++; + + if ($uid>1 && index($$L[$i], $from)<0) { + splice(@$L, $i, 1); + splice(@$V, $i, 1); + $i--; + } } - elsif ($$L[$i]=~/^(?:\e[^\a]+\a)?(?:\Q$mutt_pgpoutend\E)/o) - { + elsif ($$L[$i]=~/^(?:\e[^\a]+\a)?(?:\Q$mutt_pgpoutend\E)/o) { if ($pgpmove || ($pgpmovevrf && (!$sigint) && verified($L, $x+1, $i))) { diff --git a/t-prot.1 b/t-prot.1 index 035f9b9..e03cffa 100644 --- a/t-prot.1 +++ b/t-prot.1 @@ -1,4 +1,4 @@ -.\" $Id: t-prot.1,v 1.148 2010/02/07 14:31:14 jochen Exp $ +.\" $Id: t-prot.1,v 1.151 2010/02/07 22:10:06 jochen Exp $ .\" .TH T-PROT "1" "February 2010" "T-PROT" .SH NAME @@ -7,10 +7,13 @@ t-prot \- TOFU Protection - Display Filter for RFC 5322 messages .BI "t\-prot [" OPTIONS "]..." .SH DESCRIPTION .PP -This program is a filter to improve the readability of +This program is a filter to improve the readability of internet messages (emails and usenet posts) by *hiding* some annoying parts, e.g. mailing list footers, signatures, and TOFU (see definition below), as well as squeezing sequences of blank lines or punctuation. +The program also detects TOFU or a high quoting ratio in a message (so +you may take appropriate action, e.g. when submitting messages to a mailing +list or a news server). .br The filter is written in Perl and relies on input to be a single message conforming to RFC 822 or its successors, RFC 2822 and RFC 5322. @@ -23,7 +26,9 @@ messages). .PP For easy usage, you can include the file muttrc.t\-prot in your ~/.muttrc. Also coming with the t-prot package is the example S-Lang -macro t\-prot.sl for using t-prot from within slrn. +macro t\-prot.sl for using t-prot from within slrn. There is a +proof\-of\-concept filter for INN2, which you will have to adapt to +the needs of the news site you host (please see the file for details). .SH OPTIONS .TP .BR "\-A" =DIRECTORY @@ -65,7 +70,7 @@ Blocks of quotes with more than n lines will be shrunk to x lines. Defaults are 30 for n and 10 for x. .TP .B "\-\-body" -Input consists just of the message's body. There are no RFC 2822 header +Input consists just of the message's body. There are no RFC 5322 header lines. .IP .IR NOTE :