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

            Bug ID: 6920
           Summary: SPF Plugin incorrectly parses existing
                    Received-SPF/Authetication Results headers
           Product: Spamassassin
           Version: SVN Trunk (Latest Devel Version)
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Plugins
          Assignee: [email protected]
          Reporter: [email protected]
    Classification: Unclassified

Created attachment 5139
  --> https://issues.apache.org/SpamAssassin/attachment.cgi?id=5139&action=edit
Example message that demonstrates the issue

Just found this whilst testing a message that already contained Received-SPF
headers against a meta rule I was writing that looked for SPF_FAIL or
SPF_SOFTFAIL.

If the Received-SPF or Authentication-Results header is split across multiple
lines with a continuation then the plugin will fail to parse the
identity=(mfrom|mailfrom|helo) value.

In my case this causes the Received-SPF for the helo identity to be incorrectly
used as the mfrom result.

The problem appears to be this:

    my @internal_hdrs = split("\n", $scanner->get('ALL-INTERNAL'));

The internal headers in ALL-INTERNAL are not collapsed with the continuations
removed.  The plugin then iterates over the *lines*:

    foreach my $hdr (@internal_hdrs) {
...
        if ($hdr =~
/^received-spf:\s*(pass|neutral|(?:soft)?fail|none)\b(?:.*\bidentity=(\S+?);?\b)?/i)
{

This regexp will then fail to match if the header is split across multiple
lines.

I'm not entirely sure how best to fix this.  I've attached a message which
demonstrates this issue.

-- 
You are receiving this mail because:
You are the assignee for the bug.

Reply via email to