From be81225823f000a965985749c6ea8837e31b23f3 Mon Sep 17 00:00:00 2001 From: Gerfried Fuchs Date: Wed, 17 Feb 2010 21:00:00 +0100 Subject: [PATCH] Imported Upstream version 2.14 --- ChangeLog | 25 +++++++++++++++ NEWS | 25 --------------- README | 31 +++++++++++++++++-- ...t1512.diff => t-prot-r1.279-mutt1512.diff} | 28 ++++++++--------- ...r1.276-gol.diff => t-prot-r1.280-gol.diff} | 12 +++---- t-prot | 30 ++++++++---------- t-prot.1 | 13 +++++--- 7 files changed, 95 insertions(+), 69 deletions(-) delete mode 100644 NEWS rename contrib/{t-prot-r1.246-mutt1512.diff => t-prot-r1.279-mutt1512.diff} (92%) rename contrib/{t-prot-r1.276-gol.diff => t-prot-r1.280-gol.diff} (96%) 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.279-mutt1512.diff similarity index 92% rename from contrib/t-prot-r1.246-mutt1512.diff rename to contrib/t-prot-r1.279-mutt1512.diff index 0277ba8..a1d3d43 100644 --- a/contrib/t-prot-r1.246-mutt1512.diff +++ b/contrib/t-prot-r1.279-mutt1512.diff @@ -1,5 +1,5 @@ ---- t-prot 2006-06-18 00:45:55.000000000 +0200 -+++ t-prot-M1511 2006-07-11 14:22:56.000000000 +0200 +--- 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 @@ -9,7 +9,7 @@ ); -@@ -69,6 +69,8 @@ +@@ -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 --]'; @@ -18,7 +18,7 @@ # set the defaults to the C locale $gpg_WARNING = 'WARNING: '; -@@ -336,7 +338,7 @@ +@@ -342,7 +344,7 @@ for (my $x=0; $x '2.13'; + use constant VER => '2.14'; use constant REV => ''; - use constant REL => q$Revision: 1.276 $=~m/(\d+(?:\.\d+)+)/; -@@ -916,84 +916,83 @@ + 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 @@ -167,7 +167,7 @@ if ($mua eq 'mutt') { if (defined $locale && $locale ne '' && $locale ne 'C' && $locale ne 'POSIX') { -@@ -1058,6 +1057,13 @@ +@@ -1055,6 +1054,13 @@ } elsif ($ms_smart || $pgpshort || $pgpmove || $pgpmovevrf) { help(); } 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 : -- 2.39.2