w00t!  Exactly!  Saved me some scripting time.

-Jason

Steve wrote:
-------- Original-Nachricht --------
Datum: Thu, 08 Nov 2007 07:33:19 -0800
Von: Jason Axley <[EMAIL PROTECTED]>
An: [email protected]
Betreff: [dspam-users] dspam_train actually is delivering the spam emails?

I've set up a script to run dspam_train on some ham and spam and it seems as if the arguments to dspam used by this script actually cause dspam to _deliver_ the emails to the recipients again. Is it supposed to be doing this? I'm going to probably look into changing how it calls dspam so that it doesn't do this since it impacts all of my users when I retrain. I'm also going to submit an unrelated patch to fix its error handling so that it won't treat one dspam call failure as a fatal error condition.

Anyone else have these problems with this script?

Yes. Me. I use this own made patch:

dspam-3.8.0-dspam_train.patch:
------------------------------

--- src/tools/dspam_train.in    2006-05-23 21:52:40.000000000 +0200
+++ src/tools/dspam_train.in.new        2007-09-24 21:53:29.386167177 +0200
@@ -123,7 +123,7 @@
     my($code, $cmd, $response);
     my($dir, $msg) = @_;
     print "[test: nonspam] " . substr($msg . " " x 32, 0, 32) .  " result: ";
-    $cmd = "$CONFIG{'DSPAM_BINARY'} --user $USER --deliver=summary < 
'$dir/$msg'";
+    $cmd = "$CONFIG{'DSPAM_BINARY'} --user $USER --deliver=summary --stdout < 
'$dir/$msg'";
     $response = `$cmd`;

     $code = "UNKNOWN";
@@ -131,10 +131,12 @@
         $code = $1;
     }
     if ($code eq "UNKNOWN") {
-        print "\n===== WOAH THERE =====\n";
-        print "I was unable to parse the result. Test Broken.\n";
-        print "======================\n";
-        exit(0);
+        # print "\n===== WOAH THERE =====\n";
+        # print "I was unable to parse the result. Test Broken.\n";
+        # print "======================\n";
+        # exit(0);
+        print "BROKEN result!!\n";
+        return;
     }

     if ($code eq "Innocent" || $code eq "Whitelisted") {
@@ -144,16 +146,21 @@
         my($signature) = "UNKNOWN";
         if ($response =~ /class="(\S+)"/i) {
             $class = $1;
+        } else {
+            print "BROKEN class!!\n";
+            return;
         }

         if ($response =~ /signature=(\S+)/i) {
             $signature = $1;
         } else {
-            print "\n===== WOAH THERE =====\n";
-            print "I was unable to find the DSPAM signature. Test Broken.\n";
-            print "======================\n";
-            print "\n$response\n";
-            exit(0);
+            # print "\n===== WOAH THERE =====\n";
+            # print "I was unable to find the DSPAM signature. Test Broken.\n";
+            # print "======================\n";
+            # print "\n$response\n";
+            # exit(0);
+            print "BROKEN signature!!\n";
+            return;
         }

         print "FAIL ($class)";
@@ -182,7 +189,7 @@
     my($dir, $msg) = @_;

     print "[test: spam   ] " . substr($msg . " " x 32, 0, 32) . " result: ";
-    $cmd = "$CONFIG{'DSPAM_BINARY'} --user $USER --deliver=summary < 
'$dir/$msg'";
+    $cmd = "$CONFIG{'DSPAM_BINARY'} --user $USER --deliver=summary --stdout < 
'$dir/$msg'";
     $response = `$cmd`;

     $code = "UNKNOWN";
@@ -190,29 +197,36 @@
         $code = $1;
     }
     if ($code eq "UNKNOWN") {
-        print "\n===== WOAH THERE =====\n";
-        print "I was unable to parse the result. Test Broken.\n";
-        print "======================\n";
-        exit(0);
+        # print "\n===== WOAH THERE =====\n";
+        # print "I was unable to parse the result. Test Broken.\n";
+        # print "======================\n";
+        # exit(0);
+        print "BROKEN result!!\n";
+        return;
     }

-    if ($code eq "Spam") {
+    if ($code eq "Spam" || $code eq "Blacklisted") {
         print "PASS";
     } else {
         my($class) = "UNKNOWN";
         my($signature) = "UNKNOWN";
         if ($response =~ /class="(\S+)"/i) {
             $class = $1;
+        } else {
+            print "BROKEN class!!\n";
+            return;
         }

         if ($response =~ /signature=(\S+)/i) {
             $signature = $1;
         } else {
-            print "\n===== WOAH THERE =====\n";
-            print "I was unable to find the DSPAM signature. Test Broken.\n";
-            print "======================\n";
-            print "\n$response\n";
-            exit(0);
+            # print "\n===== WOAH THERE =====\n";
+            # print "I was unable to find the DSPAM signature. Test Broken.\n";
+            # print "======================\n";
+            # print "\n$response\n";
+            # exit(0);
+            print "BROKEN signature!!\n";
+            return;
         }
         print "FAIL ($class)";




-Jason

// Steve






!DSPAM:394,47355aaf296757734219047!

Reply via email to