https://issues.apache.org/SpamAssassin/show_bug.cgi?id=5884

           Summary: check_whitelist_bounce_relays misclassifying mail as
                    backscatter
           Product: Spamassassin
           Version: 3.2.4
          Platform: Other
        OS/Version: All
            Status: NEW
          Severity: enhancement
          Priority: P5
         Component: Plugins
        AssignedTo: [email protected]
        ReportedBy: [EMAIL PROTECTED]


Hi there

I'm trying to get Vbounce to tag backscatter correctly, and am finding that it
misclassifies Out of Office mail as backscatter.

Looking at "sub check_whitelist_bounce_relays" I think I can see why.

It looks for Received headers containing whitelist_bounce_relays, and if it
finds one, tags it as valid - it then marks all others as invalid (ie
backscatter). That is not the case. *only if* it found other Received headers
would that be the case.

How about this instead - I use $found_received to confirm there was at least
one Received header:

sub check_whitelist_bounce_relays {
  my ($self, $pms) = @_;

  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)

  # check the plain-text body, first
  foreach my $line (@{$body}) {
    next unless ($line =~ /Received: /);
    $found_received++;
    while ($line =~ / (\S+\.\S+) /g) {
      return 1 if $self->_relay_is_in_whitelist_bounce_relays($pms, $1);
    }
  }

  # now check any "message/anything" attachment MIME parts, too.
  # don't use the more efficient find_parts() method until bug 5331 is
  # fixed, otherwise we'll miss some messages due to their MIME structure

  my $pristine = $pms->{msg}->get_pristine_body();
  foreach my $line ($pristine =~ /^(.*)$/gm) {
    next unless $line && ($line =~ /Received: /);
    $found_received++;
    while ($line =~ / (\S+\.\S+) /g) {
      return 1 if $self->_relay_is_in_whitelist_bounce_relays($pms, $1);
    }
  }
   if ($found_received) {
        return 0;
  }else{
        return 1;
  }
}


-- 
Configure bugmail: 
https://issues.apache.org/SpamAssassin/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

Reply via email to