You are viewing a plain text version of this content. The canonical link for it is here.
Posted to server-dev@james.apache.org by ba...@apache.org on 2006/10/31 16:36:34 UTC

svn commit: r469528 - /james/jspf/trunk/src/main/java/org/apache/james/jspf/terms/MXMechanism.java

Author: bago
Date: Tue Oct 31 07:36:33 2006
New Revision: 469528

URL: http://svn.apache.org/viewvc?view=rev&rev=469528
Log:
Fix failing unit test on MX mechanism when remote address in an IPv6

Modified:
    james/jspf/trunk/src/main/java/org/apache/james/jspf/terms/MXMechanism.java

Modified: james/jspf/trunk/src/main/java/org/apache/james/jspf/terms/MXMechanism.java
URL: http://svn.apache.org/viewvc/james/jspf/trunk/src/main/java/org/apache/james/jspf/terms/MXMechanism.java?view=diff&rev=469528&r1=469527&r2=469528
==============================================================================
--- james/jspf/trunk/src/main/java/org/apache/james/jspf/terms/MXMechanism.java (original)
+++ james/jspf/trunk/src/main/java/org/apache/james/jspf/terms/MXMechanism.java Tue Oct 31 07:36:33 2006
@@ -59,10 +59,13 @@
         // Get the right host.
         String host = expandHost(spfData);
 
+        // if the remote IP is an ipv6 we check ipv6 addresses, otherwise ip4
+        boolean isIPv6 = IPAddr.isIPV6(spfData.getIpAddress());
+        
         // get the ipAddress
-        checkAddress = IPAddr.getAddress(spfData.getIpAddress(), getIp4cidr());
+        checkAddress = IPAddr.getAddress(spfData.getIpAddress(), isIPv6 ? getIp6cidr() : getIp4cidr());
         
-        List mxRecords = getMXRecords(dnsService, host);
+        List mxRecords = getMXRecords(dnsService, host, isIPv6 ? DNSService.AAAA : DNSService.A);
 
         // no mx record found
         if (mxRecords == null) return false;
@@ -77,10 +80,11 @@
 
 
     /**
+     * @param type 
      * @see org.apache.james.jspf.core.DNSService#getMXRecords(java.lang.String,
      *      int)
      */
-    public List getMXRecords(DNSService dnsProbe, String domainName)
+    private List getMXRecords(DNSService dnsProbe, String domainName, int type)
             throws PermErrorException, TempErrorException {
         try {
             List mxR = null;
@@ -96,7 +100,7 @@
                 if (mx != null && mx.length() > 0) {
                     log.debug("Add MX-Record " + mx + " to list");
         
-                    List res = dnsProbe.getRecords(mx, DNSService.A);
+                    List res = dnsProbe.getRecords(mx, type);
                     if (res != null) {
                         if (mxR == null) {
                             mxR = new ArrayList();



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