From: Gerfried Fuchs Date: Wed, 17 Feb 2010 19:56:09 +0000 (+0100) Subject: Imported Upstream version 2.12 X-Git-Tag: upstream/2.12^0 X-Git-Url: https://git.deb.at/?a=commitdiff_plain;h=afc6f7175ce2809eab34f213614ac478cbbf0ac3;p=pkg%2Ft-prot.git Imported Upstream version 2.12 --- diff --git a/ChangeLog b/ChangeLog index a38d94c..1fc6cf8 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,15 @@ +2010-01-08 11:10 Jochen Striepe + + * t-prot: Release as v2.12. + +2010-01-08 11:08 Jochen Striepe + + * t-prot, t-prot.1: Exit with exit status EX_OK when --max-lines + hits and -Mmutt is set (mutt is picky when a display_filter fails). + Provide a notification line in that case. Update man page. Many + thanks to Gerfried Fuchs, Martin F. Krafft and Tino Keitel for + reporting, providing a patch and testing. + 2010-01-05 12:05 Jochen Striepe * t-prot: Release as v2.11. diff --git a/contrib/t-prot-r1.269-gol.diff b/contrib/t-prot-r1.269-gol.diff deleted file mode 100644 index bef8f22..0000000 --- a/contrib/t-prot-r1.269-gol.diff +++ /dev/null @@ -1,189 +0,0 @@ ---- t-prot 2010-01-05 13:03:01.000000000 +0100 -+++ t-prot-gol 2010-01-05 13:04:08.000000000 +0100 -@@ -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.11'; - use constant REV => ''; - use constant REL => q$Revision: 1.268 $=~m/(\d+(?:\.\d+)+)/; -@@ -914,84 +914,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 (!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:0.75; -- } -- } -+# 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 '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') { -@@ -1053,11 +1052,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/contrib/t-prot-r1.271-gol.diff b/contrib/t-prot-r1.271-gol.diff new file mode 100644 index 0000000..1896bd1 --- /dev/null +++ b/contrib/t-prot-r1.271-gol.diff @@ -0,0 +1,189 @@ +--- t-prot 2010-01-08 12:10:26.000000000 +0100 ++++ t-prot-gol 2010-01-08 12:14:18.000000000 +0100 +@@ -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.12'; + use constant REV => ''; + use constant REL => q$Revision: 1.271 $=~m/(\d+(?:\.\d+)+)/; +@@ -914,84 +914,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') { +@@ -1053,11 +1052,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 441cd90..c67f94b 100755 --- a/t-prot +++ b/t-prot @@ -1,13 +1,13 @@ #!/usr/bin/perl -w -# $Id: t-prot,v 1.269 2010/01/05 12:05:03 jochen Exp $ +# $Id: t-prot,v 1.271 2010/01/08 11:10:26 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.11'; +use constant VER => '2.12'; use constant REV => ''; -use constant REL => q$Revision: 1.269 $=~m/(\d+(?:\.\d+)+)/; +use constant REL => q$Revision: 1.271 $=~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'; @@ -1069,8 +1069,19 @@ close IN; # First, check msg length and stop processing if msg is too long: if ((defined $maxlines) && (@message > $maxlines)) { if ($ofile ne 'NONE') { + if ($mua eq 'mutt') { + my $x = 0; + if (!$nohdr) { + do { $x++; } while ($x<$#message && $message[$x]!~/^$/); + $x++; + } + splice(@message, $x, 0, + ("[---=| Processing by $0 skipped: message too long |=---]\n\n")); + } + write_msg(($mda?'|'.SENDMAIL." $mda":">$ofile"), \@message); } + if ($mua eq 'mutt') { exit(EX_OK); } exit(EX_DATAERR); } diff --git a/t-prot.1 b/t-prot.1 index 2d517c6..6ed54e1 100644 --- a/t-prot.1 +++ b/t-prot.1 @@ -1,4 +1,4 @@ -.\" $Id: t-prot.1,v 1.143 2010/01/05 11:46:38 jochen Exp $ +.\" $Id: t-prot.1,v 1.144 2010/01/08 11:08:50 jochen Exp $ .\" .TH T-PROT "1" "January 2010" "T-PROT" .SH NAME @@ -307,7 +307,7 @@ Requires .BR "\-\-max\-lines" =x Maximum number of lines a message may count (with headers). If the message is longer than x lines, the message will not be processed but printed -unmodified. Exit status will be EX_DATAERR. +unmodified. Exit status will be EX_DATAERR except when called with -Mmutt. .TP .BR "\-o" =FILE "output file":