🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: news.software.nntp
Article #79692

Re: Cleanfeed Binary Checks

#79692
From: Matija Nalis
Date: Wed, 19 Nov 2008 13:53
76 lines
4026 bytes
On 2008-07-21, Julien ÉLIE <iulius@nom-de-mon-site.com.invalid> wrote:
> If you want to test that, you can use Frédéric's tester:
>
>     http://news.lacave.net/inn/cf_tester.pl

By the way, here is the patch which adds several new features to it
(also sent to the author):

- adds new standard headers introduced in INN 2.4.5 and soon-to-be-2.4.6

- allows user to specify one (or more) files on command line - in
  that case just those messages are checked in verbose mode (instead of
  running corpus check). Useful for debugging cleanfeed.local rules.

- adds suport for exit level of 0 if everything is ok (or > 0 if
  corpus test has failed)

--- orig/cf_tester.pl	2007-03-30 13:09:11.000000000 +0200
+++ cf_tester.pl	2008-11-17 19:26:45.000000000 +0100
@@ -39,7 +42,19 @@
           "Followup-To" => 1, "Organization" => 1, "Content-Type" => 1, "Content-Base" => 1,
           "Content-Disposition" => 1, "X-Newsreader" => 1, "X-Mailer" => 1,
           "X-Newsposter" => 1, "X-Cancelled-By" => 1, "X-Canceled-By" => 1,
-          "Cancel-Key" => 1, "User-Agent" => 1, "X-Original-Message-ID" => 1 );
+          "Cancel-Key" => 1, "User-Agent" => 1, "X-Original-Message-ID" => 1,
+          "Cancel-Lock" => 1, "Content-Transfer-Encoding" => 1, "Face" => 1,
+          "Injection-Info" => 1, "List-ID" => 1, "MIME-Version" => 1, "Originator" => 1,
+          # since innd 2.4.5 
+          "X-Auth" => 1, "X-Complaints-To" => 1, "X-Face" => 1, "X-HTTP-UserAgent" => 1,
+          "X-HTTP-Via" => 1, "X-Modbot" => 1, "X-Modtrace" => 1, "X-No-Archive" => 1,
+          "X-Original-Trace" => 1, "X-Originating-IP" => 1, "X-PGP-Key" => 1, 
+          "X-PGP-Sig" => 1, "X-Poster-Trace" => 1, "X-Postfilter" => 1, "X-Proxy-User" => 1,
+          "X-Submissions-To" => 1, "X-Usenet-Provider" => 1, "In-Reply-To" => 1,
+          "Injection-Date" => 1, "NNTP-Posting-Date" => 1, 
+          # since innd 2.4.6
+          "X-User-ID" => 1,"X-Auth-Sender" => 1, "X-Original-NNTP-Posting-Host" => 1,
+          "Original-Sender" => 1, "NNTP-Posting-Path" => 1 );
 
 # And rock'n'roll.  No user servicable parts below.
 require "cleanfeed.local";
@@ -48,6 +63,21 @@
 @r = (0, 0, 0,
       0, 0, 0);
 
+if (@ARGV) {
+  foreach my $f (@ARGV) {
+    %hdr = {};
+    cft_parse_art("$f");
+    my $r = filter_art();
+    print "$f : ";
+    if($r) {
+      print $r."\n";
+    } else {
+      print $r."accepted\n";
+    }
+  }
+  exit 0;
+}      
+
 foreach my $d (('corpus/good','corpus/bad')) {
   foreach my $f (<$d/*>) {
     %hdr = {};
@@ -76,6 +106,9 @@
 printf("\t".'TOTAL     : %4d ok, %4d bad,  %3d%%'."\n",$r[0] + $r[3], $r[1] + $r[4],
   (($r[0] + $r[3]) * 100/ ($r[2] + $r[5]))) if($r[2] + $r[5]);
 
+# return level - 0 if ok, otherwise number of bad checks. For use in makefile /mn/
+exit ($r[1] + $r[4]);
+
 sub cft_parse_art {
   my $fn=shift;
   my @l;


-- 
Opinions above are GNU-copylefted.
Technical Details
Message-ID: <slrngi86mo.k9h.mnalis-news@bukavac.carpriv.carnet.hr>
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!archive.pugleaf.net!archive.newsdeef.eu!mbox2nntp-news.software.nntp.20141118.mbox.gz!border1.nntp.ams.giganews.com!nntp.giganews.com!newsfeed.CARNet.hr!not-for-mail
References: <g61rme$nqb$1@news.mixmin.net> <g62e1h$ejc$1@news.trigofacile.com>

Show Full Headers
Complete Article Headers
Message-ID: <slrngi86mo.k9h.mnalis-news@bukavac.carpriv.carnet.hr>
Subject: Re: Cleanfeed Binary Checks
Date: Wed, 19 Nov 2008 13:53:25 +0000
From: Matija Nalis <mnalis-news@voyager.hr>
References: <g61rme$nqb$1@news.mixmin.net> <g62e1h$ejc$1@news.trigofacile.com>
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!archive.pugleaf.net!archive.newsdeef.eu!mbox2nntp-news.software.nntp.20141118.mbox.gz!border1.nntp.ams.giganews.com!nntp.giganews.com!newsfeed.CARNet.hr!not-for-mail
Newsgroups: news.software.nntp
Organization: CARNet, Croatia
Lines: 76
NNTP-Posting-Host: 161.53.12.138
Mime-Version: 1.0
Content-Type: text/plain; charset=ISO-8859-2
Content-Transfer-Encoding: 8bit
X-Trace: news1.carnet.hr 1227102805 9651 161.53.12.138 (19 Nov 2008 13:53:25
 GMT)
X-Complaints-To: abuse@CARNet.hr
NNTP-Posting-Date: Wed, 19 Nov 2008 13:53:25 +0000 (UTC)
User-Agent: slrn/0.9.8.1pl2.1 (Linux)
Cancel-Lock: sha1:2y+PEi++eQ5X3y6H0rT438ja3Ww=