X-Git-Url: https://git.deb.at/w?p=pkg%2Ft-prot.git;a=blobdiff_plain;f=t-prot;h=ee846679214fb2c073f421d2579e3e529888f584;hp=199daba5b45480da9bd5fd94ccbb04363b3a1d8d;hb=refs%2Fheads%2Fsarge;hpb=8e56a4fc26c4f805286ad5c62157cafbe37acc58 diff --git a/t-prot b/t-prot index 199daba..ee84667 100755 --- a/t-prot +++ b/t-prot @@ -1,13 +1,13 @@ #!/usr/bin/perl -w -# $Id: t-prot,v 1.222 2005/02/14 14:19:14 jochen Exp $ +# $Id: t-prot,v 1.236 2005/04/25 16:35:56 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.96'; +use constant VER => '1.101'; use constant REV => ''; -use constant REL => q$Revision: 1.222 $=~m/(\d+(?:\.\d+)+)/; +use constant REL => q$Revision: 1.236 $=~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'; @@ -24,8 +24,8 @@ use vars qw( $ad $ads $bigqn $bigqx $boun $check $check_ratio $cr $diff $elli $footers $ftr_ad $ftr_ml $hdrs $indent $kamm $kdiff $kminl $kmaxl $lax $lsig $maxsig $mda $ml $ms $ms_smart $msg_quote $msg_ratio - $mua $ofile $pgpshort $pgpmove $pgpmovevrf $sig $sigint $sign - $spass $spass_prefix $sysl $trad $trsp + $mua $nohdr $ofile $pgpshort $pgpmove $pgpmovevrf $sig $sigint + $sign $spass $spass_prefix $sysl $trad $trsp $gpg_WARNING $gpg_Warning $gpg_Cantcheck $gpg_aka $gpg_bad $gpg_expired $gpg_good $gpg_bug @@ -90,6 +90,8 @@ sub help { -A=DIRECTORY ad footer directory, treat ad footers as signature --bigq[=n[,x]] remove all but x lines of quotes with more than n lines; default is n=30 and x=10 + --body input has no headers; does not work with --pgp-short; + multipart messages will not be detected -c merge multiple blank lines --check[=FLAGS] check various criteria, print error message and quit; see man page for details @@ -143,9 +145,6 @@ sub sigint_handler { $sigint = 1; } -# esc(): escapes a scalar reference for use in perl regexp -sub esc { ${$_[0]} =~ s/([\[\]\(\)\*\.\-\^\$\@])/\\$1/go; } - # remove_footers(): remove any trailing appearance of footers contained # in the given directory. sub remove_footers { @@ -236,6 +235,7 @@ sub decomb { # underlining some part of the line above (using '^') # nor begin with a whitespace, # * the 1st line must not end with a hyphen, + # * the 2nd line must not indicate content was deleted, # * the 2nd line must not be some mutt(1) commentary, # * there must not be a valid word wrap to produce a longer # 1st line (if not quoted), @@ -251,6 +251,7 @@ sub decomb { ($$L[$x+1] !~ /^$/) && ($$L[$x+1] !~ /^[\s^]/) && ($$L[$x] !~ /-$/) && + ($$L[$x+1] !~ /^\Q[...]\E\s*$/) && ($mua ne 'mutt' || $$L[$x+1] !~ /^(?:\e.+?\a)?\[-- .* --]/) && (length($$L[$x])+index($$L[$x+1], ' ')>$max || (index($$L[$x+1], ' ')<0 && length($$L[$x])+length($$L[$x+1])>$max)) && @@ -310,11 +311,11 @@ sub pgp { my $ok = 0; while ($X<$Z) { - if ($$L[$X] =~ /^gpg:\s(?:$gpg_WARNING|$gpg_Warning|$gpg_bad|$gpg_Cantcheck|$gpg_expired)/o) + 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) { return 0; } - if ($$L[$X] =~ /^gpg:\s$gpg_bug/o) + if ($$L[$X] =~ /^gpg:\s\Q$gpg_bug/o) { return 0; } - if ($$L[$X] =~ /^gpg:\s$gpg_good/o) + if ($$L[$X] =~ /^gpg:\s\Q$gpg_good/o) { $ok = 1; } $X++; } @@ -332,33 +333,32 @@ sub pgp { for (my $x=0; $x1 && - $$L[$i] =~ /^gpg:\s$gpg_aka/o && $$L[$i] !~ /$from/) + $$L[$i] =~ /^gpg:\s\Q$gpg_aka/o && $$L[$i] !~ /\Q$from/) { splice(@$L, $i, 1); splice(@$V, $i, 1); $i--; } - elsif ($$L[$i]=~/^(?:\e.+?\a)?(?:$mutt_pgpoutend)/o) + elsif ($$L[$i]=~/^(?:\e.+?\a)?(?:\Q$mutt_pgpoutend\E)/o) { if ($pgpmove || ($pgpmovevrf && (!$sigint) && verified($L, $x+1, $i))) @@ -374,7 +374,7 @@ sub pgp { } } elsif ($tmp && - $$L[$x]=~/^(?:\e.+?\a)?(?:$mutt_pgpencrypted|$mutt_pgpclearsigned|$mutt_pgpsigned)/o) + $$L[$x]=~/^(?:\e.+?\a)?(?:\Q$mutt_pgpencrypted\E|\Q$mutt_pgpclearsigned\E|\Q$mutt_pgpsigned\E)/o) { splice(@$L, $x+1, 0, @{$tmp[$tmp]}); for (my $i=$x; $id diff ftr-ad ftr-ml help>h kminl=i'. - ' kmaxl=i kdiff=i lax-security locale=s ms-smart mua>M pgp-short'. - ' pgp-move pgp-move-vrf sigsmax:i spass version>v'); + ' s t v w bigq:s body check:s debug>d diff ftr-ad ftr-ml help>h'. + ' kminl=i kmaxl=i kdiff=i lax-security locale=s 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; } @@ -869,6 +876,7 @@ while (my ($opt, $val, $pretty) = nextOption()) { $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; @@ -923,6 +931,7 @@ while (my ($opt, $val, $pretty) = nextOption()) { 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(); } @@ -973,47 +982,27 @@ if ($mua eq 'mutt') { m/^([^%]*)/o; ($gpg_aka) = Locale::gettext::gettext((' 'x16).'aka "%s"') =~ - m/^(.*?)"/o; + m/^(.*?)["«%]/o; ($gpg_bad) = Locale::gettext::gettext('BAD signature from "%s"') =~ - m/^(.*?)"/o; + m/^(.*?)["«%]/o; ($gpg_expired) = Locale::gettext::gettext("Note: This key has expired!\n") =~ m/^(.*?)\n/mo; ($gpg_good) = Locale::gettext::gettext('Good signature from "%s"') =~ - m/^(.*?)"/o; + m/^(.*?)["«%]/o; ($gpg_bug) = Locale::gettext::gettext("... this is a bug (%s:%d:%s)\n") =~ m/^([^%]*)/o; } } - esc(\$mutt_attachment); - esc(\$mutt_contenttype); - esc(\$mutt_pgpsigned); - esc(\$mutt_beginsigned); - esc(\$mutt_pgpclearsigned); - esc(\$mutt_pgpclearsigstart); - esc(\$mutt_pgpencrypted); - esc(\$mutt_pgpoutstart); - esc(\$mutt_pgpoutend); - - esc(\$gpg_WARNING); - esc(\$gpg_Warning); - esc(\$gpg_Cantcheck); - esc(\$gpg_aka); - esc(\$gpg_bad); - esc(\$gpg_expired); - esc(\$gpg_good); - esc(\$gpg_bug); } else { if ($ms_smart || $pgpshort || $pgpmove || $pgpmovevrf) { help(); } } -esc(\$spass_prefix); - # Read message: if (!open(IN, $ifile)) { print STDERR "Could not open $ifile: $!\n"; exit(EX_IOERR); }