Author: ron.sigal(a)jboss.com
Date: 2008-04-02 00:29:01 -0400 (Wed, 02 Apr 2008)
New Revision: 3856
Modified:
remoting2/branches/2.x/src/main/org/jboss/remoting/transport/socket/MicroSocketClientInvoker.java
Log:
JBREM-934: Put InetAddress.getByName() calls in AccessController.doPrivileged() calls.
Modified:
remoting2/branches/2.x/src/main/org/jboss/remoting/transport/socket/MicroSocketClientInvoker.java
===================================================================
---
remoting2/branches/2.x/src/main/org/jboss/remoting/transport/socket/MicroSocketClientInvoker.java 2008-04-02
04:27:46 UTC (rev 3855)
+++
remoting2/branches/2.x/src/main/org/jboss/remoting/transport/socket/MicroSocketClientInvoker.java 2008-04-02
04:29:01 UTC (rev 3856)
@@ -29,6 +29,7 @@
import java.net.Socket;
import java.net.InetSocketAddress;
import java.net.SocketException;
+import java.net.UnknownHostException;
import java.security.AccessController;
import java.security.PrivilegedActionException;
import java.security.PrivilegedExceptionAction;
@@ -505,7 +506,20 @@
if (!InvokerLocator.MULTIHOME.equals(locator.getHost()))
{
- addr = InetAddress.getByName(locator.getHost());
+ try
+ {
+ addr = (InetAddress)AccessController.doPrivileged( new
PrivilegedExceptionAction()
+ {
+ public Object run() throws UnknownHostException
+ {
+ return InetAddress.getByName(locator.getHost());
+ }
+ });
+ }
+ catch (PrivilegedActionException e)
+ {
+ throw (UnknownHostException) e.getCause();
+ }
port = locator.getPort();
address = createServerAddress(addr, port);
}
@@ -515,8 +529,22 @@
if (homes.size() == 1)
{
// Treat as in non MULTIHOME case.
- Home home = (Home) homes.iterator().next();
- addr = InetAddress.getByName(home.host);
+ final Home home = (Home) homes.iterator().next();
+ try
+ {
+ addr = (InetAddress)AccessController.doPrivileged( new
PrivilegedExceptionAction()
+ {
+ public Object run() throws UnknownHostException
+ {
+ return InetAddress.getByName(home.host);
+ }
+ });
+ }
+ catch (PrivilegedActionException e)
+ {
+ throw (UnknownHostException) e.getCause();
+ }
+
address = createServerAddress(addr, home.port);
}
}
@@ -646,7 +674,21 @@
try
{
home = (Home) it.next();
- addr = InetAddress.getByName(home.host);
+ try
+ {
+ final Home finalHome = home;
+ addr = (InetAddress)AccessController.doPrivileged( new
PrivilegedExceptionAction()
+ {
+ public Object run() throws UnknownHostException
+ {
+ return InetAddress.getByName(finalHome.host);
+ }
+ });
+ }
+ catch (PrivilegedActionException e)
+ {
+ throw (UnknownHostException) e.getCause();
+ }
address = createServerAddress(addr, home.port);
invoke(new InvocationRequest(null, null, ServerInvoker.ECHO, null, null,
null));
if (trace) log.trace(this + " able to contact server at: " +
home);
Show replies by date