JBoss Remoting SVN: r3856 - remoting2/branches/2.x/src/main/org/jboss/remoting/transport/socket.
by jboss-remoting-commits@lists.jboss.org
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);
18 years, 1 month
JBoss Remoting SVN: r3855 - remoting2/branches/2.x/src/main/org/jboss/remoting/transport/servlet.
by jboss-remoting-commits@lists.jboss.org
Author: ron.sigal(a)jboss.com
Date: 2008-04-02 00:27:46 -0400 (Wed, 02 Apr 2008)
New Revision: 3855
Modified:
remoting2/branches/2.x/src/main/org/jboss/remoting/transport/servlet/ServletServerInvoker.java
Log:
JBREM-934: Put InetAddress.getByName() calls in AccessController.doPrivileged() calls.
Modified: remoting2/branches/2.x/src/main/org/jboss/remoting/transport/servlet/ServletServerInvoker.java
===================================================================
--- remoting2/branches/2.x/src/main/org/jboss/remoting/transport/servlet/ServletServerInvoker.java 2008-04-02 04:26:52 UTC (rev 3854)
+++ remoting2/branches/2.x/src/main/org/jboss/remoting/transport/servlet/ServletServerInvoker.java 2008-04-02 04:27:46 UTC (rev 3855)
@@ -26,7 +26,6 @@
import org.jboss.remoting.InvocationResponse;
import org.jboss.remoting.InvokerLocator;
import org.jboss.remoting.Remoting;
-import org.jboss.remoting.Version;
import org.jboss.remoting.marshal.MarshalFactory;
import org.jboss.remoting.marshal.Marshaller;
import org.jboss.remoting.marshal.UnMarshaller;
@@ -48,6 +47,10 @@
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.net.InetAddress;
+import java.net.UnknownHostException;
+import java.security.AccessController;
+import java.security.PrivilegedActionException;
+import java.security.PrivilegedExceptionAction;
import java.util.Enumeration;
import java.util.HashMap;
import java.util.Map;
@@ -144,8 +147,23 @@
}
}
- String remoteAddressString = request.getRemoteAddr();
- InetAddress remoteAddress = InetAddress.getByName(remoteAddressString);
+ final String remoteAddressString = request.getRemoteAddr();
+ InetAddress remoteAddress = null;
+ try
+ {
+ remoteAddress = (InetAddress)AccessController.doPrivileged( new PrivilegedExceptionAction()
+ {
+ public Object run() throws UnknownHostException
+ {
+ return InetAddress.getByName(remoteAddressString);
+ }
+ });
+ }
+ catch (PrivilegedActionException e)
+ {
+ throw (UnknownHostException) e.getCause();
+ }
+
Map requestPayload = invocationRequest.getRequestPayload();
if (requestPayload == null)
@@ -286,8 +304,22 @@
}
}
- String remoteAddressString = request.getRemoteAddr();
- InetAddress remoteAddress = InetAddress.getByName(remoteAddressString);
+ final String remoteAddressString = request.getRemoteAddr();
+ InetAddress remoteAddress = null;
+ try
+ {
+ remoteAddress = (InetAddress)AccessController.doPrivileged( new PrivilegedExceptionAction()
+ {
+ public Object run() throws UnknownHostException
+ {
+ return InetAddress.getByName(remoteAddressString);
+ }
+ });
+ }
+ catch (PrivilegedActionException e)
+ {
+ throw (UnknownHostException) e.getCause();
+ }
Map requestPayload = invocationRequest.getRequestPayload();
if (requestPayload == null)
18 years, 1 month
JBoss Remoting SVN: r3854 - remoting2/branches/2.x/src/main/org/jboss/remoting/transport/rmi.
by jboss-remoting-commits@lists.jboss.org
Author: ron.sigal(a)jboss.com
Date: 2008-04-02 00:26:52 -0400 (Wed, 02 Apr 2008)
New Revision: 3854
Modified:
remoting2/branches/2.x/src/main/org/jboss/remoting/transport/rmi/RMIServerInvoker.java
Log:
JBREM-934: Put Class.getClassLoader() and InetAddress.getByName() calls in AccessController.doPrivileged() calls.
Modified: remoting2/branches/2.x/src/main/org/jboss/remoting/transport/rmi/RMIServerInvoker.java
===================================================================
--- remoting2/branches/2.x/src/main/org/jboss/remoting/transport/rmi/RMIServerInvoker.java 2008-04-02 04:26:05 UTC (rev 3853)
+++ remoting2/branches/2.x/src/main/org/jboss/remoting/transport/rmi/RMIServerInvoker.java 2008-04-02 04:26:52 UTC (rev 3854)
@@ -45,12 +45,12 @@
import javax.net.SocketFactory;
import java.beans.IntrospectionException;
-import java.io.BufferedOutputStream;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.ObjectOutputStream;
import java.net.InetAddress;
+import java.net.UnknownHostException;
import java.rmi.AccessException;
import java.rmi.Remote;
import java.rmi.RemoteException;
@@ -63,6 +63,7 @@
import java.rmi.server.ServerNotActiveException;
import java.rmi.server.UnicastRemoteObject;
import java.security.AccessController;
+import java.security.PrivilegedAction;
import java.security.PrivilegedActionException;
import java.security.PrivilegedExceptionAction;
import java.util.HashMap;
@@ -236,8 +237,16 @@
throw (IOException) e.getCause();
}
- unmarshaller = MarshalFactory.getUnMarshaller(getLocator(), this.getClass().getClassLoader());
- marshaller = MarshalFactory.getMarshaller(getLocator(), this.getClass().getClassLoader());
+ ClassLoader classLoader = (ClassLoader) AccessController.doPrivileged( new PrivilegedAction()
+ {
+ public Object run()
+ {
+ return RMIServerInvoker.class.getClassLoader();
+ }
+ });
+
+ unmarshaller = MarshalFactory.getUnMarshaller(getLocator(), classLoader);
+ marshaller = MarshalFactory.getMarshaller(getLocator(), classLoader);
}
@@ -451,8 +460,23 @@
}
try
{
- String clientHost = RemoteServer.getClientHost();
- metadata.put(Remoting.CLIENT_ADDRESS, InetAddress.getByName(clientHost));
+ final String clientHost = RemoteServer.getClientHost();
+ InetAddress clientAddress = null;
+ try
+ {
+ clientAddress = (InetAddress)AccessController.doPrivileged( new PrivilegedExceptionAction()
+ {
+ public Object run() throws UnknownHostException
+ {
+ return InetAddress.getByName(clientHost);
+ }
+ });
+ }
+ catch (PrivilegedActionException e)
+ {
+ throw (UnknownHostException) e.getCause();
+ }
+ metadata.put(Remoting.CLIENT_ADDRESS, clientAddress);
}
catch (ServerNotActiveException e)
{
18 years, 1 month
JBoss Remoting SVN: r3853 - remoting2/branches/2.x/src/main/org/jboss/remoting/transport/rmi.
by jboss-remoting-commits@lists.jboss.org
Author: ron.sigal(a)jboss.com
Date: 2008-04-02 00:26:05 -0400 (Wed, 02 Apr 2008)
New Revision: 3853
Modified:
remoting2/branches/2.x/src/main/org/jboss/remoting/transport/rmi/RemotingRMIServerSocketFactory.java
Log:
JBREM-934: Put InetAddress.getByName() call in AccessController.doPrivileged() call.
Modified: remoting2/branches/2.x/src/main/org/jboss/remoting/transport/rmi/RemotingRMIServerSocketFactory.java
===================================================================
--- remoting2/branches/2.x/src/main/org/jboss/remoting/transport/rmi/RemotingRMIServerSocketFactory.java 2008-04-02 04:25:01 UTC (rev 3852)
+++ remoting2/branches/2.x/src/main/org/jboss/remoting/transport/rmi/RemotingRMIServerSocketFactory.java 2008-04-02 04:26:05 UTC (rev 3853)
@@ -23,8 +23,6 @@
package org.jboss.remoting.transport.rmi;
import org.jboss.logging.Logger;
-import org.jboss.remoting.loading.ClassByteClassLoader;
-
import javax.net.ServerSocketFactory;
import java.io.IOException;
import java.io.Serializable;
@@ -117,13 +115,28 @@
this(serverSocketFactory, backlog, bindHost, 60000); // TODO: -TME This needs to be fixed so only comes from parent class
}
- public RemotingRMIServerSocketFactory(ServerSocketFactory serverSocketFactory, int backlog, String bindHost, int timeout)
+ public RemotingRMIServerSocketFactory(ServerSocketFactory serverSocketFactory, int backlog, final String bindHost, int timeout)
throws UnknownHostException
{
this.serverSocketFactory = serverSocketFactory;
this.backlog = backlog;
- this.bindAddress = InetAddress.getByName(bindHost);
this.timeout = timeout;
+
+ try
+ {
+ AccessController.doPrivileged( new PrivilegedExceptionAction()
+ {
+ public Object run() throws UnknownHostException
+ {
+ RemotingRMIServerSocketFactory.this.bindAddress = InetAddress.getByName(bindHost);
+ return null;
+ }
+ });
+ }
+ catch (PrivilegedActionException e)
+ {
+ throw (UnknownHostException) e.getCause();
+ }
}
public RemotingRMIServerSocketFactory(String bindHost, int timeout) throws UnknownHostException
18 years, 1 month
JBoss Remoting SVN: r3852 - remoting2/branches/2.x/src/main/org/jboss/remoting/transport/rmi.
by jboss-remoting-commits@lists.jboss.org
Author: ron.sigal(a)jboss.com
Date: 2008-04-02 00:25:01 -0400 (Wed, 02 Apr 2008)
New Revision: 3852
Modified:
remoting2/branches/2.x/src/main/org/jboss/remoting/transport/rmi/RemotingRMIClientSocketFactory.java
Log:
JBREM-934: Put InetAddress.getByName() call in AccessController.doPrivileged() call.
Modified: remoting2/branches/2.x/src/main/org/jboss/remoting/transport/rmi/RemotingRMIClientSocketFactory.java
===================================================================
--- remoting2/branches/2.x/src/main/org/jboss/remoting/transport/rmi/RemotingRMIClientSocketFactory.java 2008-04-02 04:23:27 UTC (rev 3851)
+++ remoting2/branches/2.x/src/main/org/jboss/remoting/transport/rmi/RemotingRMIClientSocketFactory.java 2008-04-02 04:25:01 UTC (rev 3852)
@@ -42,7 +42,6 @@
import org.jboss.remoting.InvokerLocator;
import org.jboss.remoting.Remoting;
import org.jboss.remoting.Version;
-import org.jboss.remoting.loading.ClassByteClassLoader;
/**
@@ -298,13 +297,26 @@
private int port;
private int hashCode;
- public ComparableHolder(InvokerLocator invokerLocator)
+ public ComparableHolder(final InvokerLocator invokerLocator)
{
protocol = invokerLocator.getProtocol().toLowerCase();
try
{
- host = InetAddress.getByName(invokerLocator.getHost());
+ try
+ {
+ host = (InetAddress)AccessController.doPrivileged( new PrivilegedExceptionAction()
+ {
+ public Object run() throws UnknownHostException
+ {
+ return InetAddress.getByName(invokerLocator.getHost());
+ }
+ });
+ }
+ catch (PrivilegedActionException e)
+ {
+ throw (UnknownHostException) e.getCause();
+ }
}
catch (UnknownHostException e)
{
18 years, 1 month
JBoss Remoting SVN: r3851 - remoting2/branches/2.x/src/main/org/jboss/remoting/transport/http.
by jboss-remoting-commits@lists.jboss.org
Author: ron.sigal(a)jboss.com
Date: 2008-04-02 00:23:27 -0400 (Wed, 02 Apr 2008)
New Revision: 3851
Modified:
remoting2/branches/2.x/src/main/org/jboss/remoting/transport/http/HTTPClientInvoker.java
Log:
JBREM-934: Use SystemUtility.getSystemProperty().
Modified: remoting2/branches/2.x/src/main/org/jboss/remoting/transport/http/HTTPClientInvoker.java
===================================================================
--- remoting2/branches/2.x/src/main/org/jboss/remoting/transport/http/HTTPClientInvoker.java 2008-04-02 04:22:05 UTC (rev 3850)
+++ remoting2/branches/2.x/src/main/org/jboss/remoting/transport/http/HTTPClientInvoker.java 2008-04-02 04:23:27 UTC (rev 3851)
@@ -32,7 +32,6 @@
import org.jboss.remoting.RemoteClientInvoker;
import org.jboss.remoting.ServerInvoker;
import org.jboss.remoting.Version;
-import org.jboss.remoting.loading.ClassByteClassLoader;
import org.jboss.remoting.marshal.MarshalFactory;
import org.jboss.remoting.marshal.Marshaller;
import org.jboss.remoting.marshal.UnMarshaller;
@@ -44,6 +43,7 @@
import org.jboss.remoting.marshal.serializable.SerializableUnMarshaller;
import org.jboss.remoting.serialization.ClassLoaderUtility;
import org.jboss.remoting.transport.web.WebUtil;
+import org.jboss.remoting.util.SystemUtility;
import org.jboss.util.Base64;
import org.jboss.util.threadpool.BasicThreadPool;
import org.jboss.util.threadpool.BlockingMode;
@@ -829,7 +829,7 @@
}
if (username == null || username.length() == 0)
{
- username = System.getProperty("http.proxy.username");
+ username = SystemUtility.getSystemProperty("http.proxy.username");
}
if (metadata != null)
{
@@ -837,7 +837,7 @@
}
if (password == null)
{
- password = System.getProperty("http.proxy.password");
+ password = SystemUtility.getSystemProperty("http.proxy.password");
}
if (username != null && password != null)
@@ -868,20 +868,7 @@
}
if (username == null || username.length() == 0)
{
- try
- {
- username = (String)AccessController.doPrivileged( new PrivilegedExceptionAction()
- {
- public Object run() throws Exception
- {
- return System.getProperty("http.basic.username");
- }
- });
- }
- catch (PrivilegedActionException e)
- {
- log.debug("error", e.getCause());
- }
+ username = SystemUtility.getSystemProperty("http.basic.username");
}
if (metadata != null)
{
@@ -889,20 +876,7 @@
}
if (password == null)
{
- try
- {
- password = (String)AccessController.doPrivileged( new PrivilegedExceptionAction()
- {
- public Object run() throws Exception
- {
- return System.getProperty("http.basic.password");
- }
- });
- }
- catch (PrivilegedActionException e)
- {
- log.debug("error", e.getCause());
- }
+ password = SystemUtility.getSystemProperty("http.basic.password");
}
if (username != null && password != null)
18 years, 1 month
JBoss Remoting SVN: r3850 - remoting2/branches/2.x/src/main/org/jboss/remoting/transport/coyote.
by jboss-remoting-commits@lists.jboss.org
Author: ron.sigal(a)jboss.com
Date: 2008-04-02 00:22:05 -0400 (Wed, 02 Apr 2008)
New Revision: 3850
Modified:
remoting2/branches/2.x/src/main/org/jboss/remoting/transport/coyote/CoyoteInvoker.java
Log:
JBREM-934: Put InetAddress.getByName() and Class().getMethods() calls in AccessController.doPrivileged() calls.
Modified: remoting2/branches/2.x/src/main/org/jboss/remoting/transport/coyote/CoyoteInvoker.java
===================================================================
--- remoting2/branches/2.x/src/main/org/jboss/remoting/transport/coyote/CoyoteInvoker.java 2008-04-02 04:20:20 UTC (rev 3849)
+++ remoting2/branches/2.x/src/main/org/jboss/remoting/transport/coyote/CoyoteInvoker.java 2008-04-02 04:22:05 UTC (rev 3850)
@@ -49,7 +49,6 @@
import javax.net.ServerSocketFactory;
-import java.io.File;
import java.io.IOException;
import java.lang.reflect.Method;
import java.net.InetAddress;
@@ -356,8 +355,22 @@
MessageBytes remoteAddressMB = req.remoteAddr();
if (remoteAddressMB != null)
{
- String remoteAddressString = remoteAddressMB.toString();
- InetAddress remoteAddress = InetAddress.getByName(remoteAddressString);
+ final String remoteAddressString = remoteAddressMB.toString();
+ InetAddress remoteAddress = null;
+ try
+ {
+ remoteAddress = (InetAddress)AccessController.doPrivileged( new PrivilegedExceptionAction()
+ {
+ public Object run() throws UnknownHostException
+ {
+ return InetAddress.getByName(remoteAddressString);
+ }
+ });
+ }
+ catch (PrivilegedActionException e)
+ {
+ throw (UnknownHostException) e.getCause();
+ }
invocationRequest.getRequestPayload().put(Remoting.CLIENT_ADDRESS, remoteAddress);
}
else
@@ -972,13 +985,20 @@
* int or boolean we'll convert value to the right type before) - that means
* you can have setDebug(1).
*/
- public static boolean setProperty(Object o, String name, String value)
+ public static boolean setProperty(final Object o, String name, final String value)
{
String setter = "set" + capitalize(name);
try
{
- Method methods[] = o.getClass().getMethods();
+ Method methods[] = (Method[]) AccessController.doPrivileged( new PrivilegedAction()
+ {
+ public Object run()
+ {
+ return o.getClass().getMethods();
+ }
+ });
+
Method setPropertyMethod = null;
// First, the ideal case - a setFoo( String ) method
@@ -1046,7 +1066,20 @@
{
try
{
- params[0] = InetAddress.getByName(value);
+ try
+ {
+ params[0] = AccessController.doPrivileged( new PrivilegedExceptionAction()
+ {
+ public Object run() throws UnknownHostException
+ {
+ return InetAddress.getByName(value);
+ }
+ });
+ }
+ catch (PrivilegedActionException e)
+ {
+ throw (UnknownHostException) e.getCause();
+ }
}
catch(UnknownHostException exc)
{
18 years, 1 month
JBoss Remoting SVN: r3849 - remoting2/branches/2.x/src/main/org/jboss/remoting/transport.
by jboss-remoting-commits@lists.jboss.org
Author: ron.sigal(a)jboss.com
Date: 2008-04-02 00:20:20 -0400 (Wed, 02 Apr 2008)
New Revision: 3849
Modified:
remoting2/branches/2.x/src/main/org/jboss/remoting/transport/PortUtil.java
Log:
JBREM-934: Put InetAddress.getByName() call in AccessController.doPrivileged() call.
Modified: remoting2/branches/2.x/src/main/org/jboss/remoting/transport/PortUtil.java
===================================================================
--- remoting2/branches/2.x/src/main/org/jboss/remoting/transport/PortUtil.java 2008-04-02 04:18:38 UTC (rev 3848)
+++ remoting2/branches/2.x/src/main/org/jboss/remoting/transport/PortUtil.java 2008-04-02 04:20:20 UTC (rev 3849)
@@ -24,7 +24,6 @@
import java.net.ServerSocket;
import java.net.InetAddress;
-import java.net.Socket;
import java.net.UnknownHostException;
import java.io.IOException;
import java.security.AccessController;
@@ -60,31 +59,38 @@
* @param p
* @return true if available, false if already in use
*/
- public static boolean checkPort(final int p, String host)
+ public static boolean checkPort(final int p, final String host)
{
boolean available = true;
ServerSocket socket = null;
+
try
{
- final InetAddress inetAddress = InetAddress.getByName(host);
-
- socket = (ServerSocket) AccessController.doPrivileged( new PrivilegedExceptionAction()
+ try
{
- public Object run() throws Exception
+ socket = (ServerSocket) AccessController.doPrivileged( new PrivilegedExceptionAction()
{
- return new ServerSocket(p, 0, inetAddress);
- }
- });
+ public Object run() throws Exception
+ {
+ InetAddress inetAddress = InetAddress.getByName(host);
+ return new ServerSocket(p, 0, inetAddress);
+ }
+ });
+ }
+ catch (PrivilegedActionException e)
+ {
+ available = false;
+ throw (IOException) e.getCause();
+ }
}
- catch (PrivilegedActionException e)
- {
- log.debug("port " + p + " already in use. Will try another.", e.getCause());
- available = false;
- }
catch (UnknownHostException e)
{
log.warn("unknown host: " + host);
}
+ catch (IOException e)
+ {
+ log.debug("port " + p + " already in use. Will try another.", e.getCause());
+ }
finally
{
if(socket != null)
18 years, 1 month
JBoss Remoting SVN: r3848 - remoting2/branches/2.x/src/main/org/jboss/remoting/transport.
by jboss-remoting-commits@lists.jboss.org
Author: ron.sigal(a)jboss.com
Date: 2008-04-02 00:18:38 -0400 (Wed, 02 Apr 2008)
New Revision: 3848
Modified:
remoting2/branches/2.x/src/main/org/jboss/remoting/transport/Connector.java
Log:
JBREM-934: Put Class.getClassLoader() and InetAddress.getLocalHost() calls in AccessController.doPrivileged() calls.
Modified: remoting2/branches/2.x/src/main/org/jboss/remoting/transport/Connector.java
===================================================================
--- remoting2/branches/2.x/src/main/org/jboss/remoting/transport/Connector.java 2008-04-02 04:15:09 UTC (rev 3847)
+++ remoting2/branches/2.x/src/main/org/jboss/remoting/transport/Connector.java 2008-04-02 04:18:38 UTC (rev 3848)
@@ -45,7 +45,9 @@
import javax.net.ServerSocketFactory;
import javax.net.SocketFactory;
import java.net.InetAddress;
+import java.net.UnknownHostException;
import java.security.AccessController;
+import java.security.PrivilegedAction;
import java.security.PrivilegedActionException;
import java.security.PrivilegedExceptionAction;
import java.util.HashMap;
@@ -488,7 +490,15 @@
* have to be there. Otherwise, would not be loaded until first client actually reaches the
* target server invoker, where they would otherwise be loaded.
*/
- MarshalFactory.getMarshaller(locator, this.getClass().getClassLoader());
+ ClassLoader classLoader = (ClassLoader) AccessController.doPrivileged( new PrivilegedAction()
+ {
+ public Object run()
+ {
+ return Connector.class.getClassLoader();
+ }
+ });
+
+ MarshalFactory.getMarshaller(locator, classLoader);
Connector marshallerLoader = null;
InvokerLocator loaderLocator = MarshallLoaderFactory.convertLocator(locator);
@@ -553,8 +563,24 @@
String serverBindPort = (String) invokerConfig.get("serverBindPort");
String path = (String) invokerConfig.get("path");
- String host = clientConnectAddress != null ? clientConnectAddress : serverBindAddress != null ? serverBindAddress : InetAddress.getLocalHost().getHostAddress();
- int port = clientConnectPort != null ? Integer.parseInt(clientConnectPort) : serverBindPort != null ? Integer.parseInt(serverBindPort) : PortUtil.findFreePort(serverBindAddress != null ? serverBindAddress : InetAddress.getLocalHost().getHostAddress());
+ String localHostAddress = null;
+ try
+ {
+ localHostAddress = (String)AccessController.doPrivileged( new PrivilegedExceptionAction()
+ {
+ public Object run() throws UnknownHostException
+ {
+ return InetAddress.getLocalHost().getHostAddress();
+ }
+ });
+ }
+ catch (PrivilegedActionException e)
+ {
+ throw (UnknownHostException) e.getCause();
+ }
+
+ String host = clientConnectAddress != null ? clientConnectAddress : serverBindAddress != null ? serverBindAddress : localHostAddress;
+ int port = clientConnectPort != null ? Integer.parseInt(clientConnectPort) : serverBindPort != null ? Integer.parseInt(serverBindPort) : PortUtil.findFreePort(serverBindAddress != null ? serverBindAddress : localHostAddress);
// finally, let's bild the invoker uri
String tempURI = transport + "://" + host + ":" + port;
@@ -678,12 +704,28 @@
boolean parametersStarted = false;
if (connectHomes == null && homes == null)
{
+ String localHostAddress = null;
+ try
+ {
+ localHostAddress = (String)AccessController.doPrivileged( new PrivilegedExceptionAction()
+ {
+ public Object run() throws UnknownHostException
+ {
+ return InetAddress.getLocalHost().getHostAddress();
+ }
+ });
+ }
+ catch (PrivilegedActionException e)
+ {
+ throw (UnknownHostException) e.getCause();
+ }
+
// A single home configuration.
String host = clientConnectAddress != null
? clientConnectAddress
: serverBindAddress != null
? serverBindAddress
- : InetAddress.getLocalHost().getHostAddress();
+ : localHostAddress;
int port = clientConnectPort != null
? Integer.parseInt(clientConnectPort)
@@ -691,7 +733,7 @@
? Integer.parseInt(defaultPortString)
: PortUtil.findFreePort(serverBindAddress != null
? serverBindAddress
- : InetAddress.getLocalHost().getHostAddress());
+ : localHostAddress);
tempURI = transport + "://" + host + ":" + port + ((path != null) ? ("/" + path) : "");
}
18 years, 1 month
JBoss Remoting SVN: r3847 - remoting2/branches/2.x/src/main/org/jboss/remoting/transport.
by jboss-remoting-commits@lists.jboss.org
Author: ron.sigal(a)jboss.com
Date: 2008-04-02 00:15:09 -0400 (Wed, 02 Apr 2008)
New Revision: 3847
Modified:
remoting2/branches/2.x/src/main/org/jboss/remoting/transport/AddressUtil.java
Log:
JBREM-934: Put InetAddress.getByName() call in AccessController.doPrivileged() call.
Modified: remoting2/branches/2.x/src/main/org/jboss/remoting/transport/AddressUtil.java
===================================================================
--- remoting2/branches/2.x/src/main/org/jboss/remoting/transport/AddressUtil.java 2008-04-02 04:13:18 UTC (rev 3846)
+++ remoting2/branches/2.x/src/main/org/jboss/remoting/transport/AddressUtil.java 2008-04-02 04:15:09 UTC (rev 3847)
@@ -22,10 +22,10 @@
*/
package org.jboss.remoting.transport;
-import java.io.IOException;
import java.net.InetAddress;
import java.net.ServerSocket;
import java.net.Socket;
+import java.net.UnknownHostException;
import java.security.AccessController;
import java.security.PrivilegedActionException;
import java.security.PrivilegedExceptionAction;
@@ -52,13 +52,29 @@
return checkAddress(host, 5000);
}
- public static boolean checkAddress(String host, int timeout) throws Exception
+ public static boolean checkAddress(final String host, int timeout) throws Exception
{
try
{
log.trace("checking host: " + host);
int port = PortUtil.findFreePort(host);
- InetAddress addr = InetAddress.getByName(host);
+
+ InetAddress addr = null;
+ try
+ {
+ addr = (InetAddress)AccessController.doPrivileged( new PrivilegedExceptionAction()
+ {
+ public Object run() throws UnknownHostException
+ {
+ return InetAddress.getByName(host);
+ }
+ });
+ }
+ catch (PrivilegedActionException e)
+ {
+ throw (UnknownHostException) e.getCause();
+ }
+
ServerTestThread t1 = new ServerTestThread(addr, port);
t1.setDaemon(true);
t1.start();
18 years, 1 month