[jboss-remoting-commits] JBoss Remoting SVN: r5021 - remoting2/branches/2.x/src/main/org/jboss/remoting/transport/sslsocket.

jboss-remoting-commits at lists.jboss.org jboss-remoting-commits at lists.jboss.org
Tue Apr 14 06:24:53 EDT 2009


Author: ron.sigal at jboss.com
Date: 2009-04-14 06:24:53 -0400 (Tue, 14 Apr 2009)
New Revision: 5021

Modified:
   remoting2/branches/2.x/src/main/org/jboss/remoting/transport/sslsocket/SSLSocketClientInvoker.java
Log:
JBREM-1116: Eliminated dependence on SecurityUtility.

Modified: remoting2/branches/2.x/src/main/org/jboss/remoting/transport/sslsocket/SSLSocketClientInvoker.java
===================================================================
--- remoting2/branches/2.x/src/main/org/jboss/remoting/transport/sslsocket/SSLSocketClientInvoker.java	2009-04-14 10:24:31 UTC (rev 5020)
+++ remoting2/branches/2.x/src/main/org/jboss/remoting/transport/sslsocket/SSLSocketClientInvoker.java	2009-04-14 10:24:53 UTC (rev 5021)
@@ -38,6 +38,9 @@
 import java.net.Socket;
 import java.net.InetSocketAddress;
 import java.net.SocketException;
+import java.security.AccessController;
+import java.security.PrivilegedActionException;
+import java.security.PrivilegedExceptionAction;
 import java.util.Map;
 
 /**
@@ -180,7 +183,7 @@
             timeout = 0;
       }
       
-      SecurityUtility.connect(s, inetAddr, timeout);
+      connect(s, inetAddr, timeout);
 
       if (s instanceof SSLSocket)
       {
@@ -231,5 +234,30 @@
       sslSocket.getSession();
       repeater.waitForHandshake();
    }
-
+   
+   static private void connect(final Socket socket, final InetSocketAddress address, final int timeout)
+   throws IOException
+   {
+      if (SecurityUtility.skipAccessControl())
+      {
+         socket.connect(address, timeout);
+         return;
+      }
+      
+      try
+      {
+         AccessController.doPrivileged( new PrivilegedExceptionAction()
+         {
+            public Object run() throws Exception
+            {
+               socket.connect(address, timeout);
+               return null;
+            }
+         });
+      }
+      catch (PrivilegedActionException e)
+      {
+         throw (IOException) e.getCause();
+      }   
+   }
 }
\ No newline at end of file




More information about the jboss-remoting-commits mailing list