james-server-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From nor...@apache.org
Subject svn commit: r451870 - in /james/jspf/trunk/src/main/java/org/apache/james/jspf: core/IPAddr.java core/SPF1Data.java terms/PTRMechanism.java
Date Mon, 02 Oct 2006 03:56:38 GMT
Author: norman
Date: Sun Oct  1 20:56:37 2006
New Revision: 451870

URL: http://svn.apache.org/viewvc?view=rev&rev=451870
Log:
lookup AAAA-Record in PTR if the connecting ip is ip6
move some code

Modified:
    james/jspf/trunk/src/main/java/org/apache/james/jspf/core/IPAddr.java
    james/jspf/trunk/src/main/java/org/apache/james/jspf/core/SPF1Data.java
    james/jspf/trunk/src/main/java/org/apache/james/jspf/terms/PTRMechanism.java

Modified: james/jspf/trunk/src/main/java/org/apache/james/jspf/core/IPAddr.java
URL: http://svn.apache.org/viewvc/james/jspf/trunk/src/main/java/org/apache/james/jspf/core/IPAddr.java?view=diff&rev=451870&r1=451869&r2=451870
==============================================================================
--- james/jspf/trunk/src/main/java/org/apache/james/jspf/core/IPAddr.java (original)
+++ james/jspf/trunk/src/main/java/org/apache/james/jspf/core/IPAddr.java Sun Oct  1 20:56:37
2006
@@ -293,9 +293,9 @@
     public String getReverseIP() {
         if(isIPV6(getIPAddress())) {
             StringBuffer ip6 = new StringBuffer(getNibbleFormat());
-            return ip6.reverse().toString();     
+            return ip6.reverse().append(".ip6.arpa").toString();     
         }
-        return getIPAddress(reverseIP(address));
+        return (getIPAddress(reverseIP(address)) + ".in-addr.arpa");
     }
 
     /**

Modified: james/jspf/trunk/src/main/java/org/apache/james/jspf/core/SPF1Data.java
URL: http://svn.apache.org/viewvc/james/jspf/trunk/src/main/java/org/apache/james/jspf/core/SPF1Data.java?view=diff&rev=451870&r1=451869&r2=451870
==============================================================================
--- james/jspf/trunk/src/main/java/org/apache/james/jspf/core/SPF1Data.java (original)
+++ james/jspf/trunk/src/main/java/org/apache/james/jspf/core/SPF1Data.java Sun Oct  1 20:56:37
2006
@@ -191,9 +191,9 @@
                 List records = null;
                 boolean ip6 = IPAddr.isIPV6(ipAddress);
                 if (ip6) {
-                    records = dnsProbe.getRecords(IPAddr.getAddress(ipAddress).getReverseIP()
+ ".ip6.arpa", DNSService.PTR);
+                    records = dnsProbe.getRecords(IPAddr.getAddress(ipAddress).getReverseIP(),
DNSService.PTR);
                 } else {
-                    records = dnsProbe.getRecords(IPAddr.getAddress(ipAddress).getReverseIP()
+ ".in-addr.arpa", DNSService.PTR);
+                    records = dnsProbe.getRecords(IPAddr.getAddress(ipAddress).getReverseIP(),
DNSService.PTR);
                 }
                 if (records != null && records.size() > 0) {
                     String record = (String) records.get(0);

Modified: james/jspf/trunk/src/main/java/org/apache/james/jspf/terms/PTRMechanism.java
URL: http://svn.apache.org/viewvc/james/jspf/trunk/src/main/java/org/apache/james/jspf/terms/PTRMechanism.java?view=diff&rev=451870&r1=451869&r2=451870
==============================================================================
--- james/jspf/trunk/src/main/java/org/apache/james/jspf/terms/PTRMechanism.java (original)
+++ james/jspf/trunk/src/main/java/org/apache/james/jspf/terms/PTRMechanism.java Sun Oct 
1 20:56:37 2006
@@ -59,7 +59,7 @@
         try {
             // Get PTR Records for the ipAddress which is provided by SPF1Data
             IPAddr ip = IPAddr.getAddress(spfData.getIpAddress());
-            List domainList = spfData.getDnsProbe().getRecords(ip.getReverseIP() + ".in-addr.arpa",
DNSService.PTR);
+            List domainList = spfData.getDnsProbe().getRecords(ip.getReverseIP(), DNSService.PTR);
     
             // No PTR records found
             if (domainList == null) return false;
@@ -73,11 +73,18 @@
             }
               
             for (int i = 0; i < domainList.size(); i++) {
-    
-                // Get a record for this
-                List aList = spfData.getDnsProbe().getRecords(
-                        (String) domainList.get(i), DNSService.A);
+                List aList = null;
                 
+                // check if the connecting ip is ip6. If so lookup AAAA record
+                if (IPAddr.isIPV6(spfData.getIpAddress())) {
+                    // Get aaaa record for this
+                    aList = spfData.getDnsProbe().getRecords(
+                            (String) domainList.get(i), DNSService.AAAA);
+                } else {
+                    // Get a record for this
+                    aList = spfData.getDnsProbe().getRecords(
+                            (String) domainList.get(i), DNSService.A);
+                }
                 if (aList != null) {
                     for (int j = 0; j < aList.size(); j++) {
                         if (aList.get(j).equals(spfData.getIpAddress())) {



---------------------------------------------------------------------
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