[Red5commits] [2270] Added a check for the rmi security manager

pgregoire luke at codegent.com
Fri Aug 31 14:20:17 PDT 2007


Added a check for the rmi security manager


Timestamp: 08/31/07 16:14:36 EST (less than one hour ago) 
Change: 2270 
Author: pgregoire

Files (see diff or trac for details): 
java/server/trunk/src/org/red5/server/war/RootContextLoaderServlet.java
java/server/trunk/src/org/red5/server/war/SubContextLoaderServlet.java


Trac: http://mirror1.cvsdude.com/trac/osflash/red5/changeset/2270

Index: /java/server/trunk/src/org/red5/server/war/RootContextLoaderServlet.java
===================================================================
--- /java/server/trunk/src/org/red5/server/war/RootContextLoaderServlet.java (revision 2269)
+++ /java/server/trunk/src/org/red5/server/war/RootContextLoaderServlet.java (revision 2270)
@@ -22,4 +22,5 @@
 import java.beans.Introspector;
 import java.rmi.Naming;
+import java.rmi.RMISecurityManager;
 import java.rmi.RemoteException;
 import java.rmi.registry.LocateRegistry;
@@ -69,4 +70,6 @@
 	private final static long serialVersionUID = 41919712007L;
 
+	private static ClassLoader myClassloader;
+
 	// Initialize Logging
 	public static Logger logger = Logger
@@ -101,4 +104,7 @@
 
 	{
+		if (System.getSecurityManager() != null) {
+			System.setSecurityManager(new RMISecurityManager());
+		}
 		initRegistry();
 	}
@@ -115,4 +121,6 @@
 		instance = this;
 		System.setProperty("red5.deployment.type", "war");
+
+		myClassloader = getClass().getClassLoader();
 
 		servletContext = sce.getServletContext();
@@ -282,4 +290,11 @@
 			try {
 				ServletContext ctx = sce.getServletContext();
+				// if the ctx being destroyed is root then kill the timer
+				if (ctx.getContextPath().equals("/ROOT")) {
+					timer.cancel();
+				} else {
+					// remove from registered list
+					registeredContexts.remove(ctx);
+				}
 				// prepare spring for shutdown
 				Introspector.flushCaches();
Index: /java/server/trunk/src/org/red5/server/war/SubContextLoaderServlet.java
===================================================================
--- /java/server/trunk/src/org/red5/server/war/SubContextLoaderServlet.java (revision 2269)
+++ /java/server/trunk/src/org/red5/server/war/SubContextLoaderServlet.java (revision 2270)
@@ -21,4 +21,5 @@
 
 import java.rmi.Naming;
+import java.rmi.RMISecurityManager;
 
 import javax.servlet.ServletContext;
@@ -49,4 +50,7 @@
 
 	{
+		if (System.getSecurityManager() != null) {
+			System.setSecurityManager(new RMISecurityManager());
+		}
 		initRegistry();
 	}


Note:
Diffs are chopped if more than 25k.
This is to get past the limit on the mailing list.



More information about the Red5commits mailing list