You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@spamassassin.apache.org by jm...@apache.org on 2008/04/21 01:03:20 UTC

svn commit: r649996 - /spamassassin/trunk/lib/Mail/SpamAssassin/Plugin/VBounce.pm

Author: jm
Date: Sun Apr 20 16:03:11 2008
New Revision: 649996

URL: http://svn.apache.org/viewvc?rev=649996&view=rev
Log:
bug 5884: BOUNCE_MESSAGE rules from the VBounce ruleset should not match unless a message contains at least 1 Received: header.  this allows locally-generated bounces to be rescued from being hit.  Fix thanks to Jason Haar

Modified:
    spamassassin/trunk/lib/Mail/SpamAssassin/Plugin/VBounce.pm

Modified: spamassassin/trunk/lib/Mail/SpamAssassin/Plugin/VBounce.pm
URL: http://svn.apache.org/viewvc/spamassassin/trunk/lib/Mail/SpamAssassin/Plugin/VBounce.pm?rev=649996&r1=649995&r2=649996&view=diff
==============================================================================
--- spamassassin/trunk/lib/Mail/SpamAssassin/Plugin/VBounce.pm (original)
+++ spamassassin/trunk/lib/Mail/SpamAssassin/Plugin/VBounce.pm Sun Apr 20 16:03:11 2008
@@ -100,6 +100,7 @@
 
   my $body = $pms->get_decoded_stripped_body_text_array();
   my $res;
+  my $found_received;
 
   # catch lines like:
   # Received: by dogma.boxhost.net (Postfix, from userid 1007)
@@ -107,6 +108,7 @@
   # check the plain-text body, first
   foreach my $line (@{$body}) {
     next unless ($line =~ /^[> ]*Received:/i);
+    $found_received++;
     while ($line =~ / (\S+\.\S+) /g) {
       return 1 if $self->_relay_is_in_whitelist_bounce_relays($pms, $1);
     }
@@ -119,12 +121,17 @@
   my $pristine = $pms->{msg}->get_pristine_body();
   foreach my $line ($pristine =~ /^(.*)$/gm) {
     next unless $line && ($line =~ /^[> ]*Received:/i);
+    $found_received++;
     while ($line =~ / (\S+\.\S+) /g) {
       return 1 if $self->_relay_is_in_whitelist_bounce_relays($pms, $1);
     }
   }
 
-  return 0;
+  if ($found_received) {
+    return 0;
+  } else {
+    return 1;
+  }
 }
 
 sub _relay_is_in_whitelist_bounce_relays {