From 7eb2d70aa363bf51546b17381ef90cff6126781a Mon Sep 17 00:00:00 2001 From: Gerfried Fuchs Date: Wed, 17 Feb 2010 20:55:11 +0100 Subject: [PATCH] Imported Upstream version 2.11 --- ChangeLog | 29 +++++++++++++++++++ contrib/filter_innd.pl | 4 +-- ...r1.267-gol.diff => t-prot-r1.269-gol.diff} | 22 +++++++------- t-prot | 18 ++++++------ t-prot.1 | 17 +++++------ 5 files changed, 60 insertions(+), 30 deletions(-) rename contrib/{t-prot-r1.267-gol.diff => t-prot-r1.269-gol.diff} (91%) diff --git a/ChangeLog b/ChangeLog index 636a147..a38d94c 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,32 @@ +2010-01-05 12:05 Jochen Striepe + + * t-prot: Release as v2.11. + +2010-01-05 12:01 Jochen Striepe + + * contrib/filter_innd.pl: Command line default has changed, check + flags must be set now. + +2010-01-05 11:46 Jochen Striepe + + * t-prot.1: Better explain ratio check value. + +2010-01-05 11:43 Jochen Striepe + + * t-prot.1: Update copyright time stamp. + +2010-01-05 11:42 Jochen Striepe + + * t-prot, t-prot.1: Fix initialization and command line parsing for + --check (this should work as advertised now). Make the ratio check + code a little easier to read. Add the default value for the ratio + check to the man page. + +2010-01-04 11:07 Jochen Striepe + + * t-prot.1: Remove URLs to example scripts and configs. The files + are provided with the package. + 2009-12-30 21:34 Jochen Striepe * t-prot, t-prot.1: Fix last commit, release as t-prot v2.10. diff --git a/contrib/filter_innd.pl b/contrib/filter_innd.pl index 4df4bb9..b7c8c44 100644 --- a/contrib/filter_innd.pl +++ b/contrib/filter_innd.pl @@ -1,4 +1,4 @@ -# $Id: filter_innd.pl,v 1.5 2005/04/15 14:07:11 jochen Exp $ +# $Id: filter_innd.pl,v 1.6 2010/01/05 12:01:13 jochen Exp $ # Copyright (c) 2004-2005 Jochen Striepe # # This file is provided as an example how t-prot can be used for @@ -51,7 +51,7 @@ sub filter_art { print OUT $foo; close OUT; - open(IN, "/usr/bin/t-prot -m -t -p --body --check -i $f|") + open(IN, "/usr/bin/t-prot -m -t -p --body --check=ratio -i $f|") || goto FINISH; $rval = ; close IN; diff --git a/contrib/t-prot-r1.267-gol.diff b/contrib/t-prot-r1.269-gol.diff similarity index 91% rename from contrib/t-prot-r1.267-gol.diff rename to contrib/t-prot-r1.269-gol.diff index 467ddf9..bef8f22 100644 --- a/contrib/t-prot-r1.267-gol.diff +++ b/contrib/t-prot-r1.269-gol.diff @@ -1,15 +1,15 @@ ---- t-prot 2009-12-30 22:34:16.000000000 +0100 -+++ t-prot-gol 2009-12-30 22:35:36.000000000 +0100 +--- 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.10'; + use constant VER => '2.11'; use constant REV => ''; - use constant REL => q$Revision: 1.267 $=~m/(\d+(?:\.\d+)+)/; -@@ -915,83 +915,82 @@ + 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 @@ -35,8 +35,9 @@ - elsif ($opt eq 'c') { $cr = 1; } - elsif ($opt eq 'check') { - $check = 1; -- while ($val && $val =~ s/^([^,\s]+)(?:,(\S+))?$/$2/) { +- while ($val && $val =~ /^([^,\s]+)(?:,(\S+))?$/) { - my $foo = $1; +- $val = $2; +if (!Getopt::Long::GetOptions( + 'a' => \$ad, + 'A=s' => \$ads, @@ -81,8 +82,8 @@ + help(); +} -- if ($foo =~ /^ratio=(0?\.\d+)$/) { -- $check_ratio = $1?$1:1; +- if ($foo =~ /^ratio(?:=(0?\.\d+))?$/) { +- $check_ratio = $1?$1:0.75; - } - } +# clean up temp vals: @@ -105,9 +106,10 @@ +if (defined $_t8) { $mda = $_t8 ? $_t8 : '1'; } +if (defined $_t9) { + $check = 1; -+ while ($_t9 && $_t9 =~ s/^([^,\s]+)(?:,(\S+))?$/$2/) { ++ while ($_t9 && $_t9 =~ /^([^,\s]+)(?:,(\S+))?$/) { + my $foo = $1; -+ if ($foo =~ /^ratio=(0?\.\d+)$/) { $check_ratio = $1?$1: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; } diff --git a/t-prot b/t-prot index e2b36cf..441cd90 100755 --- a/t-prot +++ b/t-prot @@ -1,13 +1,13 @@ #!/usr/bin/perl -w -# $Id: t-prot,v 1.267 2009/12/30 21:34:16 jochen Exp $ +# $Id: t-prot,v 1.269 2010/01/05 12:05:03 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.10'; +use constant VER => '2.11'; use constant REV => ''; -use constant REL => q$Revision: 1.267 $=~m/(\d+(?:\.\d+)+)/; +use constant REL => q$Revision: 1.269 $=~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'; @@ -54,7 +54,7 @@ $ftr_ad = undef; # too hard on performance to be default $ftr_ml = undef; # too hard on performance to be default $ofile = '-'; # use STDOUT if nothing is specified $spass_prefix = 'SPAM: '; -$check_ratio = .75; # 3/4 tofu is enough not to accept the message +$check_ratio = 0; # off by default $msg_quote = "Blocked by $0: This message has been rejected because of a full quote. Please see http://learn.to/quote/ and http://www.escape.de/users/tolot/mutt/ for more info. Have a nice day!\n"; $msg_ratio = "Blocked by $0: This message has been rejected because of excessive quoting. Please see http://learn.to/quote/ and http://www.escape.de/users/tolot/mutt/ for more info. Have a nice day!\n"; # end of user adjusted vals @@ -549,9 +549,8 @@ sub process_msg { if (index($$lines[$x], $indent)==0) { $y++; } } } - $y = $y/$z; - if ($y>=$check_ratio) { + if ($y/$z>=$check_ratio) { print $msg_ratio; exit EX_UNAVAILABLE; } @@ -934,11 +933,12 @@ while (my ($opt, $val, $pretty) = nextOption()) { elsif ($opt eq 'c') { $cr = 1; } elsif ($opt eq 'check') { $check = 1; - while ($val && $val =~ s/^([^,\s]+)(?:,(\S+))?$/$2/) { + while ($val && $val =~ /^([^,\s]+)(?:,(\S+))?$/) { my $foo = $1; + $val = $2; - if ($foo =~ /^ratio=(0?\.\d+)$/) { - $check_ratio = $1?$1:1; + if ($foo =~ /^ratio(?:=(0?\.\d+))?$/) { + $check_ratio = $1?$1:0.75; } } } diff --git a/t-prot.1 b/t-prot.1 index c905533..2d517c6 100644 --- a/t-prot.1 +++ b/t-prot.1 @@ -1,6 +1,6 @@ -.\" $Id: t-prot.1,v 1.139 2009/12/30 21:34:16 jochen Exp $ +.\" $Id: t-prot.1,v 1.143 2010/01/05 11:46:38 jochen Exp $ .\" -.TH T-PROT "1" "December 2009" "T-PROT" +.TH T-PROT "1" "January 2010" "T-PROT" .SH NAME t-prot \- TOFU Protection - Display Filter for RFC 2822 messages .SH SYNOPSIS @@ -21,11 +21,9 @@ 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 download a file to be included in your ~/.muttrc: -.I http://www.escape.de/users/tolot/mutt/t\-prot/muttrc.t\-prot -.br -And here is an example S-Lang macro to use t-prot from within slrn: -.I http://www.escape.de/users/tolot/mutt/t\-prot/t\-prot.sl +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. .SH OPTIONS .TP .BR "\-A" =DIRECTORY @@ -89,7 +87,8 @@ following (right now just one flag): .IR ratio [=n] .br If the quoting ratio is n or more, the message is rejected. Must be -between 0 and 1, or else it is entirely disabled. +between 0 and 1, or else it is entirely disabled. Default is 0.75 +(i.e., three quarters are quoted). .TP .B "\-d, \-\-debug" "debug": @@ -556,7 +555,7 @@ Written by Jochen Striepe . All of the documentation and software included in the t-prot releases is copyrighted by Jochen Striepe (except when explicitly stated otherwise). .PP -Copyright \(co 2001-2009 Jochen Striepe. All rights reserved. +Copyright \(co 2001-2010 Jochen Striepe. All rights reserved. .PP Redistribution and use, with or without modification, are permitted provided that the following conditions are met: -- 2.39.2