You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@spamassassin.apache.org by fe...@apache.org on 2005/12/18 01:29:25 UTC

svn commit: r357409 - in /spamassassin/branches/tvd-evaltoplugin/lib/Mail: ./ SpamAssassin/Plugin/

Author: felicity
Date: Sat Dec 17 16:29:20 2005
New Revision: 357409

URL: http://svn.apache.org/viewcvs?rev=357409&view=rev
Log:
fix up more found issues

Modified:
    spamassassin/branches/tvd-evaltoplugin/lib/Mail/SpamAssassin.pm
    spamassassin/branches/tvd-evaltoplugin/lib/Mail/SpamAssassin/Plugin/Bayes.pm
    spamassassin/branches/tvd-evaltoplugin/lib/Mail/SpamAssassin/Plugin/BodyEval.pm
    spamassassin/branches/tvd-evaltoplugin/lib/Mail/SpamAssassin/Plugin/DNSEval.pm
    spamassassin/branches/tvd-evaltoplugin/lib/Mail/SpamAssassin/Plugin/HeaderEval.pm
    spamassassin/branches/tvd-evaltoplugin/lib/Mail/SpamAssassin/Plugin/MIMEEval.pm
    spamassassin/branches/tvd-evaltoplugin/lib/Mail/SpamAssassin/Plugin/RelayEval.pm
    spamassassin/branches/tvd-evaltoplugin/lib/Mail/SpamAssassin/Plugin/URIEval.pm
    spamassassin/branches/tvd-evaltoplugin/lib/Mail/SpamAssassin/Plugin/WLBLEval.pm

Modified: spamassassin/branches/tvd-evaltoplugin/lib/Mail/SpamAssassin.pm
URL: http://svn.apache.org/viewcvs/spamassassin/branches/tvd-evaltoplugin/lib/Mail/SpamAssassin.pm?rev=357409&r1=357408&r2=357409&view=diff
==============================================================================
--- spamassassin/branches/tvd-evaltoplugin/lib/Mail/SpamAssassin.pm (original)
+++ spamassassin/branches/tvd-evaltoplugin/lib/Mail/SpamAssassin.pm Sat Dec 17 16:29:20 2005
@@ -1179,7 +1179,7 @@
   my $mail = $self->parse(\@testmsg, 1);
   my $status = Mail::SpamAssassin::PerMsgStatus->new($self, $mail,
                         { disable_auto_learning => 1 } );
-  $status->word_is_in_dictionary("aba"); # load triplets.txt into memory
+
   # We want to turn off the bayes rules for this test msg
   my $use_bayes_rules_value = $self->{conf}->{use_bayes_rules};
   $self->{conf}->{use_bayes_rules} = 0;

Modified: spamassassin/branches/tvd-evaltoplugin/lib/Mail/SpamAssassin/Plugin/Bayes.pm
URL: http://svn.apache.org/viewcvs/spamassassin/branches/tvd-evaltoplugin/lib/Mail/SpamAssassin/Plugin/Bayes.pm?rev=357409&r1=357408&r2=357409&view=diff
==============================================================================
--- spamassassin/branches/tvd-evaltoplugin/lib/Mail/SpamAssassin/Plugin/Bayes.pm (original)
+++ spamassassin/branches/tvd-evaltoplugin/lib/Mail/SpamAssassin/Plugin/Bayes.pm Sat Dec 17 16:29:20 2005
@@ -45,21 +45,21 @@
 
   return 0 if (!$pms->{conf}->{use_bayes} || !$pms->{conf}->{use_bayes_rules});
 
-  if (!exists ($self->{bayes_score})) {
-    $self->{bayes_score} = $self->{main}->{bayes_scanner}->scan ($pms, $pms->{msg});
+  if (!exists ($pms->{bayes_score})) {
+    $pms->{bayes_score} = $self->{main}->{bayes_scanner}->scan ($pms, $pms->{msg});
   }
 
-  if (defined $self->{bayes_score} &&
-      ($min == 0 || $self->{bayes_score} > $min) &&
-      ($max eq "undef" || $self->{bayes_score} <= $max))
+  if (defined $pms->{bayes_score} &&
+      ($min == 0 || $pms->{bayes_score} > $min) &&
+      ($max eq "undef" || $pms->{bayes_score} <= $max))
   {
       if ($pms->{conf}->{detailed_bayes_score}) {
         $pms->test_log(sprintf ("score: %3.4f, hits: %s",
-                                 $self->{bayes_score},
-                                 $self->{bayes_hits}));
+                                 $pms->{bayes_score},
+                                 $pms->{bayes_hits}));
       }
       else {
-        $pms->test_log(sprintf ("score: %3.4f", $self->{bayes_score}));
+        $pms->test_log(sprintf ("score: %3.4f", $pms->{bayes_score}));
       }
       return 1;
   }

Modified: spamassassin/branches/tvd-evaltoplugin/lib/Mail/SpamAssassin/Plugin/BodyEval.pm
URL: http://svn.apache.org/viewcvs/spamassassin/branches/tvd-evaltoplugin/lib/Mail/SpamAssassin/Plugin/BodyEval.pm?rev=357409&r1=357408&r2=357409&view=diff
==============================================================================
--- spamassassin/branches/tvd-evaltoplugin/lib/Mail/SpamAssassin/Plugin/BodyEval.pm (original)
+++ spamassassin/branches/tvd-evaltoplugin/lib/Mail/SpamAssassin/Plugin/BodyEval.pm Sat Dec 17 16:29:20 2005
@@ -17,6 +17,7 @@
 package Mail::SpamAssassin::Plugin::BodyEval;
 
 use Mail::SpamAssassin::Plugin;
+use Mail::SpamAssassin::Logger;
 use Mail::SpamAssassin::Constants qw(:sa);
 
 use strict;
@@ -46,11 +47,11 @@
 }
 
 sub check_unique_words {
-  my ($self, undef, $body, $m, $b) = @_;
+  my ($self, $pms, $body, $m, $b) = @_;
 
-  if (!defined $self->{unique_words_repeat}) {
-    $self->{unique_words_repeat} = 0;
-    $self->{unique_words_unique} = 0;
+  if (!defined $pms->{unique_words_repeat}) {
+    $pms->{unique_words_repeat} = 0;
+    $pms->{unique_words_unique} = 0;
     my %count;
     for (@$body) {
       # copy to avoid changing @$body
@@ -64,13 +65,13 @@
         $count{$token}++;
       }
     }
-    $self->{unique_words_unique} = scalar grep { $_ == 1 } values(%count);
-    $self->{unique_words_repeat} = scalar keys(%count) - $self->{unique_words_unique};
+    $pms->{unique_words_unique} = scalar grep { $_ == 1 } values(%count);
+    $pms->{unique_words_repeat} = scalar keys(%count) - $pms->{unique_words_unique};
   }
 
   # y = mx+b where y is number of unique words needed
-  my $unique = $self->{unique_words_unique};
-  my $repeat = $self->{unique_words_repeat};
+  my $unique = $pms->{unique_words_unique};
+  my $repeat = $pms->{unique_words_repeat};
   my $y = ($unique + $repeat) * $m + $b;
   return ($unique > $y);
 }
