Hi all,

This commit fixes some broken security checks in DatagramSocket.
Note that (with GCJ at least) the check in receive does not happen
because for some reason isConnected() always returns false.  I was
looking into it, but my priorities are somewhat different now so
I'm committing it as is.

Cheers,
Gary
Index: ChangeLog
===================================================================
RCS file: /cvsroot/classpath/classpath/ChangeLog,v
retrieving revision 1.8810
diff -u -r1.8810 ChangeLog
--- ChangeLog   16 Nov 2006 20:49:03 -0000      1.8810
+++ ChangeLog   17 Nov 2006 15:08:27 -0000
@@ -1,3 +1,8 @@
+2006-11-17  Gary Benson  <[EMAIL PROTECTED]>
+
+       * java/net/DatagramSocket.java (getLocalAddress, connect,
+       receive): Perform security check on address not hostname.
+
 2006-11-16  Roman Kennke  <[EMAIL PROTECTED]>
 
        * gnu/javax/swing/text/html/parser/support/Parser.java
Index: java/net/DatagramSocket.java
===================================================================
RCS file: /cvsroot/classpath/classpath/java/net/DatagramSocket.java,v
retrieving revision 1.49
diff -u -r1.49 DatagramSocket.java
--- java/net/DatagramSocket.java        17 Sep 2006 07:31:42 -0000      1.49
+++ java/net/DatagramSocket.java        17 Nov 2006 15:08:27 -0000
@@ -325,7 +325,7 @@
 
        SecurityManager s = System.getSecurityManager();
        if (s != null)
-         s.checkConnect(localAddr.getHostName(), -1);
+         s.checkConnect(localAddr.getHostAddress(), -1);
       }
     catch (SecurityException e)
       {
@@ -525,7 +525,7 @@
 
     SecurityManager sm = System.getSecurityManager();
     if (sm != null)
-      sm.checkConnect(address.getHostName(), port);
+      sm.checkConnect(address.getHostAddress(), port);
 
     try
       {
@@ -608,7 +608,7 @@
 
     SecurityManager s = System.getSecurityManager();
     if (s != null && isConnected())
-      s.checkAccept(p.getAddress().getHostName(), p.getPort());
+      s.checkAccept(p.getAddress().getHostAddress(), p.getPort());
   }
 
   /**

Reply via email to