Author: norman
Date: Sun May 21 22:47:04 2006
New Revision: 408576

URL: http://svn.apache.org/viewvc?rev=408576&view=rev
Log:
Fix a bug where the explanation was only set if a modifier was present.

Modified:
    james/jspf/trunk/src/main/java/org/apache/james/jspf/SPF.java
    james/jspf/trunk/src/test/resources/org/apache/james/jspf/test.txt

Modified: james/jspf/trunk/src/main/java/org/apache/james/jspf/SPF.java
URL: 
http://svn.apache.org/viewvc/james/jspf/trunk/src/main/java/org/apache/james/jspf/SPF.java?rev=408576&r1=408575&r2=408576&view=diff
==============================================================================
--- james/jspf/trunk/src/main/java/org/apache/james/jspf/SPF.java (original)
+++ james/jspf/trunk/src/main/java/org/apache/james/jspf/SPF.java Sun May 21 
22:47:04 2006
@@ -228,22 +228,22 @@
 
                 spfData.setCurrentResult(result);
                 spfData.setMatch(true);
-
-                if (qualifier.equals(SPF1Constants.FAIL)) {  
-                    if (spfData.getExplanation()==null || 
spfData.getExplanation().equals("")) {
-                        try {
-                            spfData.setExplanation(new MacroExpand(spfData)
-                                    
.expandExplanation(SPF1Utils.DEFAULT_EXPLANATION));
-                        } catch (PermErrorException e) {}
-                    }
-                    explanation = spfData.getExplanation();
-                }
             }
         }
 
         // If no match was found set the result to neutral
         if (!spfData.isMatch() && (hasCommand == true)) {
             result = SPF1Constants.NEUTRAL;
+        } 
+        
+        if (result.equals(SPF1Constants.FAIL)) {  
+            if (spfData.getExplanation()==null || 
spfData.getExplanation().equals("")) {
+                try {
+                    spfData.setExplanation(new MacroExpand(spfData)
+                            .expandExplanation(SPF1Utils.DEFAULT_EXPLANATION));
+                } catch (PermErrorException e) {}
+            }
+            explanation = spfData.getExplanation();
         }
         
         return new SPFInternalResult(result, explanation);

Modified: james/jspf/trunk/src/test/resources/org/apache/james/jspf/test.txt
URL: 
http://svn.apache.org/viewvc/james/jspf/trunk/src/test/resources/org/apache/james/jspf/test.txt?rev=408576&r1=408575&r2=408576&view=diff
==============================================================================
--- james/jspf/trunk/src/test/resources/org/apache/james/jspf/test.txt 
(original)
+++ james/jspf/trunk/src/test/resources/org/apache/james/jspf/test.txt Sun May 
21 22:47:04 2006
@@ -136,6 +136,7 @@
 smtp-comment    /.*/ 
 header-comment  /.*/ spfquery:
 received-spf    /.*/ Received-SPF:
+explanation     /.*/ 
http://www.openspf.org/why.html?sender=spf19-test.foo.bar&ip=F.E.D.C.B.A.9.8.7.6.5.4.3.2.1.0.F.E.D.C.B.A.9.8.7.6.5.4.3.2.1.0
 
 spfquery -ip=2001:1234:5678:9ABC:FFFF:FFFF:FFFF:FFFF 
-sender=spf20-test.foo.bar -helo=spf20-test.foo.bar
 result          /.*/ pass



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to