@@ -78,10 +79,10 @@
 sub multipart_alternative_difference {
   my ($self, $pms, $fulltext, $min, $max) = @_;
 
-  $self->_multipart_alternative_difference($pms->{msg}) unless (exists $self->{madiff});
+  $self->_multipart_alternative_difference($pms) unless (exists $pms->{madiff});
 
-  if (($min == 0 || $self->{madiff} > $min) &&
-      ($max eq "undef" || $self->{madiff} <= $max)) {
+  if (($min == 0 || $pms->{madiff} > $min) &&
+      ($max eq "undef" || $pms->{madiff} <= $max)) {
       return 1;
   }
   return 0;
@@ -89,16 +90,18 @@
 
 sub multipart_alternative_difference_count {
   my ($self, $pms, $fulltext, $ratio, $minhtml) = @_;
-  $self->_multipart_alternative_difference($pms->{msg}) unless (exists $self->{madiff});
-  return 0 unless $self->{madiff_html} > $minhtml;
-  return(($self->{madiff_text} / $self->{madiff_html}) > $ratio);
+  $self->_multipart_alternative_difference($pms) unless (exists $pms->{madiff});
+  return 0 unless $pms->{madiff_html} > $minhtml;
+  return(($pms->{madiff_text} / $pms->{madiff_html}) > $ratio);
 }
 
 sub _multipart_alternative_difference {
-  my ($self, $msg) = @_;
-  $self->{madiff} = 0;
-  $self->{madiff_html} = 0;
-  $self->{madiff_text} = 0;
+  my ($self, $pms) = @_;
+  $pms->{madiff} = 0;
+  $pms->{madiff_html} = 0;
+  $pms->{madiff_text} = 0;
+
+  my $msg = $pms->{msg};
 
   # Find all multipart/alternative parts in the message
   my @ma = $msg->find_parts(qr@^multipart/alternative\b@i);
@@ -142,7 +145,7 @@
         }
 
 	# If there are no words, mark if there's at least 1 image ...
-	if (keys %html == 0 && exists $self->{html}{inside}{img}) {
+	if (keys %html == 0 && exists $pms->{html}{inside}{img}) {
 	  # Use "\n" as the mark since it can't ever occur normally
 	  $html{"\n"}=1;
 	}
@@ -159,9 +162,9 @@
     my $orig = keys %html;
     next if ($orig == 0);
 
-    $self->{madiff_html} = $orig;
-    $self->{madiff_text} = keys %text;
-    dbg('eval: text words: ' . $self->{madiff_text} . ', html words: ' . $self->{madiff_html});
+    $pms->{madiff_html} = $orig;
+    $pms->{madiff_text} = keys %text;
+    dbg('eval: text words: ' . $pms->{madiff_text} . ', html words: ' . $pms->{madiff_html});
 
     # If the token appears at least as many times in the text part as
     # in the html part, remove it from the list of html tokens.
@@ -176,9 +179,9 @@
     # a 0% difference rate.  Calculate it here, and record the difference
     # if it's been the highest so far in this message.
     my $diff = scalar(keys %html)/$orig*100;
-    $self->{madiff} = $diff if ($diff > $self->{madiff});
+    $pms->{madiff} = $diff if ($diff > $pms->{madiff});
 
-    dbg("eval: " . sprintf "madiff: left: %d, orig: %d, max-difference: %0.2f%%", scalar(keys %html), $orig, $self->{madiff});
+    dbg("eval: " . sprintf "madiff: left: %d, orig: %d, max-difference: %0.2f%%", scalar(keys %html), $orig, $pms->{madiff});
   }
 
   return;
@@ -192,7 +195,7 @@
     $minlines = 1;
   }
 
-  if (! exists $self->{blank_line_ratio}->{$minlines}) {
+  if (! exists $pms->{blank_line_ratio}->{$minlines}) {
     $fulltext = $pms->get_decoded_body_text_array();
     my ($blank) = 0;
     if (scalar @{$fulltext} >= $minlines) {
@@ -200,15 +203,16 @@
         next if ($line =~ /\S/);
         $blank++;
       }
-      $self->{blank_line_ratio}->{$minlines} = 100 * $blank / scalar @{$fulltext};
+      $pms->{blank_line_ratio}->{$minlines} = 100 * $blank / scalar @{$fulltext};
     }
     else {
-      $self->{blank_line_ratio}->{$minlines} = -1; # don't report if it's a blank message ...
+      $pms->{blank_line_ratio}->{$minlines} = -1; # don't report if it's a blank message ...
     }
   }
 
-  return (($min == 0 && $self->{blank_line_ratio}->{$minlines} <= $max) ||
-	  ($self->{blank_line_ratio}->{$minlines} > $min &&
-	   $self->{blank_line_ratio}->{$minlines} <= $max));
+  return (($min == 0 && $pms->{blank_line_ratio}->{$minlines} <= $max) ||
+	  ($pms->{blank_line_ratio}->{$minlines} > $min &&
+	   $pms->{blank_line_ratio}->{$minlines} <= $max));
 }
+
 1;

Modified: spamassassin/branches/tvd-evaltoplugin/lib/Mail/SpamAssassin/Plugin/DNSEval.pm
URL: http://svn.apache.org/viewcvs/spamassassin/branches/tvd-evaltoplugin/lib/Mail/SpamAssassin/Plugin/DNSEval.pm?rev=357409&r1=357408&r2=357409&view=diff
==============================================================================
--- spamassassin/branches/tvd-evaltoplugin/lib/Mail/SpamAssassin/Plugin/DNSEval.pm (original)
+++ spamassassin/branches/tvd-evaltoplugin/lib/Mail/SpamAssassin/Plugin/DNSEval.pm Sat Dec 17 16:29:20 2005
@@ -17,6 +17,7 @@
 package Mail::SpamAssassin::Plugin::DNSEval;
 
 use Mail::SpamAssassin::Plugin;
+use Mail::SpamAssassin::Logger;
 use Mail::SpamAssassin::Constants qw(:ip);
 
 use strict;
@@ -70,11 +71,11 @@
 sub check_rbl_accreditor {
   my ($self, $pms, $rule, $set, $rbl_server, $subtest, $accreditor) = @_;
 
-  if (!defined $self->{accreditor_tag}) {
-    $self->message_accreditor_tag($pms);
+  if (!defined $pms->{accreditor_tag}) {
+    $pms->message_accreditor_tag($pms);
   }
-  if ($self->{accreditor_tag}->{$accreditor}) {
-    $self->check_rbl_backend($pms, $rule, $set, $rbl_server, 'A', $subtest);
+  if ($pms->{accreditor_tag}->{$accreditor}) {
+    $pms->check_rbl_backend($pms, $rule, $set, $rbl_server, 'A', $subtest);
   }
   return 0;
 }
@@ -112,7 +113,7 @@
       }
     }
   }
