X-Git-Url: https://git.deb.at/w?a=blobdiff_plain;f=t-prot;h=81fbd71b49e6181f6771bb15b70707f7623741f0;hb=5393e2a685831a44164165cfbf473b2548c69a88;hp=ee846679214fb2c073f421d2579e3e529888f584;hpb=59f87ac047552c79d2885106c9dde3967563190a;p=pkg%2Ft-prot.git diff --git a/t-prot b/t-prot index ee84667..81fbd71 100755 --- a/t-prot +++ b/t-prot @@ -1,13 +1,13 @@ #!/usr/bin/perl -w -# $Id: t-prot,v 1.236 2005/04/25 16:35:56 jochen Exp $ +# $Id: t-prot,v 1.246 2006/06/17 22:45:55 jochen Exp $ require 5.006; use strict; use Fcntl qw(O_EXCL O_WRONLY O_CREAT); use Getopt::Mixed qw(nextOption); -use constant VER => '1.101'; +use constant VER => '2.1'; use constant REV => ''; -use constant REL => q$Revision: 1.236 $=~m/(\d+(?:\.\d+)+)/; +use constant REL => q$Revision: 1.246 $=~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'; @@ -252,7 +252,7 @@ sub decomb { ($$L[$x+1] !~ /^[\s^]/) && ($$L[$x] !~ /-$/) && ($$L[$x+1] !~ /^\Q[...]\E\s*$/) && - ($mua ne 'mutt' || $$L[$x+1] !~ /^(?:\e.+?\a)?\[-- .* --]/) && + ($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)) && (length($$L[$x])+length($$L[$x+1])<$kmaxl) && @@ -311,11 +311,14 @@ sub pgp { my $ok = 0; while ($X<$Z) { - if ($$L[$X] =~ /^gpg:\s(?:\Q$gpg_WARNING\E|\Q$gpg_Warning\E|\Q$gpg_bad\E|\Q$gpg_Cantcheck\E|\Q$gpg_expired\E)/o) + if (index($$L[$X], "gpg: $gpg_WARNING")==0 || + index($$L[$X], "gpg: $gpg_Warning")==0 || + index($$L[$X], "gpg: $gpg_bad")==0 || + index($$L[$X], "gpg: $gpg_Cantcheck")==0 || + index($$L[$X], "gpg: $gpg_expired")==0 || + index($$L[$X], "gpg: $gpg_bug")==0) { return 0; } - if ($$L[$X] =~ /^gpg:\s\Q$gpg_bug/o) - { return 0; } - if ($$L[$X] =~ /^gpg:\s\Q$gpg_good/o) + if (index($$L[$X], "gpg: $gpg_good")==0) { $ok = 1; } $X++; } @@ -333,32 +336,34 @@ sub pgp { for (my $x=0; $x1 && - $$L[$i] =~ /^gpg:\s\Q$gpg_aka/o && $$L[$i] !~ /\Q$from/) + index($$L[$i], "gpg: $gpg_aka")==0 && + index($$L[$i], $from)<0) { splice(@$L, $i, 1); splice(@$V, $i, 1); $i--; } - elsif ($$L[$i]=~/^(?:\e.+?\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))) @@ -374,7 +379,12 @@ sub pgp { } } elsif ($tmp && - $$L[$x]=~/^(?:\e.+?\a)?(?:\Q$mutt_pgpencrypted\E|\Q$mutt_pgpclearsigned\E|\Q$mutt_pgpsigned\E)/o) + $$L[$x] =~ /^ + (?:\e[^\a]+\a)? + (?:\Q$mutt_pgpencrypted\E | + \Q$mutt_pgpclearsigned\E| + \Q$mutt_pgpsigned\E) + /ox) { splice(@$L, $x+1, 0, @{$tmp[$tmp]}); for (my $i=$x; $i=scalar(@$lines)) { exit(EX_DATAERR); } - if ($bar =~ /^text\/plain/i) { + if ($bar =~ m!^text/plain!) { my $z; for ($z=1; $x+$z<@$lines; $z++) { if (index($$lines[$x+$z], '--'.$foo)==0) { @@ -529,7 +539,7 @@ sub process_msg { for ($x=0; $x=0; $x--) { - if ((!$vrb[$x]) && $$lines[$x] =~ /^-- $/) { - if ($diff) { - for (my $i=1; $x+$i+1$lsig))) { - if ($lsig && !$sig) { - unshift(@sig, "[---=| Overlong signature removed by $0: " . - (scalar(@$lines)-$x) . " lines snipped |=---]\n"); + if ($sig || ($lsig && ($#$lines-$x-$empty>$lsig))) { + if ($lsig && !$sig) { + unshift(@sig, "[---=| Overlong signature removed by $0: " . + (scalar(@$lines)-$x) . " lines snipped |=---]\n"); + } + splice(@$lines, $x); } - splice(@$lines, $x); - } - else { - unshift(@sig, @$lines[$x..$#$lines]); - splice(@$lines, $x); + else { + unshift(@sig, @$lines[$x..$#$lines]); + splice(@$lines, $x); + } + if (defined($sign) && ++$sn==$sign) { last; } else { next; } } - if (defined($sign) && ++$sn==$sign) { last; } else { next; } + # any trailing newlines? + elsif ($chk_empty && $$lines[$x] =~ /^\s*$/) { $empty++; } + elsif ($chk_empty) { $chk_empty = 0; } } } } @@ -676,16 +709,21 @@ sub process_msg { if ((!$k) && $$lines[$x] !~ /^\s*$/o && ((!$mua) || ($mua eq 'mutt' && - $$lines[$x] !~ /^(?:\e.+?\a)?(?:\Q$mutt_attachment\E)/o && - $$lines[$x] !~ /^(?:\e.+?\a)?(?:\Q$mutt_contenttype\E)/o)) && - ((!$spass) || $$lines[$x]!~/^\Q$spass_prefix/o)) + $$lines[$x] !~ + /^(?:\e[^\a]+\a)?(?:\Q$mutt_attachment\E)/o && + $$lines[$x] !~ + /^(?:\e[^\a]+\a)?(?:\Q$mutt_contenttype\E)/o)) && + ((!$spass) || index($$lines[$x], $spass_prefix)!=0)) { if ($mua eq 'mutt' && (!$tmp) && - $$lines[$x] =~ /^(?:\e.+?\a)?(?:\Q$mutt_pgpoutstart\E)/o) { + $$lines[$x] =~ + /^(?:\e[^\a]+\a)?(?:\Q$mutt_pgpoutstart\E)/o) { $tmp = 1; } elsif ($mua eq 'mutt' && $tmp && - ($$lines[$x] =~ /^(?:\e.+?\a)?(?:\Q$mutt_beginsigned\E)/o || - $$lines[$x] =~ /^(?:\e.+?\a)?(?:\Q$mutt_pgpclearsigstart\E)/o)) { + ($$lines[$x] =~ + /^(?:\e[^\a]+\a)?(?:\Q$mutt_beginsigned\E)/o || + $$lines[$x] =~ + /^(?:\e[^\a]+\a)?(?:\Q$mutt_pgpclearsigstart\E)/o)) { $tmp = 0; } elsif (!$tmp) { $k = 1; @@ -703,17 +741,19 @@ sub process_msg { my $p = 0; # levels of pgp signed parts for (my $i=$x+1; $i