X-Git-Url: https://git.deb.at/w?p=pkg%2Ft-prot.git;a=blobdiff_plain;f=contrib%2Ffilter_innd.pl;h=b7c8c449f792fb215b98ca1ecb75c53ca0f6b5fc;hp=dd6985a6d541a9fd33938e5727bf25c429b0f74a;hb=HEAD;hpb=3319969a89bb47afbd35da55d8c0d62a33be9ca7 diff --git a/contrib/filter_innd.pl b/contrib/filter_innd.pl index dd6985a..b7c8c44 100644 --- a/contrib/filter_innd.pl +++ b/contrib/filter_innd.pl @@ -1,5 +1,5 @@ -# $Id: filter_innd.pl,v 1.4 2004/10/10 20:26:24 jochen Exp $ -# Copyright (c) 2004 Jochen Striepe +# $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 # Perl filtering with INN2. It is NOT meant for production use. @@ -30,11 +30,18 @@ sub filter_art { my $rval = "" ; # Assume we'll accept. Cannot be `0' +# Here we only filter local.* news groups. Another useful idea is to +# filter just locally submitted articles: +# if (index($hdr{'Path'}, '!')<0) { if ($hdr{'Newsgroups'} =~ /^local\./) { my $foo = $hdr{'__BODY__'}; $foo =~ s/\r\n/\n/gs; - open(TMP, '/usr/bin/mktemp -q /tmp/INN2.tmp.XXXXXX | tr -d \'\n\'|') +# Note that here might be a security problem lurking. The directory +# used for temporary files should not be writable for anyone but the +# user INN runs as. As mentioned above, this example file is NOT +# meant for production use. + open(TMP, '/usr/bin/mktemp -q /tmp/INN2/tmp.XXXXXX | tr -d \'\n\'|') || return ''; my $f = ; close TMP; @@ -44,12 +51,12 @@ sub filter_art { print OUT $foo; close OUT; - open(IN, "/usr/bin/t-prot -m -t -p --check -i $f|") + open(IN, "/usr/bin/t-prot -m -t -p --body --check=ratio -i $f|") || goto FINISH; $rval = ; close IN; - FINISH: system('/bin/rm', $f); + FINISH: unlink($f); } $rval ;