-  $self->{accreditor_tag} = \%acctags;
+  $pms->{accreditor_tag} = \%acctags;
 }
 
 sub check_rbl_backend {

Modified: spamassassin/branches/tvd-evaltoplugin/lib/Mail/SpamAssassin/Plugin/HeaderEval.pm
URL: http://svn.apache.org/viewcvs/spamassassin/branches/tvd-evaltoplugin/lib/Mail/SpamAssassin/Plugin/HeaderEval.pm?rev=357409&r1=357408&r2=357409&view=diff
==============================================================================
--- spamassassin/branches/tvd-evaltoplugin/lib/Mail/SpamAssassin/Plugin/HeaderEval.pm (original)
+++ spamassassin/branches/tvd-evaltoplugin/lib/Mail/SpamAssassin/Plugin/HeaderEval.pm Sat Dec 17 16:29:20 2005
@@ -17,6 +17,7 @@
 package Mail::SpamAssassin::Plugin::HeaderEval;
 
 use Mail::SpamAssassin::Plugin;
+use Mail::SpamAssassin::Logger;
 use Mail::SpamAssassin::Constants qw(:sa :ip);
 
 use strict;
@@ -40,7 +41,6 @@
   $self->register_eval_rule("check_for_fake_aol_relay_in_rcvd");
   $self->register_eval_rule("check_for_faraway_charset_in_headers");
   $self->register_eval_rule("check_for_unique_subject_id");
-  $self->register_eval_rule("word_is_in_dictionary");
   $self->register_eval_rule("check_illegal_chars");
   $self->register_eval_rule("check_for_forged_hotmail_received_headers");
   $self->register_eval_rule("check_for_no_hotmail_received_headers");
@@ -57,7 +57,6 @@
   $self->register_eval_rule("check_for_round_the_world_received_helo");
   $self->register_eval_rule("check_for_round_the_world_received_revdns");
   $self->register_eval_rule("check_for_shifted_date");
-  $self->register_eval_rule("received_within_months");
   $self->register_eval_rule("subject_is_all_caps");
   $self->register_eval_rule("check_for_to_in_subject");
   $self->register_eval_rule("check_outlook_message_id");
@@ -70,6 +69,13 @@
   return $self;
 }
 
+# load triplets.txt into memory 
+sub compile_now_start {
+  my ($self) = @_;
+
+  $self->word_is_in_dictionary("aba");
+}
+
 # sad but true. sort it out, sysadmins!
 my $CCTLDS_WITH_LOTS_OF_OPEN_RELAYS = qr{(?:kr|cn|cl|ar|hk|il|th|tw|sg|za|tr|ma|ua|in|pe|br)};
 my $ROUND_THE_WORLD_RELAYERS = qr{(?:net|com|ca)};
@@ -316,10 +322,10 @@
 sub _check_for_forged_hotmail_received_headers {
   my ($self, $pms) = @_;
 
-  if (defined $self->{hotmail_addr_but_no_hotmail_received}) { return; }
+  if (defined $pms->{hotmail_addr_but_no_hotmail_received}) { return; }
 
-  $self->{hotmail_addr_with_forged_hotmail_received} = 0;
-  $self->{hotmail_addr_but_no_hotmail_received} = 0;
+  $pms->{hotmail_addr_with_forged_hotmail_received} = 0;
+  $pms->{hotmail_addr_but_no_hotmail_received} = 0;
 
   my $rcvd = $pms->get('Received');
   $rcvd =~ s/\s+/ /gs;		# just spaces, simplify the regexp
@@ -350,12 +356,12 @@
 
   if ($rcvd =~ /(?:from |HELO |helo=)\S*hotmail\.com\b/) {
     # HELO'd as hotmail.com, despite not being hotmail
-    $self->{hotmail_addr_with_forged_hotmail_received} = 1;
+    $pms->{hotmail_addr_with_forged_hotmail_received} = 1;
   } else {
     # check to see if From claimed to be @hotmail.com
     my $from = $pms->get('From:addr');
     if ($from !~ /hotmail.com/) { return; }
-    $self->{hotmail_addr_but_no_hotmail_received} = 1;
+    $pms->{hotmail_addr_but_no_hotmail_received} = 1;
   }
 }
 
@@ -363,14 +369,14 @@
 sub check_for_forged_hotmail_received_headers {
   my ($self, $pms) = @_;
   $self->_check_for_forged_hotmail_received_headers($pms);
-  return $self->{hotmail_addr_with_forged_hotmail_received};
+  return $pms->{hotmail_addr_with_forged_hotmail_received};
 }
 
 # SEMIFORGED_HOTMAIL_RCVD
 sub check_for_no_hotmail_received_headers {
   my ($self, $pms) = @_;
   $self->_check_for_forged_hotmail_received_headers($pms);
-  return $self->{hotmail_addr_but_no_hotmail_received};
+  return $pms->{hotmail_addr_but_no_hotmail_received};
 }
 
 # MSN_GROUPS
@@ -581,20 +587,20 @@
 sub sorted_recipients {
   my ($self, $pms) = @_;
 
-  if (!exists $self->{tocc_sorted}) {
+  if (!exists $pms->{tocc_sorted}) {
     $self->_check_recipients($pms);
   }
-  return $self->{tocc_sorted};
+  return $pms->{tocc_sorted};
 }
 
 sub similar_recipients {
   my ($self, $pms, $min, $max) = @_;
 
-  if (!exists $self->{tocc_similar}) {
+  if (!exists $pms->{tocc_similar}) {
     $self->_check_recipients($pms);
   }
-  return (($min eq 'undef' || $self->{tocc_similar} >= $min) &&
-	  ($max eq 'undef' || $self->{tocc_similar} < $max));
+  return (($min eq 'undef' || $pms->{tocc_similar} >= $min) &&
+	  ($max eq 'undef' || $pms->{tocc_similar} < $max));
 }
 
 # best experimentally derived values
@@ -626,12 +632,12 @@
   # ideas that had both poor S/O ratios and poor hit rates:
   # - testing for reverse sorted recipient lists
   # - testing To: and Cc: headers separately
-  $self->{tocc_sorted} = (scalar(@address) >= TOCC_SORTED_COUNT &&
+  $pms->{tocc_sorted} = (scalar(@address) >= TOCC_SORTED_COUNT &&
 			  join(',', @address) eq (join(',', sort @address)));
 
   # a good S/O ratio and hit rate is achieved by comparing 2-byte
   # substrings and requiring 5 or more addresses
-  $self->{tocc_similar} = 0;
+  $pms->{tocc_similar} = 0;
   if (scalar (@address) >= TOCC_SIMILAR_COUNT) {
     my @user = map { substr($_,0,TOCC_SIMILAR_LENGTH) } @address;
     my @fqhn = map { m/\@(.*)/ } @address;
@@ -645,7 +651,7 @@
 	$combinations++;
       }
     }
-    $self->{tocc_similar} = $hits / $combinations;
+    $pms->{tocc_similar} = $hits / $combinations;
   }
 }
 
@@ -682,8 +688,8 @@
   my ($self, $pms) = @_;
   my ($relayer, $relayerip, $relay);
 
-  $self->{round_the_world_revdns} = 0;
-  $self->{round_the_world_helo} = 0;
+  $pms->{round_the_world_revdns} = 0;
+  $pms->{round_the_world_helo} = 0;
   my $rcvd = $pms->get('Received');
   my $IPV4_ADDRESS = IPV4_ADDRESS;
 
@@ -712,13 +718,13 @@
 
   if ($revdns =~ /\.${ROUND_THE_WORLD_RELAYERS}$/oi) {
     dbg("eval: round-the-world: yep, I think so (from rev dns)");
-    $self->{round_the_world_revdns} = 1;
+    $pms->{round_the_world_revdns} = 1;
     return;
   }
 
   if ($relayer =~ /\.${ROUND_THE_WORLD_RELAYERS}$/oi) {
     dbg("eval: round-the-world: yep, I think so (from HELO)");
-    $self->{round_the_world_helo} = 1;
+    $pms->{round_the_world_helo} = 1;
     return;
   }
 
