Andreas Gunleikskaas <[EMAIL PROTECTED]> wrote:

> Is it safe to upgrade SpamAssassin to the newest version 2.60?
> ...without doing any change to the plugin?

I got it set up this week.  I started with the patch provided by 
Peter J Holzer in http://nntp.x.perl.org/group/perl.qpsmtpd/503
(garbled by QP encoding) and made some more changes, mainly to
get the headers as I wanted them and add the score to the
subject munging.  It's working for me now.  Not sure if it'll be
useful to you, since you're already using the plugin, but here's
the patch against qpsmtpd 0.27:

===================================================================
--- spamassassin        2003/09/29 21:48:17     1.1
+++ spamassassin        2003/10/04 01:27:54
@@ -102,7 +102,7 @@
   
   $transaction->body_resetpos;
   
-  print SPAMD "REPORT_IFSPAM SPAMC/1.0" . CRLF;
+  print SPAMD "SYMBOLS SPAMC/1.0" . CRLF;
   # or CHECK or REPORT or SYMBOLS
 
   print SPAMD join CRLF, split /\n/, $transaction->header->as_string
@@ -124,17 +124,22 @@
     $transaction->header->add("X-Spam-Check-By", $self->qp->config('me'));
   }
 
+  my ($flag, $hits, $required);
   while (<SPAMD>) {
     #warn "GOT FROM SPAMD1: $_";
-    next unless m/\S/;
-    s/\r?\n$/\n/;
-    my @h = split /: /, $_, 2;
-
-    $transaction->header->add(@h);
-    last if $h[0] eq "Spam" and $h[1] =~ m/^False/;
-
+    last unless m/\S/;
+    if (m{Spam: (\w+) ; (-?\d+\.\d) / (-?\d+\.\d)}) {
+      ($flag, $hits, $required) = ($1, $2, $3);
+    }
   }
 
+  my $tests = <SPAMD> || '';
+  $tests =~ s/\s+$//;
+  $self->log(5, "$flag, hits=$hits, required=$required, tests=$tests") if $tests;
+  $tests =~ s/(.{1,50}),/$1,\n\t/g; # wrap
+  $transaction->header->add('X-Spam-Status', "$flag, hits=$hits 
required=$required" .
+    ( $tests ? "\n\ttests=$tests" : '' ) );
+
   return (DECLINED);
 }
 
@@ -157,7 +162,9 @@
   return DECLINED unless $score >= $self->{_args}->{munge_subject_threshold};
 
   my $subject = $transaction->header->get('Subject') || '';
-  $transaction->header->replace('Subject', "***SPAM*** $subject");
+  $subject = sprintf('@SPAM(%05.2f) %s', $score, $subject);
+  $self->log(5, qq(munging subject to "$subject"));
+  $transaction->header->replace('Subject', $subject);
 
   return DECLINED;
 }
===================================================================

You'll also want to patch spamd, to keep its log from filling
up with warnings about an uninitialized value on line 707.
Just change

last if ($actual_length == $expected_length);

to

last if $expected_length && ($actual_length == $expected_length);

-- 
Keith C. Ivey <[EMAIL PROTECTED]>
Washington, DC

Reply via email to