james-server-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From nor...@apache.org
Subject svn commit: r451796 - in /james/jspf/trunk/src/main/java/org/apache/james/jspf/core: IPAddr.java SPF1Data.java
Date Sun, 01 Oct 2006 20:02:03 GMT
Author: norman
Date: Sun Oct  1 13:02:03 2006
New Revision: 451796

URL: http://svn.apache.org/viewvc?view=rev&rev=451796
Log:
Fix getReverseIP() for ip6

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

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=451796&r1=451795&r2=451796
==============================================================================
--- 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 13:02:03
2006
@@ -267,6 +267,10 @@
      * @return ipAddress The ipAddress in nibbleFormat 
      */
     public String getNibbleFormat() {
+        return getNibbleFormat(address);
+    }
+    
+    private String getNibbleFormat(int[] address) {
         StringBuffer sb = new StringBuffer();
         int[] ip = address;
         for (int i = 0; i < ip.length; i++) {
@@ -287,6 +291,10 @@
      * @return reverse ipAddress
      */
     public String getReverseIP() {
+        if(isIPV6(getIPAddress())) {
+            StringBuffer ip6 = new StringBuffer(getNibbleFormat());
+            return ip6.reverse().toString();     
+        }
         return getIPAddress(reverseIP(address));
     }
 

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=451796&r1=451795&r2=451796
==============================================================================
--- 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 13:02:03
2006
@@ -185,7 +185,12 @@
     public String getClientDomain() {
         if (clientDomain == null) {
             try {
-                List records = dnsProbe.getRecords(IPAddr.getAddress(ipAddress).getReverseIP()
+ ".in-addr.arpa", DNSService.PTR);
+                List records = null;
+                if (IPAddr.isIPV6(ipAddress)) {
+                    records = dnsProbe.getRecords(IPAddr.getAddress(ipAddress).getReverseIP()
+ ".ip6.arpa", DNSService.PTR);
+                } else {
+                    records = dnsProbe.getRecords(IPAddr.getAddress(ipAddress).getReverseIP()
+ ".in-addr.arpa", DNSService.PTR);
+                }
                 if (records != null && records.size() > 0) {
                     clientDomain = (String) records.get(0);
                 } else {



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