@@ -728,19 +734,19 @@
 
 sub check_for_round_the_world_received_helo {
   my ($self, $pms) = @_;
-  if (!defined $self->{round_the_world_helo}) {
+  if (!defined $pms->{round_the_world_helo}) {
     $self->_check_for_round_the_world_received($pms);
   }
-  if ($self->{round_the_world_helo}) { return 1; }
+  if ($pms->{round_the_world_helo}) { return 1; }
   return 0;
 }
 
 sub check_for_round_the_world_received_revdns {
   my ($self, $pms) = @_;
-  if (!defined $self->{round_the_world_revdns}) {
+  if (!defined $pms->{round_the_world_revdns}) {
     $self->_check_for_round_the_world_received($pms);
   }
-  if ($self->{round_the_world_revdns}) { return 1; }
+  if ($pms->{round_the_world_revdns}) { return 1; }
   return 0;
 }
 
@@ -749,21 +755,21 @@
 sub check_for_shifted_date {
   my ($self, $pms, $min, $max) = @_;
 
-  if (!exists $self->{date_diff}) {
+  if (!exists $pms->{date_diff}) {
     $self->_check_date_diff($pms);
   }
-  return (($min eq 'undef' || $self->{date_diff} >= (3600 * $min)) &&
-	  ($max eq 'undef' || $self->{date_diff} < (3600 * $max)));
+  return (($min eq 'undef' || $pms->{date_diff} >= (3600 * $min)) &&
+	  ($max eq 'undef' || $pms->{date_diff} < (3600 * $max)));
 }
 
 # filters out some false positives in old corpus mail - Allen
 sub received_within_months {
   my ($self,$pms,$min,$max) = @_;
 
-  if (!exists($self->{date_received})) {
+  if (!exists($pms->{date_received})) {
     $self->_check_date_received($pms);
   }
-  my $diff = time() - $self->{date_received};
+  my $diff = time() - $pms->{date_received};
 
   # 365.2425 * 24 * 60 * 60 = 31556952 = seconds in year (including leap)
 
@@ -791,18 +797,18 @@
     last if defined($time);
   }
   if (defined($time)) {
-    $self->{date_header_time} = $time;
+    $pms->{date_header_time} = $time;
   }
   else {
-    $self->{date_header_time} = undef;
+    $pms->{date_header_time} = undef;
   }
 }
 
 sub _get_received_header_times {
   my ($self, $pms) = @_;
 
-  $self->{received_header_times} = [ () ];
-  $self->{received_fetchmail_time} = undef;
+  $pms->{received_header_times} = [ () ];
+  $pms->{received_fetchmail_time} = undef;
 
   my (@received);
   my $received = $pms->get('Received');
@@ -846,10 +852,10 @@
       }
     }
     if (scalar(@fetchmail_times) > 1) {
-      $self->{received_fetchmail_time} =
+      $pms->{received_fetchmail_time} =
        (sort {$b <=> $a} (@fetchmail_times))[0];
     } elsif (scalar(@fetchmail_times)) {
-      $self->{received_fetchmail_time} = $fetchmail_times[0];
+      $pms->{received_fetchmail_time} = $fetchmail_times[0];
     }
   }
 
@@ -867,7 +873,7 @@
   }
 
   if (scalar(@header_times)) {
-    $self->{received_header_times} = [ @header_times ];
+    $pms->{received_header_times} = [ @header_times ];
   } else {
     dbg("eval: no dates found in Received headers");
   }
@@ -878,39 +884,39 @@
 
   my (@dates_poss);
 
-  $self->{date_received} = 0;
+  $pms->{date_received} = 0;
 
