db-derby-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rhille...@apache.org
Subject svn commit: r547662 - in /db/derby/code/trunk/java: drda/org/apache/derby/drda/NetworkServerControl.java testing/org/apache/derbyTesting/functionTests/tests/derbynet/SecureServerTest.java
Date Fri, 15 Jun 2007 12:48:36 GMT
Author: rhillegas
Date: Fri Jun 15 05:48:35 2007
New Revision: 547662

URL: http://svn.apache.org/viewvc?view=rev&rev=547662
Log:
DERBY-2811: For privilege granting, map variants of 0.0.0.0 (like 0.00.000.0) as hostname
wildcards too.

Modified:
    db/derby/code/trunk/java/drda/org/apache/derby/drda/NetworkServerControl.java
    db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/derbynet/SecureServerTest.java

Modified: db/derby/code/trunk/java/drda/org/apache/derby/drda/NetworkServerControl.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/drda/org/apache/derby/drda/NetworkServerControl.java?view=diff&rev=547662&r1=547661&r2=547662
==============================================================================
--- db/derby/code/trunk/java/drda/org/apache/derby/drda/NetworkServerControl.java (original)
+++ db/derby/code/trunk/java/drda/org/apache/derby/drda/NetworkServerControl.java Fri Jun
15 05:48:35 2007
@@ -638,12 +638,24 @@
         String  hostname = server.getHost();
         
         if (
-            DERBY_HOSTNAME_WILDCARD.equals( hostname ) ||
+            hostnamesEqual( DERBY_HOSTNAME_WILDCARD, hostname ) ||
             IPV6_HOSTNAME_WILDCARD.equals( hostname ) 
             )
         { hostname = SOCKET_PERMISSION_HOSTNAME_WILDCARD; }
 
         return hostname;
+    }
+
+    // return true if the two hostnames are equivalent
+    private static  boolean hostnamesEqual( String left, String right )
+    {
+        try {
+            InetAddress leftAddress = InetAddress.getByName( left );
+            InetAddress rightAddress = InetAddress.getByName( right );
+
+            return leftAddress.equals( rightAddress );
+            
+        } catch (Exception e) { return false; }
     }
     
     /**

Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/derbynet/SecureServerTest.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/derbynet/SecureServerTest.java?view=diff&rev=547662&r1=547661&r2=547662
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/derbynet/SecureServerTest.java
(original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/derbynet/SecureServerTest.java
Fri Jun 15 05:48:35 2007
@@ -65,6 +65,7 @@
     private static  final   String  SST_PASSWORD = "marypwd";
     
     private static  final   String  HOSTW = "0.0.0.0";
+    private static  final   String  ALTW = "0.00.000.0";
     private static  final   String  IPV6W = "::";
 
     ///////////////////////////////////////////////////////////////////////////////////
@@ -184,6 +185,7 @@
         suite.addTest( decorateTest( false,  false, BASIC, null, RUNNING_SECURITY_BOOTED
) );
         suite.addTest( decorateTest( false,  true, null, null, RUNNING_SECURITY_BOOTED )
);
         suite.addTest( decorateTest( false,  true, null, HOSTW, RUNNING_SECURITY_BOOTED )
);
+        suite.addTest( decorateTest( false,  true, null, ALTW, RUNNING_SECURITY_BOOTED )
);
 
         // this wildcard port is rejected by the server right now
         //suite.addTest( decorateTest( false,  true, null, IPV6W, RUNNING_SECURITY_BOOTED
) );



Mime
View raw message