james-server-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From b...@apache.org
Subject svn commit: r531131 - in /james/jspf/branches/asynch-jspf/src/main/java/org/apache/james/jspf: core/ terms/
Date Sun, 22 Apr 2007 00:53:08 GMT
Author: bago
Date: Sat Apr 21 17:53:07 2007
New Revision: 531131

URL: http://svn.apache.org/viewvc?view=rev&rev=531131
Log:
Now also Modifiers are simple SPFChecker and do not return any value.
The modifier will set a session attribute with its result, so that the Directive will be able
to return the correct value.

Modified:
    james/jspf/branches/asynch-jspf/src/main/java/org/apache/james/jspf/core/Directive.java
    james/jspf/branches/asynch-jspf/src/main/java/org/apache/james/jspf/core/Mechanism.java
    james/jspf/branches/asynch-jspf/src/main/java/org/apache/james/jspf/terms/AMechanism.java
    james/jspf/branches/asynch-jspf/src/main/java/org/apache/james/jspf/terms/AllMechanism.java
    james/jspf/branches/asynch-jspf/src/main/java/org/apache/james/jspf/terms/ExistsMechanism.java
    james/jspf/branches/asynch-jspf/src/main/java/org/apache/james/jspf/terms/IP4Mechanism.java
    james/jspf/branches/asynch-jspf/src/main/java/org/apache/james/jspf/terms/IncludeMechanism.java
    james/jspf/branches/asynch-jspf/src/main/java/org/apache/james/jspf/terms/MXMechanism.java
    james/jspf/branches/asynch-jspf/src/main/java/org/apache/james/jspf/terms/PTRMechanism.java