-  if (!exists($self->{date_header_time})) {
+  if (!exists($pms->{date_header_time})) {
     $self->_get_date_header_time($pms);
   }
 
-  if (defined($self->{date_header_time})) {
-    push @dates_poss, $self->{date_header_time};
+  if (defined($pms->{date_header_time})) {
+    push @dates_poss, $pms->{date_header_time};
   }
 
-  if (!exists($self->{received_header_times})) {
+  if (!exists($pms->{received_header_times})) {
     $self->_get_received_header_times($pms);
   }
-  my (@received_header_times) = @{ $self->{received_header_times} };
+  my (@received_header_times) = @{ $pms->{received_header_times} };
   if (scalar(@received_header_times)) {
     push @dates_poss, $received_header_times[0];
   }
-  if (defined($self->{received_fetchmail_time})) {
-    push @dates_poss, $self->{received_fetchmail_time};
+  if (defined($pms->{received_fetchmail_time})) {
+    push @dates_poss, $pms->{received_fetchmail_time};
   }
 
-  if (defined($self->{date_header_time}) && scalar(@received_header_times)) {
-    if (!exists($self->{date_diff})) {
+  if (defined($pms->{date_header_time}) && scalar(@received_header_times)) {
+    if (!exists($pms->{date_diff})) {
       $self->_check_date_diff($pms);
     }
-    push @dates_poss, $self->{date_header_time} - $self->{date_diff};
+    push @dates_poss, $pms->{date_header_time} - $pms->{date_diff};
   }
 
   if (scalar(@dates_poss)) {	# use median
-    $self->{date_received} = (sort {$b <=> $a}
+    $pms->{date_received} = (sort {$b <=> $a}
 			      (@dates_poss))[int($#dates_poss/2)];
     dbg("eval: date chosen from message: " .
-	scalar(localtime($self->{date_received})));
+	scalar(localtime($pms->{date_received})));
   } else {
     dbg("eval: no dates found in message");
   }
@@ -919,26 +925,26 @@
 sub _check_date_diff {
   my ($self, $pms) = @_;
 
-  $self->{date_diff} = 0;
+  $pms->{date_diff} = 0;
 
-  if (!exists($self->{date_header_time})) {
+  if (!exists($pms->{date_header_time})) {
     $self->_get_date_header_time($pms);
   }
 
-  if (!defined($self->{date_header_time})) {
+  if (!defined($pms->{date_header_time})) {
     return;			# already have tests for this
   }
 
-  if (!exists($self->{received_header_times})) {
+  if (!exists($pms->{received_header_times})) {
     $self->_get_received_header_times($pms);
   }
-  my (@header_times) = @{ $self->{received_header_times} };
+  my (@header_times) = @{ $pms->{received_header_times} };
 
   if (!scalar(@header_times)) {
     return;			# archived mail?
   }
 
-  my (@diffs) = map {$self->{date_header_time} - $_} (@header_times);
+  my (@diffs) = map {$pms->{date_header_time} - $_} (@header_times);
 
   # if the last Received: header has no difference, then we choose to
   # exclude it
@@ -949,7 +955,7 @@
   # use the date with the smallest absolute difference
   # (experimentally, this results in the fewest false positives)
   @diffs = sort { abs($a) <=> abs($b) } @diffs;
-  $self->{date_diff} = $diffs[0];
+  $pms->{date_diff} = $diffs[0];
 }
 
 
@@ -967,7 +973,8 @@
    # If so, punt on this test to avoid FPs.  We just list the known charsets
    # this test will FP on, here.
    my $subjraw = $pms->get('Subject:raw');
-   if ($subjraw =~ /=\?${Mail::SpamAssassin::Constants::CHARSETS_LIKELY_TO_FP_AS_CAPS}\?/i) {
+   my $CLTFAC = Mail::SpamAssassin::Constants::CHARSETS_LIKELY_TO_FP_AS_CAPS;
+   if ($subjraw =~ /=\?${CLTFAC}\?/i) {
      return 0;
    }
 
@@ -1012,7 +1019,7 @@
   my $diff = $timetoken - $expected;
   return 0 if (abs($diff) < $fudge);
 
-  $_ = $self->get('Received');
+  $_ = $pms->get('Received');
   /(\s.?\d+ \S\S\S \d+ \d+:\d+:\d+ \S+).*?$/;
   $_ = Mail::SpamAssassin::Util::parse_rfc822_date($_) || 0;
   $expected = int(($_ * $x) + $y);
@@ -1040,7 +1047,7 @@
   return 1 if /iPlanet Messaging Server/;
 
   # too old; older versions of clients used different formats
-  return 1 if ($self->received_within_months('6','undef'));
+  return 1 if ($self->received_within_months($pms, '6','undef'));
 
   return 0;
 }

Modified: spamassassin/branches/tvd-evaltoplugin/lib/Mail/SpamAssassin/Plugin/MIMEEval.pm
URL: http://svn.apache.org/viewcvs/spamassassin/branches/tvd-evaltoplugin/lib/Mail/SpamAssassin/Plugin/MIMEEval.pm?rev=357409&r1=357408&r2=357409&view=diff
==============================================================================
--- spamassassin/branches/tvd-evaltoplugin/lib/Mail/SpamAssassin/Plugin/MIMEEval.pm (original)
+++ spamassassin/branches/tvd-evaltoplugin/lib/Mail/SpamAssassin/Plugin/MIMEEval.pm Sat Dec 17 16:29:20 2005
@@ -90,8 +90,8 @@
 sub check_for_mime {
   my ($self, $pms, undef, $test) = @_;
 
-  $self->_check_attachments($pms->{msg}) unless exists $self->{$test};
-  return $self->{$test};
+  $self->_check_attachments($pms) unless exists $pms->{$test};
+  return $pms->{$test};
 }
 
 # any text/html MIME part
@@ -101,8 +101,8 @@
   my $ctype = $pms->get('Content-Type');
   return 1 if (defined($ctype) && $ctype =~ m@^text/html@i);
 
-  $self->_check_attachments($pms->{msg}) unless exists $self->{mime_body_html_count};
-  return ($self->{mime_body_html_count} > 0);
+  $self->_check_attachments($pms) unless exists $pms->{mime_body_html_count};
+  return ($pms->{mime_body_html_count} > 0);
 }
 
 # HTML without some other type of MIME text part
@@ -112,41 +112,41 @@
   my $ctype = $pms->get('Content-Type');
   return 1 if (defined($ctype) && $ctype =~ m@^text/html@i);
 
-  $self->_check_attachments($pms->{msg}) unless exists $self->{mime_body_html_count};
-  return ($self->{mime_body_html_count} > 0 &&
-	  $self->{mime_body_text_count} == 0);
+  $self->_check_attachments($pms) unless exists $pms->{mime_body_html_count};
+  return ($pms->{mime_body_html_count} > 0 &&
+	  $pms->{mime_body_text_count} == 0);
 }
 
 sub check_mime_multipart_ratio {
   my ($self, $pms, undef, $min, $max) = @_;
 
-  $self->_check_attachments($pms->{msg}) unless exists $self->{mime_multipart_alternative};
+  $self->_check_attachments($pms) unless exists $pms->{mime_multipart_alternative};
 
-  return ($self->{mime_multipart_ratio} >= $min &&
-	  $self->{mime_multipart_ratio} < $max);
+  return ($pms->{mime_multipart_ratio} >= $min &&
+	  $pms->{mime_multipart_ratio} < $max);
 }
 
 sub _check_mime_header {
-  my ($self, $ctype, $cte, $cd, $charset, $name) = @_;
+  my ($self, $pms, $ctype, $cte, $cd, $charset, $name) = @_;
 
   $charset ||= '';
 
   if ($ctype eq 'text/html') {
-    $self->{mime_body_html_count}++;
+    $pms->{mime_body_html_count}++;
   }
   elsif ($ctype =~ m@^text@i) {
-    $self->{mime_body_text_count}++;
+    $pms->{mime_body_text_count}++;
   }
 
   if ($cte =~ /base64/) {
-    $self->{mime_base64_count}++;
+    $pms->{mime_base64_count}++;
   }
   elsif ($cte =~ /quoted-printable/) {
-    $self->{mime_qp_count}++;
+    $pms->{mime_qp_count}++;
   }
 
   if ($cd && $cd =~ /attachment/) {
-    $self->{mime_attachment}++;
+    $pms->{mime_attachment}++;
   }
 
   if ($ctype =~ /^text/ &&
@@ -154,17 +154,17 @@
       $charset !~ /utf-8/ &&
       !($cd && $cd =~ /^(?:attachment|inline)/))
   {
-    $self->{mime_base64_encoded_text} = 1;
+    $pms->{mime_base64_encoded_text} = 1;
   }
 
   if ($cte =~ /base64/ && !$name) {
-    $self->{mime_base64_no_name} = 1;
+    $pms->{mime_base64_no_name} = 1;
   }
 
   if ($charset =~ /iso-\S+-\S+\b/i &&
       $charset !~ /iso-(?:8859-\d{1,2}|2022-(?:jp|kr))\b/)
   {
-    $self->{mime_bad_iso_charset} = 1;
+    $pms->{mime_bad_iso_charset} = 1;
   }
 
   # MIME_BASE64_LATIN: now a zero-hitter
@@ -172,12 +172,12 @@
   # $cte =~ /base64/ &&
   # $charset =~ /\b(?:us-ascii|iso-8859-(?:[12349]|1[0345])|windows-(?:125[0247]))\b/)
   # {
-  # $self->{mime_base64_latin} = 1;
+  # $pms->{mime_base64_latin} = 1;
   # }
 
   # MIME_QP_NO_CHARSET: now a zero-hitter
   # if ($cte =~ /quoted-printable/ && $cd =~ /inline/ && !$charset) {
-  # $self->{mime_qp_inline_no_charset} = 1;
+  # $pms->{mime_qp_inline_no_charset} = 1;
   # }
 
   # MIME_HTML_NO_CHARSET: now a zero-hitter
@@ -185,30 +185,30 @@
   # !(defined($charset) && $charset) &&
   # !($cd && $cd =~ /^(?:attachment|inline)/))
   # {
-  # $self->{mime_html_no_charset} = 1;
+  # $pms->{mime_html_no_charset} = 1;
   # }
 
   if ($charset =~ /[a-z]/i) {
-    if (defined $self->{mime_html_charsets}) {
-      $self->{mime_html_charsets} .= " ".$charset;
+    if (defined $pms->{mime_html_charsets}) {
+      $pms->{mime_html_charsets} .= " ".$charset;
     } else {
-      $self->{mime_html_charsets} = $charset;
+      $pms->{mime_html_charsets} = $charset;
     }
 
-    if (! $self->{mime_faraway_charset}) {
+    if (! $pms->{mime_faraway_charset}) {
       my @l = Mail::SpamAssassin::Util::get_my_locales($self->{main}->{conf}->{ok_locales});
 
       if (!(grep { $_ eq "all" } @l) &&
 	  !Mail::SpamAssassin::Locales::is_charset_ok_for_locales($charset, @l))
       {
-	$self->{mime_faraway_charset} = 1;
+	$pms->{mime_faraway_charset} = 1;
       }
     }
   }
 }
 
 sub _check_attachments {
-  my ($self, $msg) = @_;
+  my ($self, $pms) = @_;
 
   # MIME status
   my $where = -1;		# -1 = start, 0 = nowhere, 1 = header, 2 = body
@@ -221,35 +221,35 @@
   my $part = -1;		# MIME part index
 
   # indicate the scan has taken place
-  $self->{mime_checked_attachments} = 1;
+  $pms->{mime_checked_attachments} = 1;
 
   # results
-  $self->{mime_base64_blanks} = 0;
-  $self->{mime_base64_count} = 0;
-  $self->{mime_base64_encoded_text} = 0;
-  # $self->{mime_base64_illegal} = 0;
-  # $self->{mime_base64_latin} = 0;
-  $self->{mime_base64_no_name} = 0;
-  $self->{mime_body_html_count} = 0;
-  $self->{mime_body_text_count} = 0;
-  $self->{mime_faraway_charset} = 0;
-  # $self->{mime_html_no_charset} = 0;
-  $self->{mime_missing_boundary} = 0;
-  $self->{mime_multipart_alternative} = 0;
-  $self->{mime_multipart_ratio} = 1.0;
-  $self->{mime_qp_count} = 0;
-  # $self->{mime_qp_illegal} = 0;
-  # $self->{mime_qp_inline_no_charset} = 0;
-  $self->{mime_qp_long_line} = 0;
-  $self->{mime_qp_ratio} = 0;
+  $pms->{mime_base64_blanks} = 0;
+  $pms->{mime_base64_count} = 0;
+  $pms->{mime_base64_encoded_text} = 0;
+  # $pms->{mime_base64_illegal} = 0;
+  # $pms->{mime_base64_latin} = 0;
+  $pms->{mime_base64_no_name} = 0;
+  $pms->{mime_body_html_count} = 0;
+  $pms->{mime_body_text_count} = 0;
+  $pms->{mime_faraway_charset} = 0;
+  # $pms->{mime_html_no_charset} = 0;
+  $pms->{mime_missing_boundary} = 0;
+  $pms->{mime_multipart_alternative} = 0;
+  $pms->{mime_multipart_ratio} = 1.0;
+  $pms->{mime_qp_count} = 0;
+  # $pms->{mime_qp_illegal} = 0;
+  # $pms->{mime_qp_inline_no_charset} = 0;
+  $pms->{mime_qp_long_line} = 0;
+  $pms->{mime_qp_ratio} = 0;
 
   # Get all parts ...
-  foreach my $p ($msg->find_parts(qr/./)) {
+  foreach my $p ($pms->{msg}->find_parts(qr/./)) {
     # message headers
     my ($ctype, $boundary, $charset, $name) = Mail::SpamAssassin::Util::parse_content_type($p->get_header("content-type"));
 
     if ($ctype eq 'multipart/alternative') {
-      $self->{mime_multipart_alternative} = 1;
+      $pms->{mime_multipart_alternative} = 1;
     }
 
     my $cte = $p->get_header('Content-Transfer-Encoding') || '';
@@ -261,7 +261,7 @@
     $charset = lc $charset if ($charset);
     $name = lc $name if ($name);
 
-    $self->_check_mime_header($ctype, $cte, $cd, $charset, $name);
+    $self->_check_mime_header($pms, $ctype, $cte, $cd, $charset, $name);
 
     # If we're not in a leaf node in the tree, there will be no raw
     # section, so skip it.
@@ -277,25 +277,25 @@
     foreach (@{$p->raw()}) {
       if ($cte =~ /base64/i) {
         if ($previous =~ /^\s*$/ && /^\s*$/) {
-	  $self->{mime_base64_blanks} = 1;
+	  $pms->{mime_base64_blanks} = 1;
         }
         # MIME_BASE64_ILLEGAL: now a zero-hitter
         # if (m@[^A-Za-z0-9+/=\n]@ || /=[^=\s]/) {
-        # $self->{mime_base64_illegal} = 1;
+        # $pms->{mime_base64_illegal} = 1;
         # }
       }
 
-      # if ($self->{mime_html_no_charset} && $ctype eq 'text/html' && defined $charset) {
-      # $self->{mime_html_no_charset} = 0;
+      # if ($pms->{mime_html_no_charset} && $ctype eq 'text/html' && defined $charset) {
+      # $pms->{mime_html_no_charset} = 0;
       # }
-      if ($self->{mime_multipart_alternative} && $cd !~ /attachment/ &&
+      if ($pms->{mime_multipart_alternative} && $cd !~ /attachment/ &&
           ($ctype eq 'text/plain' || $ctype eq 'text/html')) {
 	$part_bytes[$part] += length;
       }
 
       if ($where != 1 && $cte eq "quoted-printable" && ! /^SPAM: /) {
         if (length > 77) {
-	  $self->{mime_qp_long_line} = 1;
+	  $pms->{mime_qp_long_line} = 1;
         }
         $qp_bytes += length;
 
@@ -303,9 +303,9 @@
 
         # check for illegal substrings (RFC 2045), hexadecimal values 7F-FF and
         # control characters other than TAB, or CR and LF as parts of CRLF pairs
-        # if (!$self->{mime_qp_illegal} && /[\x00-\x08\x0b\x0c\x0e-\x1f\x7f-\xff]/)
+        # if (!$pms->{mime_qp_illegal} && /[\x00-\x08\x0b\x0c\x0e-\x1f\x7f-\xff]/)
         # {
-        # $self->{mime_qp_illegal} = 1;
+        # $pms->{mime_qp_illegal} = 1;
         # }
 
         # count excessive QP bytes
@@ -328,10 +328,10 @@
   }
 
   if ($qp_bytes) {
-    $self->{mime_qp_ratio} = $qp_count / $qp_bytes;
+    $pms->{mime_qp_ratio} = $qp_count / $qp_bytes;
   }
 
-  if ($self->{mime_multipart_alternative}) {
+  if ($pms->{mime_multipart_alternative}) {
     my $text;
     my $html;
     # bug 4207: we want the size of the last parts
@@ -346,14 +346,14 @@
       last if (defined($html) && defined($text));
     }
     if (defined($text) && defined($html) && $html > 0) {
-      $self->{mime_multipart_ratio} = ($text / $html);
+      $pms->{mime_multipart_ratio} = ($text / $html);
     }
   }
 
   # Look to see if any multipart boundaries are not "balanced"
-  foreach my $val (values %{$msg->{mime_boundary_state}}) {
+  foreach my $val (values %{$pms->{msg}->{mime_boundary_state}}) {
     if ($val != 0) {
-      $self->{mime_missing_boundary} = 1;
+      $pms->{mime_missing_boundary} = 1;
       last;
     }
   }
@@ -369,12 +369,12 @@
   my ($self, $pms, $body, $min, $max) = @_;
   local ($_);
 
-  if (exists $self->{uppercase}) {
-    return ($self->{uppercase} > $min && $self->{uppercase} <= $max);
+  if (exists $pms->{uppercase}) {
+    return ($pms->{uppercase} > $min && $pms->{uppercase} <= $max);
   }
 
   if ($self->body_charset_is_likely_to_fp($pms)) {
-    $self->{uppercase} = 0; return 0;
+    $pms->{uppercase} = 0; return 0;
   }
 
   # Dec 20 2002 jm: trade off some speed for low memory footprint, by
@@ -405,16 +405,16 @@
   # report only on mails above a minimum size; otherwise one
   # or two acronyms can throw it off
   if ($len < 200) {
-    $self->{uppercase} = 0;
+    $pms->{uppercase} = 0;
     return 0;
   }
   if (($upper + $lower) == 0) {
-    $self->{uppercase} = 0;
+    $pms->{uppercase} = 0;
   } else {
-    $self->{uppercase} = ($upper / ($upper + $lower)) * 100;
+    $pms->{uppercase} = ($upper / ($upper + $lower)) * 100;
   }
 
-  return ($self->{uppercase} > $min && $self->{uppercase} <= $max);
+  return ($pms->{uppercase} > $min && $pms->{uppercase} <= $max);
 }
 
 sub body_charset_is_likely_to_fp {
@@ -423,15 +423,15 @@
   # check for charsets where this test will FP -- iso-2022-jp, gb2312,
   # koi8-r etc.
   #
-  $self->_check_attachments($pms->{msg}) unless exists $self->{mime_checked_attachments};
+  $self->_check_attachments($pms) unless exists $pms->{mime_checked_attachments};
   my @charsets = ();
   my $type = $pms->get('Content-Type');
   $type = get_charset_from_ct_line ($type);
   if (defined $type) {
     push (@charsets, $type);
   }
-  if (defined $self->{mime_html_charsets}) {
-    push (@charsets, split(' ', $self->{mime_html_charsets}));
+  if (defined $pms->{mime_html_charsets}) {
+    push (@charsets, split(' ', $pms->{mime_html_charsets}));
   }
 
   my $CHARSETS_LIKELY_TO_FP_AS_CAPS = CHARSETS_LIKELY_TO_FP_AS_CAPS;

Modified: spamassassin/branches/tvd-evaltoplugin/lib/Mail/SpamAssassin/Plugin/RelayEval.pm
URL: http://svn.apache.org/viewcvs/spamassassin/branches/tvd-evaltoplugin/lib/Mail/SpamAssassin/Plugin/RelayEval.pm?rev=357409&r1=357408&r2=357409&view=diff
==============================================================================
--- spamassassin/branches/tvd-evaltoplugin/lib/Mail/SpamAssassin/Plugin/RelayEval.pm (original)
+++ spamassassin/branches/tvd-evaltoplugin/lib/Mail/SpamAssassin/Plugin/RelayEval.pm Sat Dec 17 16:29:20 2005
@@ -17,7 +17,9 @@
 package Mail::SpamAssassin::Plugin::RelayEval;
 
 use Mail::SpamAssassin::Plugin;
+use Mail::SpamAssassin::Logger;
 use Mail::SpamAssassin::Constants qw(:ip);
+
 use strict;
 use warnings;
 use bytes;
@@ -264,43 +266,43 @@
 sub check_for_from_domain_in_received_headers {
   my ($self, $pms, $domain, $desired) = @_;
   
-  if (exists $self->{from_domain_in_received}) {
-      if (exists $self->{from_domain_in_received}->{$domain}) {
+  if (exists $pms->{from_domain_in_received}) {
+      if (exists $pms->{from_domain_in_received}->{$domain}) {
 	  if ($desired eq 'true') {
 	      # See use of '0e0' below for why we force int() here:
-	      return int($self->{from_domain_in_received}->{$domain});
+	      return int($pms->{from_domain_in_received}->{$domain});
 	  }
 	  else {
 	      # And why we deliberately do NOT use integers here:
-	      return !$self->{from_domain_in_received}->{$domain};
+	      return !$pms->{from_domain_in_received}->{$domain};
 	  }
       }
   } else {
-      $self->{from_domain_in_received} = {};
+      $pms->{from_domain_in_received} = {};
   }
 
   my $from = $pms->get('From:addr');
   if ($from !~ /\b\Q$domain\E/i) {
       # '0e0' is Perl idiom for "true but zero":
-      $self->{from_domain_in_received}->{$domain} = '0e0';
+      $pms->{from_domain_in_received}->{$domain} = '0e0';
       return 0;
   }
 
   my $rcvd = $pms->{relays_trusted_str}."\n".$pms->{relays_untrusted_str};
 
   if ($rcvd =~ / rdns=\S*\b${domain} [^\]]*by=\S*\b${domain} /) {
-      $self->{from_domain_in_received}->{$domain} = 1;
+      $pms->{from_domain_in_received}->{$domain} = 1;
       return ($desired eq 'true');
   }
 
-  $self->{from_domain_in_received}->{$domain} = 0;
+  $pms->{from_domain_in_received}->{$domain} = 0;
   return ($desired ne 'true');   
 }
 
 sub check_for_no_rdns_dotcom_helo {
   my ($self, $pms) = @_;
-  if (!exists $self->{no_rdns_dotcom_helo}) { $self->_check_received_helos($pms); }
-  return $self->{no_rdns_dotcom_helo};
+  if (!exists $pms->{no_rdns_dotcom_helo}) { $self->_check_received_helos($pms); }
+  return $pms->{no_rdns_dotcom_helo};
 }
 
 # Bug 1133
@@ -341,7 +343,7 @@
     # allow stuff before the dot-com for both from-name and HELO-name,
     # so HELO="outgoing.aol.com" and from="mx34853495.mx.aol.com" works OK.
     #
-    $self->{no_rdns_dotcom_helo} = 0;
+    $pms->{no_rdns_dotcom_helo} = 0;
     if ($helo_host =~ /(?:\.|^)(lycos\.com|lycos\.co\.uk|hotmail\.com
 		|localhost\.com|excite\.com|caramail\.com
 		|cs\.com|aol\.com|msn\.com|yahoo\.com|drizzle\.com)$/ix)
@@ -351,7 +353,7 @@
       # ok, let's catch the case where there's *no* reverse DNS there either
       if ($no_rdns) {
 	dbg("eval: Received: no rDNS for dotcom HELO: from=$from_host HELO=$helo_host");
-	$self->{no_rdns_dotcom_helo} = 1;
+	$pms->{no_rdns_dotcom_helo} = 1;
       }
     }
   }
@@ -375,30 +377,30 @@
 # FORGED_RCVD_TRAIL
 sub check_for_forged_received_trail {
   my ($self, $pms) = @_;
-  $self->_check_for_forged_received($pms) unless exists $self->{mismatch_from};
-  return ($self->{mismatch_from} > 1);
+  $self->_check_for_forged_received($pms) unless exists $pms->{mismatch_from};
+  return ($pms->{mismatch_from} > 1);
 }
 
 # FORGED_RCVD_HELO
 sub check_for_forged_received_helo {
   my ($self, $pms) = @_;
-  $self->_check_for_forged_received($pms) unless exists $self->{mismatch_helo};
-  return ($self->{mismatch_helo} > 0);
+  $self->_check_for_forged_received($pms) unless exists $pms->{mismatch_helo};
+  return ($pms->{mismatch_helo} > 0);
 }
 
 # FORGED_RCVD_IP_HELO
 sub check_for_forged_received_ip_helo {
   my ($self, $pms) = @_;
-  $self->_check_for_forged_received($pms) unless exists $self->{mismatch_ip_helo};
-  return ($self->{mismatch_ip_helo} > 0);
+  $self->_check_for_forged_received($pms) unless exists $pms->{mismatch_ip_helo};
+  return ($pms->{mismatch_ip_helo} > 0);
 }
 
 sub _check_for_forged_received {
   my ($self, $pms) = @_;
 
-  $self->{mismatch_from} = 0;
-  $self->{mismatch_helo} = 0;
-  $self->{mismatch_ip_helo} = 0;
+  $pms->{mismatch_from} = 0;
+  $pms->{mismatch_helo} = 0;
+  $pms->{mismatch_ip_helo} = 0;
 
   my $IP_PRIVATE = IP_PRIVATE;
 
@@ -447,7 +449,7 @@
 		&& $frm ne $hlo && !helo_forgery_whitelisted($frm, $hlo))
     {
       dbg("eval: forged-HELO: mismatch on HELO: '$hlo' != '$frm'");
-      $self->{mismatch_helo}++;
+      $pms->{mismatch_helo}++;
     }
 
     my $fip = $fromip[$i];
@@ -466,7 +468,7 @@
 		!($hlo =~ /$IP_PRIVATE/o))
 	{
 	  dbg("eval: forged-HELO: massive mismatch on IP-addr HELO: '$hlo' != '$fip'");
-	  $self->{mismatch_ip_helo}++;
+	  $pms->{mismatch_ip_helo}++;
 	}
       }
     }
@@ -477,7 +479,7 @@
 		&& $by ne $prev && !helo_forgery_whitelisted($by, $prev))
     {
       dbg("eval: forged-HELO: mismatch on from: '$prev' != '$by'");
-      $self->{mismatch_from}++;
+      $pms->{mismatch_from}++;
     }
   }
 }

Modified: spamassassin/branches/tvd-evaltoplugin/lib/Mail/SpamAssassin/Plugin/URIEval.pm
URL: http://svn.apache.org/viewcvs/spamassassin/branches/tvd-evaltoplugin/lib/Mail/SpamAssassin/Plugin/URIEval.pm?rev=357409&r1=357408&r2=357409&view=diff
==============================================================================
--- spamassassin/branches/tvd-evaltoplugin/lib/Mail/SpamAssassin/Plugin/URIEval.pm (original)
+++ spamassassin/branches/tvd-evaltoplugin/lib/Mail/SpamAssassin/Plugin/URIEval.pm Sat Dec 17 16:29:20 2005
@@ -17,6 +17,8 @@
 package Mail::SpamAssassin::Plugin::URIEval;
 
 use Mail::SpamAssassin::Plugin;
+use Mail::SpamAssassin::Logger;
+
 use strict;
 use warnings;
 use bytes;

Modified: spamassassin/branches/tvd-evaltoplugin/lib/Mail/SpamAssassin/Plugin/WLBLEval.pm
URL: http://svn.apache.org/viewcvs/spamassassin/branches/tvd-evaltoplugin/lib/Mail/SpamAssassin/Plugin/WLBLEval.pm?rev=357409&r1=357408&r2=357409&view=diff
==============================================================================
--- spamassassin/branches/tvd-evaltoplugin/lib/Mail/SpamAssassin/Plugin/WLBLEval.pm (original)
+++ spamassassin/branches/tvd-evaltoplugin/lib/Mail/SpamAssassin/Plugin/WLBLEval.pm Sat Dec 17 16:29:20 2005
@@ -457,28 +457,28 @@
 
 sub check_from_in_whitelist {
   my ($self, $pms) = @_;
-  $self->_check_from_in_whitelist($pms) unless exists $self->{from_in_whitelist};
-  return ($self->{from_in_whitelist} > 0);
+  $self->_check_from_in_whitelist($pms) unless exists $pms->{from_in_whitelist};
+  return ($pms->{from_in_whitelist} > 0);
 }
 
 sub check_forged_in_whitelist {
   my ($self, $pms) = @_;
-  $self->_check_from_in_whitelist($pms) unless exists $self->{from_in_whitelist};
-  $self->_check_from_in_default_whitelist($pms) unless exists $self->{from_in_default_whitelist};
-  return ($self->{from_in_whitelist} < 0) && ($self->{from_in_default_whitelist} == 0);
+  $self->_check_from_in_whitelist($pms) unless exists $pms->{from_in_whitelist};
+  $self->_check_from_in_default_whitelist($pms) unless exists $pms->{from_in_default_whitelist};
+  return ($pms->{from_in_whitelist} < 0) && ($pms->{from_in_default_whitelist} == 0);
 }
 
 sub check_from_in_default_whitelist {
   my ($self, $pms) = @_;
-  $self->_check_from_in_default_whitelist($pms) unless exists $self->{from_in_default_whitelist};
-  return ($self->{from_in_default_whitelist} > 0);
+  $self->_check_from_in_default_whitelist($pms) unless exists $pms->{from_in_default_whitelist};
+  return ($pms->{from_in_default_whitelist} > 0);
 }
 
 sub check_forged_in_default_whitelist {
   my ($self, $pms) = @_;
-  $self->_check_from_in_default_whitelist($pms) unless exists $self->{from_in_default_whitelist};
-  $self->_check_from_in_whitelist($pms) unless exists $self->{from_in_whitelist};
-  return ($self->{from_in_default_whitelist} < 0) && ($self->{from_in_whitelist} == 0);
+  $self->_check_from_in_default_whitelist($pms) unless exists $pms->{from_in_default_whitelist};
+  $self->_check_from_in_whitelist($pms) unless exists $pms->{from_in_whitelist};
+  return ($pms->{from_in_default_whitelist} < 0) && ($pms->{from_in_whitelist} == 0);
 }
 
 ###########################################################################
@@ -489,12 +489,12 @@
   local ($_);
   foreach $_ ($self->all_from_addrs($pms)) {
     if ($self->_check_whitelist ($self->{main}->{conf}->{whitelist_from}, $_)) {
-      $self->{from_in_whitelist} = 1;
+      $pms->{from_in_whitelist} = 1;
       return;
     }
     my $wh = $self->_check_whitelist_rcvd ($pms, $self->{main}->{conf}->{whitelist_from_rcvd}, $_);
     if ($wh == 1) {
-      $self->{from_in_whitelist} = 1;
+      $pms->{from_in_whitelist} = 1;
       return;
     }
     elsif ($wh == -1) {
@@ -502,7 +502,7 @@
     }
   }
 
-  $self->{from_in_whitelist} = $found_match;
+  $pms->{from_in_whitelist} = $found_match;
   return;
 }
 
@@ -515,7 +515,7 @@
   foreach $_ ($self->all_from_addrs($pms)) {
     my $wh = $self->_check_whitelist_rcvd ($pms, $self->{main}->{conf}->{def_whitelist_from_rcvd}, $_);
     if ($wh == 1) {
-      $self->{from_in_default_whitelist} = 1;
+      $pms->{from_in_default_whitelist} = 1;
       return;
     }
     elsif ($wh == -1) {
@@ -523,7 +523,7 @@
     }
   }
 
-  $self->{from_in_default_whitelist} = $found_match;
+  $pms->{from_in_default_whitelist} = $found_match;
   return;
 }
 
@@ -600,7 +600,7 @@
 sub all_from_addrs {
   my ($self, $pms) = @_;
 
-  if (exists $self->{all_from_addrs}) { return @{$self->{all_from_addrs}}; }
+  if (exists $pms->{all_from_addrs}) { return @{$pms->{all_from_addrs}}; }
 
   my @addrs;
 
@@ -633,14 +633,14 @@
   @addrs = keys %addrs;
 
   dbg("eval: all '*From' addrs: " . join(" ", @addrs));
-  $self->{all_from_addrs} = \@addrs;
+  $pms->{all_from_addrs} = \@addrs;
   return @addrs;
 }
 
 sub all_to_addrs {
   my ($self, $pms) = @_;
 
-  if (exists $self->{all_to_addrs}) { return @{$self->{all_to_addrs}}; }
+  if (exists $pms->{all_to_addrs}) { return @{$pms->{all_to_addrs}}; }
 
   my @addrs;
 
@@ -687,7 +687,7 @@
   }
 
   dbg("eval: all '*To' addrs: " . join(" ", @addrs));
-  $self->{all_to_addrs} = \@addrs;
+  $pms->{all_to_addrs} = \@addrs;
   return @addrs;
 
 # http://www.cs.tut.fi/~jkorpela/headers.html is useful here, also