You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@spamassassin.apache.org by kb...@apache.org on 2017/08/24 10:52:37 UTC

svn commit: r1806022 - /spamassassin/trunk/lib/Mail/SpamAssassin/Plugin/SPF.pm

Author: kb
Date: Thu Aug 24 10:52:37 2017
New Revision: 1806022

URL: http://svn.apache.org/viewvc?rev=1806022&view=rev
Log:
bug 7441: handle Received-SPF temperror and permerror


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

Modified: spamassassin/trunk/lib/Mail/SpamAssassin/Plugin/SPF.pm
URL: http://svn.apache.org/viewvc/spamassassin/trunk/lib/Mail/SpamAssassin/Plugin/SPF.pm?rev=1806022&r1=1806021&r2=1806022&view=diff
==============================================================================
--- spamassassin/trunk/lib/Mail/SpamAssassin/Plugin/SPF.pm (original)
+++ spamassassin/trunk/lib/Mail/SpamAssassin/Plugin/SPF.pm Thu Aug 24 10:52:37 2017
@@ -391,7 +391,7 @@ sub _check_spf {
 
 	# http://www.openspf.org/RFC_4408#header-field
 	# wtf - for some reason something is sticking an extra space between the header name and field value
-	if ($hdr =~ /^received-spf:\s*(pass|neutral|(?:soft)?fail|none)\b(?:.*\bidentity=(\S+?);?\b)?/i) {
+	if ($hdr =~ /^received-spf:\s*(pass|neutral|(?:soft)?fail|(?:temp|perm)error|none)\b(?:.*\bidentity=(\S+?);?\b)?/i) {
 	  my $result = lc($1);
 
 	  my $identity = '';	# we assume it's a mfrom check if we can't tell otherwise
@@ -418,6 +418,8 @@ sub _check_spf {
 	  $scanner->{"spf_${identity}none"} = 0;
 	  $scanner->{"spf_${identity}fail"} = 0;
 	  $scanner->{"spf_${identity}softfail"} = 0;
+	  $scanner->{"spf_${identity}temperror"} = 0;
+	  $scanner->{"spf_${identity}permerror"} = 0;
 	  $scanner->{"spf_${identity}failure_comment"} = undef;
 
 	  # and the result
@@ -439,7 +441,7 @@ sub _check_spf {
         # Authentication-Results: mail.example.com; SPF=none smtp.mailfrom=example.org (comment)
 
         my $tmphdr = $1;
-        if ($tmphdr =~ /^(pass|neutral|(?:hard|soft)?fail|none)(?:[^;]*?\bsmtp\.(\S+)\s*=[^;]+)?/i) {
+        if ($tmphdr =~ /^(pass|neutral|(?:hard|soft)?fail|(?:temp|perm)error|none)(?:[^;]*?\bsmtp\.(\S+)\s*=[^;]+)?/i) {
           my $result = lc($1);
           $result = 'fail'  if $result eq 'hardfail';  # RFC5451 permits this
 
@@ -467,6 +469,8 @@ sub _check_spf {
           $scanner->{"spf_${identity}none"} = 0;
           $scanner->{"spf_${identity}fail"} = 0;
           $scanner->{"spf_${identity}softfail"} = 0;
+          $scanner->{"spf_${identity}temperror"} = 0;
+          $scanner->{"spf_${identity}permerror"} = 0;
           $scanner->{"spf_${identity}failure_comment"} = undef;
 
           # and the result