Modified: james/jspf/branches/asynch-jspf/src/main/java/org/apache/james/jspf/core/Directive.java
URL: http://svn.apache.org/viewvc/james/jspf/branches/asynch-jspf/src/main/java/org/apache/james/jspf/core/Directive.java?view=diff&rev=531131&r1=531130&r2=531131
==============================================================================
--- james/jspf/branches/asynch-jspf/src/main/java/org/apache/james/jspf/core/Directive.java
(original)
+++ james/jspf/branches/asynch-jspf/src/main/java/org/apache/james/jspf/core/Directive.java
Sat Apr 21 17:53:07 2007
@@ -30,6 +30,8 @@
  */
 public class Directive implements SPFChecker {
 
+    public static final String ATTRIBUTE_MECHANISM_RESULT = "Mechanism.result";
+
     protected String qualifier = "+";
 
     private Mechanism mechanism = null;
@@ -72,7 +74,12 @@
         // if already have a current result we don't run this
         if (spfData.getCurrentResult() == null) {
 
-            if (mechanism.run(spfData)) {
+            spfData.setAttribute(ATTRIBUTE_MECHANISM_RESULT, null);
+
+            mechanism.checkSPF(spfData);
+            
+            Boolean res = (Boolean) spfData.getAttribute(ATTRIBUTE_MECHANISM_RESULT);
+            if (res != null ? res.booleanValue() : true) {
                 if (qualifier.equals("")) {
                     spfData.setCurrentResult(SPF1Constants.PASS);
                 } else {

Modified: james/jspf/branches/asynch-jspf/src/main/java/org/apache/james/jspf/core/Mechanism.java
URL: http://svn.apache.org/viewvc/james/jspf/branches/asynch-jspf/src/main/java/org/apache/james/jspf/core/Mechanism.java?view=diff&rev=531131&r1=531130&r2=531131
==============================================================================
--- james/jspf/branches/asynch-jspf/src/main/java/org/apache/james/jspf/core/Mechanism.java
(original)
+++ james/jspf/branches/asynch-jspf/src/main/java/org/apache/james/jspf/core/Mechanism.java
Sat Apr 21 17:53:07 2007
@@ -20,32 +20,11 @@
 
 package org.apache.james.jspf.core;
 
-import org.apache.james.jspf.exceptions.NeutralException;
-import org.apache.james.jspf.exceptions.NoneException;
-import org.apache.james.jspf.exceptions.PermErrorException;
-import org.apache.james.jspf.exceptions.TempErrorException;
 
 /**
  * This Interface represent a mechanismn
  * 
  */
-public interface Mechanism {
+public interface Mechanism extends SPFChecker {
 
-    /**
-     * Run the mechanismn with the give SPF1Data
-     * 
-     * @param spfData
-     *            The SPF1Data
-     * @return true if the mechanism match. Otherwise false
-     * @throws PermErrorException
-     *             Get thrown if there are any errors in modifiers
-     * @throws TempErrorException
-     *             Get thrown if DNS problems detected
-     * @throws NoneException 
-     *             Get thrown if no valid records was found
-     * @throws NeutralException 
-     */
-    public boolean run(SPFSession spfData) throws PermErrorException,
-            TempErrorException, NoneException, NeutralException;
-    
 }

Modified: james/jspf/branches/asynch-jspf/src/main/java/org/apache/james/jspf/terms/AMechanism.java
URL: http://svn.apache.org/viewvc/james/jspf/branches/asynch-jspf/src/main/java/org/apache/james/jspf/terms/AMechanism.java?view=diff&rev=531131&r1=531130&r2=531131
==============================================================================
--- james/jspf/branches/asynch-jspf/src/main/java/org/apache/james/jspf/terms/AMechanism.java
(original)
+++ james/jspf/branches/asynch-jspf/src/main/java/org/apache/james/jspf/terms/AMechanism.java
Sat Apr 21 17:53:07 2007
@@ -24,6 +24,7 @@
 import org.apache.james.jspf.core.DNSRequest;
 import org.apache.james.jspf.core.DNSResponse;
 import org.apache.james.jspf.core.DNSService;
+import org.apache.james.jspf.core.Directive;
 import org.apache.james.jspf.core.IPAddr;
 import org.apache.james.jspf.core.SPFChecker;
 import org.apache.james.jspf.core.SPFSession;
@@ -46,7 +47,7 @@
  */
 public class AMechanism extends GenericMechanism implements DNSServiceEnabled {
 
-    private static final String ATTRIBUTE_AMECHANISM_RESULT = "AMechanism.result";
+    private static final String ATTRIBUTE_AMECHANISM_IPV4CHECK = "AMechanism.ipv4check";
 
     /**
      * ABNF: A = "a" [ ":" domain-spec ] [ dual-cidr-length ]
@@ -62,13 +63,9 @@
     protected DNSService dnsService;
 
     /**
-     * 
-     * @throws NoneException 
-     * @throws NeutralException 
-     * @see org.apache.james.jspf.core.GenericMechanism#run(org.apache.james.jspf.core.SPFSession)
+     * @see org.apache.james.jspf.core.SPFChecker#checkSPF(org.apache.james.jspf.core.SPFSession)
      */
-    public boolean run(SPFSession spfData) throws PermErrorException,
-            TempErrorException, NeutralException, NoneException {
+    public void checkSPF(SPFSession spfData) throws PermErrorException, TempErrorException,
NeutralException, NoneException {
         // update currentDepth
         spfData.increaseCurrentDepth();
 
@@ -82,7 +79,7 @@
                 // get the ipAddress
                 try {
                     boolean validIPV4Address = Inet6Util.isValidIPV4Address(spfData.getIpAddress());
-                    spfData.setAttribute("AMechanism.ipv4check", Boolean.valueOf(validIPV4Address));
+                    spfData.setAttribute(ATTRIBUTE_AMECHANISM_IPV4CHECK, Boolean.valueOf(validIPV4Address));
                     if (validIPV4Address) {
 
                         List aRecords = getARecords(dnsService,host);
@@ -115,9 +112,6 @@
         };
         
         DNSResolver.hostExpand(dnsService, macroExpand, getDomain(), spfData, MacroExpand.DOMAIN,
checker);
-        
-        Boolean res = (Boolean) spfData.getAttribute(ATTRIBUTE_AMECHANISM_RESULT);
-        return res != null ? res.booleanValue() : false;
     }
 
     /**
@@ -266,18 +260,18 @@
         }
         // no a records just return null
         if (listAData == null) {
-            spfSession.setAttribute(ATTRIBUTE_AMECHANISM_RESULT, Boolean.FALSE);
+            spfSession.setAttribute(Directive.ATTRIBUTE_MECHANISM_RESULT, Boolean.FALSE);
             return;
         }
 
-        Boolean ipv4check = (Boolean) spfSession.getAttribute("AMechanism.ipv4check");
+        Boolean ipv4check = (Boolean) spfSession.getAttribute(ATTRIBUTE_AMECHANISM_IPV4CHECK);
         if (ipv4check.booleanValue()) {
 
             IPAddr checkAddress = IPAddr.getAddress(spfSession.getIpAddress(),
                     getIp4cidr());
 
             if (checkAddressList(checkAddress, listAData, getIp4cidr())) {
-                spfSession.setAttribute(ATTRIBUTE_AMECHANISM_RESULT, Boolean.TRUE);
+                spfSession.setAttribute(Directive.ATTRIBUTE_MECHANISM_RESULT, Boolean.TRUE);
                 return;
             }
 
@@ -287,13 +281,13 @@
                     getIp6cidr());
             
             if (checkAddressList(checkAddress, listAData, getIp6cidr())) {
-                spfSession.setAttribute(ATTRIBUTE_AMECHANISM_RESULT, Boolean.TRUE);
+                spfSession.setAttribute(Directive.ATTRIBUTE_MECHANISM_RESULT, Boolean.TRUE);
                 return;
             }
 
         }
         
-        spfSession.setAttribute(ATTRIBUTE_AMECHANISM_RESULT, Boolean.FALSE);
+        spfSession.setAttribute(Directive.ATTRIBUTE_MECHANISM_RESULT, Boolean.FALSE);
         return;
     }
 

Modified: james/jspf/branches/asynch-jspf/src/main/java/org/apache/james/jspf/terms/AllMechanism.java
URL: http://svn.apache.org/viewvc/james/jspf/branches/asynch-jspf/src/main/java/org/apache/james/jspf/terms/AllMechanism.java?view=diff&rev=531131&r1=531130&r2=531131
==============================================================================
--- james/jspf/branches/asynch-jspf/src/main/java/org/apache/james/jspf/terms/AllMechanism.java
(original)
+++ james/jspf/branches/asynch-jspf/src/main/java/org/apache/james/jspf/terms/AllMechanism.java
Sat Apr 21 17:53:07 2007
@@ -35,10 +35,10 @@
     public static final String REGEX = "[aA][lL][lL]";
 
     /**
-     * @see org.apache.james.jspf.core.Mechanism#run(SPFSession)
+     * @see org.apache.james.jspf.core.SPFChecker#checkSPF(org.apache.james.jspf.core.SPFSession)
      */
-    public boolean run(SPFSession spfData) throws PermErrorException {
-        return true;
+    public void checkSPF(SPFSession spfData) throws PermErrorException {
+        return;
     }
 
     /**

Modified: james/jspf/branches/asynch-jspf/src/main/java/org/apache/james/jspf/terms/ExistsMechanism.java
URL: http://svn.apache.org/viewvc/james/jspf/branches/asynch-jspf/src/main/java/org/apache/james/jspf/terms/ExistsMechanism.java?view=diff&rev=531131&r1=531130&r2=531131
==============================================================================
--- james/jspf/branches/asynch-jspf/src/main/java/org/apache/james/jspf/terms/ExistsMechanism.java
(original)
+++ james/jspf/branches/asynch-jspf/src/main/java/org/apache/james/jspf/terms/ExistsMechanism.java
Sat Apr 21 17:53:07 2007
@@ -23,6 +23,7 @@
 import org.apache.james.jspf.core.DNSRequest;
 import org.apache.james.jspf.core.DNSResponse;
 import org.apache.james.jspf.core.DNSService;
+import org.apache.james.jspf.core.Directive;
 import org.apache.james.jspf.core.SPFChecker;
 import org.apache.james.jspf.core.SPFSession;
 import org.apache.james.jspf.exceptions.NeutralException;
@@ -47,17 +48,12 @@
     public static final String REGEX = "[eE][xX][iI][sS][tT][sS]" + "\\:"
             + SPFTermsRegexps.DOMAIN_SPEC_REGEX;
 
-    private static final String ATTRIBUTE_MECHANISM_RESULT = "ExistsMechanism.result";
-    
     private DNSService dnsService;
 
     /**
-     * 
-     * @throws NoneException 
-     * @throws NeutralException 
-     * @see org.apache.james.jspf.core.GenericMechanism#run(org.apache.james.jspf.core.SPFSession)
+     * @see org.apache.james.jspf.core.SPFChecker#checkSPF(org.apache.james.jspf.core.SPFSession)
      */
-    public boolean run(SPFSession spfData) throws PermErrorException,
+    public void checkSPF(SPFSession spfData) throws PermErrorException,
             TempErrorException, NeutralException, NoneException {
         // update currentDepth
         spfData.increaseCurrentDepth();
@@ -74,9 +70,6 @@
         
         DNSResolver.hostExpand(dnsService, macroExpand, getDomain(), spfData, MacroExpand.DOMAIN,
checker);
         
-        Boolean res = (Boolean) spfData.getAttribute(ATTRIBUTE_MECHANISM_RESULT);
-        return res != null ? res.booleanValue() : false;
-
     }
 
     /**
@@ -88,17 +81,17 @@
         try {
             aRecords = response.getResponse();
         } catch (DNSService.TimeoutException e) {
-            spfSession.setAttribute(ATTRIBUTE_MECHANISM_RESULT, Boolean.FALSE);
+            spfSession.setAttribute(Directive.ATTRIBUTE_MECHANISM_RESULT, Boolean.FALSE);
             return;
         }
         
         if (aRecords != null && aRecords.size() > 0) {
-            spfSession.setAttribute(ATTRIBUTE_MECHANISM_RESULT, Boolean.TRUE);
+            spfSession.setAttribute(Directive.ATTRIBUTE_MECHANISM_RESULT, Boolean.TRUE);
             return;
         }
         
         // No match found
-        spfSession.setAttribute(ATTRIBUTE_MECHANISM_RESULT, Boolean.FALSE);
+        spfSession.setAttribute(Directive.ATTRIBUTE_MECHANISM_RESULT, Boolean.FALSE);
     }
 
     /**

Modified: james/jspf/branches/asynch-jspf/src/main/java/org/apache/james/jspf/terms/IP4Mechanism.java
URL: http://svn.apache.org/viewvc/james/jspf/branches/asynch-jspf/src/main/java/org/apache/james/jspf/terms/IP4Mechanism.java?view=diff&rev=531131&r1=531130&r2=531131
==============================================================================
--- james/jspf/branches/asynch-jspf/src/main/java/org/apache/james/jspf/terms/IP4Mechanism.java
(original)
+++ james/jspf/branches/asynch-jspf/src/main/java/org/apache/james/jspf/terms/IP4Mechanism.java
Sat Apr 21 17:53:07 2007
@@ -21,6 +21,7 @@
 package org.apache.james.jspf.terms;
 
 import org.apache.james.jspf.core.Configuration;
+import org.apache.james.jspf.core.Directive;
 import org.apache.james.jspf.core.IPAddr;
 import org.apache.james.jspf.core.SPFSession;
 import org.apache.james.jspf.exceptions.PermErrorException;
@@ -44,18 +45,13 @@
      * 
      * @see org.apache.james.jspf.core.GenericMechanism#run(org.apache.james.jspf.core.SPFSession)
      */
-    public boolean run(SPFSession spfData) throws PermErrorException {
+    public void checkSPF(SPFSession spfData) throws PermErrorException {
         IPAddr originalIP;
 
         originalIP = IPAddr.getAddress(spfData.getIpAddress(), getIp()
                 .getMaskLength());
 
-        if (getIp().getMaskedIPAddress().equals(originalIP.getMaskedIPAddress())) {
-            return true;
-        } else {
-            // No match
-            return false;
-        }
+        spfData.setAttribute(Directive.ATTRIBUTE_MECHANISM_RESULT, Boolean.valueOf(getIp().getMaskedIPAddress().equals(originalIP.getMaskedIPAddress())));
     }
 
     /**

Modified: james/jspf/branches/asynch-jspf/src/main/java/org/apache/james/jspf/terms/IncludeMechanism.java
URL: http://svn.apache.org/viewvc/james/jspf/branches/asynch-jspf/src/main/java/org/apache/james/jspf/terms/IncludeMechanism.java?view=diff&rev=531131&r1=531130&r2=531131
==============================================================================
--- james/jspf/branches/asynch-jspf/src/main/java/org/apache/james/jspf/terms/IncludeMechanism.java
(original)
+++ james/jspf/branches/asynch-jspf/src/main/java/org/apache/james/jspf/terms/IncludeMechanism.java
Sat Apr 21 17:53:07 2007
@@ -24,6 +24,7 @@
 import org.apache.james.jspf.core.Configuration;
 import org.apache.james.jspf.core.DNSResponse;
 import org.apache.james.jspf.core.DNSService;
+import org.apache.james.jspf.core.Directive;
 import org.apache.james.jspf.core.Logger;
 import org.apache.james.jspf.core.Mechanism;
 import org.apache.james.jspf.core.SPF1Constants;
@@ -64,19 +65,9 @@
     private DNSService dnsService;
 
     /**
-     * Set the host which should be used for include
-     * 
-     * @param spfData
-     *            The SPF1Data which should used
-     * @return The host which should be included
-     * @throws PermErrorException
-     *             if an error is in the redirect modifier
-     * @throws TempErrorException 
-     *             if the dns return a temp error
-     * @throws NoneException 
-     * @throws NeutralException 
+     * @see org.apache.james.jspf.core.SPFChecker#checkSPF(org.apache.james.jspf.core.SPFSession)
      */
-    public boolean run(SPFSession spfData) throws PermErrorException, TempErrorException,
NoneException {
+    public void checkSPF(SPFSession spfData) throws PermErrorException, TempErrorException,
NoneException {
         // update currentDepth
         spfData.increaseCurrentDepth();      
         
@@ -116,10 +107,10 @@
                         throw new TempErrorException("included checkSPF returned null");
                     } else if (spfData.getCurrentResult().equals(SPF1Constants.PASS)) {
                         // TODO this won't work asynchronously
-                        spfData.setAttribute("IncludeMechanism.result", Boolean.TRUE);
+                        spfData.setAttribute(Directive.ATTRIBUTE_MECHANISM_RESULT, Boolean.TRUE);
                     } else if (spfData.getCurrentResult().equals(SPF1Constants.FAIL) || spfData.getCurrentResult().equals(SPF1Constants.SOFTFAIL)
|| spfData.getCurrentResult().equals(SPF1Constants.NEUTRAL)) {
                         // TODO this won't work asynchronously
-                        spfData.setAttribute("IncludeMechanism.result", Boolean.FALSE);
+                        spfData.setAttribute(Directive.ATTRIBUTE_MECHANISM_RESULT, Boolean.FALSE);
                     } else {
                         throw new TempErrorException("included checkSPF returned an Illegal
result");
                     }
@@ -141,10 +132,6 @@
             // TODO Auto-generated catch block
             e.printStackTrace();
         }
-        
-        // TODO this won't work asynchronously
-        Boolean res = (Boolean) spfData.getAttribute("IncludeMechanism.result");
-        return res != null ? res.booleanValue() : false;
     }
 
     /**

Modified: james/jspf/branches/asynch-jspf/src/main/java/org/apache/james/jspf/terms/MXMechanism.java
URL: http://svn.apache.org/viewvc/james/jspf/branches/asynch-jspf/src/main/java/org/apache/james/jspf/terms/MXMechanism.java?view=diff&rev=531131&r1=531130&r2=531131
==============================================================================
--- james/jspf/branches/asynch-jspf/src/main/java/org/apache/james/jspf/terms/MXMechanism.java
(original)
+++ james/jspf/branches/asynch-jspf/src/main/java/org/apache/james/jspf/terms/MXMechanism.java
Sat Apr 21 17:53:07 2007
@@ -23,6 +23,7 @@
 import org.apache.james.jspf.core.DNSRequest;
 import org.apache.james.jspf.core.DNSResponse;
 import org.apache.james.jspf.core.DNSService;
+import org.apache.james.jspf.core.Directive;
 import org.apache.james.jspf.core.IPAddr;
 import org.apache.james.jspf.core.SPFChecker;
 import org.apache.james.jspf.core.SPFSession;
@@ -52,16 +53,10 @@
             + SPFTermsRegexps.DOMAIN_SPEC_REGEX + ")?" + "(?:"
             + DUAL_CIDR_LENGTH_REGEX + ")?";
     
-    private static final String ATTRIBUTE_MECHANISM_RESULT = "MXMechanism.result";
-
     /**
-     * 
-     * @throws NoneException 
-     * @throws NeutralException 
-     * @throws NoneException 
-     * @see org.apache.james.jspf.core.GenericMechanism#run(org.apache.james.jspf.core.SPFSession)
+     * @see org.apache.james.jspf.terms.AMechanism#checkSPF(org.apache.james.jspf.core.SPFSession)
      */
-    public boolean run(SPFSession spfData) throws PermErrorException,
+    public void checkSPF(SPFSession spfData) throws PermErrorException,
             TempErrorException, NeutralException, NoneException{
 
         // update currentDepth
@@ -81,9 +76,6 @@
         };
         
         DNSResolver.hostExpand(dnsService, macroExpand, getDomain(), spfData, MacroExpand.DOMAIN,
checker);
-        
-        Boolean res = (Boolean) spfData.getAttribute(ATTRIBUTE_MECHANISM_RESULT);
-        return res != null ? res.booleanValue() : false;
     }
 
     /**
@@ -102,7 +94,7 @@
                 
                 if (records == null) {
                     // no mx record found
-                    spfSession.setAttribute(ATTRIBUTE_MECHANISM_RESULT, Boolean.FALSE);
+                    spfSession.setAttribute(Directive.ATTRIBUTE_MECHANISM_RESULT, Boolean.FALSE);
                     return;
                 }
                 
@@ -137,7 +129,7 @@
                 
             // no mx record found
             if (mxR == null || mxR.size() == 0) {
-                spfSession.setAttribute(ATTRIBUTE_MECHANISM_RESULT, Boolean.FALSE);
+                spfSession.setAttribute(Directive.ATTRIBUTE_MECHANISM_RESULT, Boolean.FALSE);
                 return;
             }
             
@@ -148,7 +140,7 @@
             // clean up attributes
             spfSession.setAttribute(ATTRIBUTE_CHECK_RECORDS, null);
             spfSession.setAttribute(ATTRIBUTE_MX_RECORDS, null);
-            spfSession.setAttribute(ATTRIBUTE_MECHANISM_RESULT, Boolean.valueOf(checkAddressList(checkAddress,
mxR, getIp4cidr())));
+            spfSession.setAttribute(Directive.ATTRIBUTE_MECHANISM_RESULT, Boolean.valueOf(checkAddressList(checkAddress,
mxR, getIp4cidr())));
             return;
             
         } catch (DNSService.TimeoutException e) {

Modified: james/jspf/branches/asynch-jspf/src/main/java/org/apache/james/jspf/terms/PTRMechanism.java
URL: http://svn.apache.org/viewvc/james/jspf/branches/asynch-jspf/src/main/java/org/apache/james/jspf/terms/PTRMechanism.java?view=diff&rev=531131&r1=531130&r2=531131
==============================================================================
--- james/jspf/branches/asynch-jspf/src/main/java/org/apache/james/jspf/terms/PTRMechanism.java
(original)
+++ james/jspf/branches/asynch-jspf/src/main/java/org/apache/james/jspf/terms/PTRMechanism.java
Sat Apr 21 17:53:07 2007
@@ -23,6 +23,7 @@
 import org.apache.james.jspf.core.DNSRequest;
 import org.apache.james.jspf.core.DNSResponse;
 import org.apache.james.jspf.core.DNSService;
+import org.apache.james.jspf.core.Directive;
 import org.apache.james.jspf.core.IPAddr;
 import org.apache.james.jspf.core.SPFChecker;
 import org.apache.james.jspf.core.SPFSession;
@@ -54,17 +55,13 @@
      */
     public static final String REGEX = "[pP][tT][rR]" + "(?:\\:"
             + SPFTermsRegexps.DOMAIN_SPEC_REGEX + ")?";
-
-    private static final String ATTRIBUTE_MECHANISM_RESULT = "PTRMechanism.result";
     
     private DNSService dnsService;
 
     /**
-     * @throws NoneException 
-     * @throws NeutralException 
-     * @see org.apache.james.jspf.core.Mechanism#run(org.apache.james.jspf.core.SPFSession)
+     * @see org.apache.james.jspf.core.SPFChecker#checkSPF(org.apache.james.jspf.core.SPFSession)
      */
-    public boolean run(SPFSession spfData) throws PermErrorException,
+    public void checkSPF(SPFSession spfData) throws PermErrorException,
             TempErrorException, NeutralException, NoneException {
         // update currentDepth
         spfData.increaseCurrentDepth();
@@ -90,11 +87,6 @@
         };
         
         DNSResolver.hostExpand(dnsService, macroExpand, getDomain(), spfData, MacroExpand.DOMAIN,
checker);
-        
-        Boolean res = (Boolean) spfData.getAttribute(ATTRIBUTE_MECHANISM_RESULT);
-        return res != null ? res.booleanValue() : false;
-
-        
     }
 
     /**
@@ -118,7 +110,7 @@
                 
                 // No PTR records found
                 if (domainList == null) {
-                    spfSession.setAttribute(ATTRIBUTE_MECHANISM_RESULT, Boolean.FALSE);
+                    spfSession.setAttribute(Directive.ATTRIBUTE_MECHANISM_RESULT, Boolean.FALSE);
                     return;
                 }
         
@@ -146,7 +138,7 @@
                             
                             if (compareDomain.equals(host)
                                     || compareDomain.endsWith("." + host)) {
-                                spfSession.setAttribute(ATTRIBUTE_MECHANISM_RESULT, Boolean.TRUE);
+                                spfSession.setAttribute(Directive.ATTRIBUTE_MECHANISM_RESULT,
Boolean.TRUE);
                                 return;
                             }
                             
@@ -180,7 +172,7 @@
                 onDNSResponse(DNSResolver.lookup(dnsService, dnsRequest), spfSession);
                 return;
             } else {
-                spfSession.setAttribute(ATTRIBUTE_MECHANISM_RESULT, Boolean.FALSE);
+                spfSession.setAttribute(Directive.ATTRIBUTE_MECHANISM_RESULT, Boolean.FALSE);
                 return;
             }
 



---------------------------------------------------------------------
To unsubscribe, e-mail: server-dev-unsubscribe@james.apache.org
For additional commands, e-mail: server-dev-help@james.apache.org


Mime
View raw message