From d6fc6da68020f73af04713140c0d760223131515 Mon Sep 17 00:00:00 2001 From: Gerfried Fuchs Date: Tue, 18 May 2010 21:26:27 +0200 Subject: [PATCH] Imported Upstream version 2.98 --- ChangeLog | 26 +++++++++++++++++++++ t-prot | 70 +++++++++++++++++++++++++++---------------------------- t-prot.1 | 24 +++++++++++-------- 3 files changed, 75 insertions(+), 45 deletions(-) diff --git a/ChangeLog b/ChangeLog index 23d7466..402054b 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,29 @@ +2010-04-09 06:47 Jochen Striepe + + * t-prot: Release as v2.98. + +2010-04-09 06:45 Jochen Striepe + + * t-prot.1: Clarify --lax-security description. + +2010-04-09 06:36 Jochen Striepe + + * t-prot: Use descriptive temp variable names when parsing command + line. + +2010-03-06 12:26 Jochen Striepe + + * t-prot.1: Mention configuration files for Heirloom mailx and + metamail. Avoid false impression with --lax-security. + +2010-03-06 10:51 Jochen Striepe + + * t-prot.1: Another Typo. + +2010-03-06 09:19 Jochen Striepe + + * t-prot.1: Fix spelling error. Thanks to Gerfried Fuchs! + 2010-03-06 01:32 Jochen Striepe * t-prot: Release as v2.97. diff --git a/t-prot b/t-prot index 1d51b3b..fb3029f 100755 --- a/t-prot +++ b/t-prot @@ -1,13 +1,13 @@ #!/usr/bin/perl -w -# $Id: t-prot,v 1.298 2010/03/06 01:32:50 jochen Exp $ +# $Id: t-prot,v 1.300 2010/04/09 06:47:11 jochen Exp $ require 5.006; use strict; use Fcntl qw(O_EXCL O_WRONLY O_CREAT); use Getopt::Long qw(:config gnu_getopt no_ignore_case); -use constant VER => '2.97'; +use constant VER => '2.98'; use constant REV => ''; -use constant REL => q$Revision: 1.298 $=~m/(\d+(?:\.\d+)+)/; +use constant REL => q$Revision: 1.300 $=~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'; @@ -999,87 +999,87 @@ my $locale = $ENV{'LC_ALL'}?$ENV{'LC_ALL'}: my $ifile = '-'; # use STDIN if nothing specified # temp vals: -my ($_t1, $_t2, $_t3, $_t4, $_t5, $_t6, $_t7, $_t8, $_t9, $_ta, $_tb, $_tc, - $_td) = undef; +my ($_t_bigq, $_t_help, $_t_kminl, $_t_kmaxl, $_t_kdiff, $_t_maxsig, $_t_mua, + $_t_redir, $_t_check, $_t_sigsmax, $_t_ver, $_t_nohdr, $_t_cr) = undef; # get command line params: if (!Getopt::Long::GetOptions( 'a' => \$ad, 'A=s' => \$ads, - 'bigq:s' => \$_t1, - 'body' => \$_tc, - 'c:i' => \$_td, - 'check:s' => \$_t9, + 'bigq:s' => \$_t_bigq, + 'body' => \$_t_nohdr, + 'c:i' => \$_t_cr, + 'check:s' => \$_t_check, 'debug|d' => \$sysl, 'diff' => \$diff, 'e' => \$elli, 'ftr-ad' => \$ftr_ad, 'ftr-ml' => \$ftr_ml, 'groupwise' => \$gw, - 'help|h' => \$_t2, + 'help|h' => \$_t_help, 'i=s' => \$ifile, 'k' => \$kamm, - 'kminl=i' => \$_t3, - 'kmaxl=i' => \$_t4, - 'kdiff=i' => \$_t5, + 'kminl=i' => \$_t_kminl, + 'kmaxl=i' => \$_t_kmaxl, + 'kdiff=i' => \$_t_kdiff, 'L=s' => \$footers, 'l' => \$ml, 'lax-security' => \$lax, 'locale=s' => \$locale, 'max-lines:i' => \$maxlines, 'ms-smart' => \$ms_smart, - 'mua|M=s' => \$_t7, + 'mua|M=s' => \$_t_mua, 'm' => \$ms, 'o=s' => \$ofile, 'P=s' => \$boun, - 'p:s' => \$_t8, + 'p:s' => \$_t_redir, 'pgp-short' => \$pgpshort, 'pgp-move' => \$pgpmove, 'pgp-move-vrf' => \$pgpmovevrf, 'r' => \$hdrs, 'reply' => \$reply, - 'S:i' => \$_t6, + 'S:i' => \$_t_maxsig, 's' => \$sig, 'sani' => \$sani, - 'sigsmax:i' => \$_ta, + 'sigsmax:i' => \$_t_sigsmax, 'spass' => \$spass, 't' => \$trad, - 'version|v' => \$_tb, + 'version|v' => \$_t_ver, 'w' => \$trsp )) { help(); } # clean up temp vals: -if (defined $_t1) { - if ($_t1 !~ /^(?:(\d+)(?:,(\d+))?)?$/) { help(); } +if (defined $_t_bigq) { + if ($_t_bigq !~ /^(?:(\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); +if (defined $_t_help) { help(); } +if (defined $_t_kminl) { $kminl = $_t_kminl; $kamm = 1; } +if (defined $_t_kmaxl) { $kmaxl = $_t_kmaxl; $kamm = 1; } +if (defined $_t_kdiff) { $kdiff = $_t_kdiff; $kamm = 1; } +if (defined $_t_maxsig) { $lsig = $_t_maxsig ? $_t_maxsig : $maxsig; } +if (defined $_t_mua) { + $mua = lc($_t_mua); # 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) { +if (defined $_t_redir) { $mda = $_t_redir ? $_t_redir : '1'; } +if (defined $_t_check) { $check = 1; - while ($_t9 && $_t9 =~ /^([^,\s]+)(?:,(\S+))?$/) { + while ($_t_check && $_t_check =~ /^([^,\s]+)(?:,(\S+))?$/) { my $foo = $1; - $_t9 = $2; + $_t_check = $2; if ($foo =~ /^ratio(?:=(0?\.\d+))?$/) { $check_ratio = $1?$1:0.75; } } } -if (defined $_ta) { $sign = $_ta ? $_ta : undef; } -if (defined $_tb) { version(); } -if (defined $_tc) { $nohdr=1; $hdrs=1; } -if (defined $_td) { $cr = $_td ? $_td : $crshrink; } +if (defined $_t_sigsmax) { $sign = $_t_sigsmax ? $_t_sigsmax : undef; } +if (defined $_t_ver) { version(); } +if (defined $_t_nohdr) { $nohdr=1; $hdrs=1; } +if (defined $_t_cr) { $cr = $_t_cr ? $_t_cr : $crshrink; } if ($ms_smart) { $ms = 1; } if ($mua eq 'mutt') { diff --git a/t-prot.1 b/t-prot.1 index 6ee7930..7a328f8 100644 --- a/t-prot.1 +++ b/t-prot.1 @@ -1,6 +1,6 @@ -.\" $Id: t-prot.1,v 1.178 2010/03/06 01:31:33 jochen Exp $ +.\" $Id: t-prot.1,v 1.182 2010/04/09 06:45:35 jochen Exp $ .\" -.TH T-PROT "1" "March 2010" "T-PROT" +.TH T-PROT "1" "April 2010" "T-PROT" .SH NAME t-prot \- TOFU Protection - Display Filter for RFC 5322 messages .SH SYNOPSIS @@ -25,15 +25,17 @@ initially designed to cope with the output of the MUA mutt (which is the reason for not using standard CPAN modules for handling 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. 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). +T\-prot offers example configuration files for mutt, Heirloom mailx +and metamail. Also coming with the t-prot package is the example +S-Lang 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. For use with sendmail's +alias(5) file, please see below (the option +.BR "\-p" " provides an example line)." .SH OPTIONS .PP If you do not specify any options, t\-prot does ... nothing. Every -feature you want must be turned on explicitely. +feature you want must be turned on explicitly. Admittedly, we have quite a number of options for t\-prot. To limit confusion they are grouped into five sections: Input/Output Options, Advertisement And Mailing List Footers, Filtering Options, Detection @@ -71,7 +73,9 @@ and should NEVER be used as a default, otherwise it will probably turn into a security issue.) .sp You can use this option safely to enable -.BR "\-o" " /dev/null." +.B "\-o" +/dev/null (or other files which cannot be changed with the user's +privileges). .TP .BR "\-\-max\-lines" =x Maximum number of lines a message may count (with headers). If the message @@ -424,7 +428,7 @@ If we really find some TOFU, abort with exit code Otherwise redirect the message to ADDRESS if given. .sp Intended for use from within mail delivery agents (MDAs) or mail transport -agents (MTAs), or even from with INN, so the message bounces if TOFU is +agents (MTAs), or even from within INN, so the message bounces if TOFU is detected, and does not get on *your* nerves. :) .sp As an example for usage with -- 2.39.2