[jboss-cvs] JBossAS SVN: r106922 - in branches/JBPAPP_5_1/system: src/main/org/jboss/system and 1 other directory.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Tue Jul 20 11:14:48 EDT 2010


Author: anil.saldhana at jboss.com
Date: 2010-07-20 11:14:48 -0400 (Tue, 20 Jul 2010)
New Revision: 106922

Modified:
   branches/JBPAPP_5_1/system/.classpath
   branches/JBPAPP_5_1/system/src/main/org/jboss/system/Registry.java
Log:
JBPAPP-4537: add in a security check for bind/unbind operation

Modified: branches/JBPAPP_5_1/system/.classpath
===================================================================
--- branches/JBPAPP_5_1/system/.classpath	2010-07-20 14:50:32 UTC (rev 106921)
+++ branches/JBPAPP_5_1/system/.classpath	2010-07-20 15:14:48 UTC (rev 106922)
@@ -29,7 +29,6 @@
 	<classpathentry kind="lib" path="/thirdparty/jboss/jboss-deployers/lib/jboss-deployers-core.jar" sourcepath="/thirdparty/jboss/jboss-deployers/lib/jboss-deployers-core-sources.jar"/>
 	<classpathentry kind="lib" path="/thirdparty/jboss/profileservice-spi/lib/jboss-profileservice-spi.jar" sourcepath="/thirdparty/jboss/profileservice-spi/lib/jboss-profileservice-spi-sources.jar"/>
 	<classpathentry kind="lib" path="/thirdparty/jboss/jboss-deployers/lib/jboss-deployers-client.jar" sourcepath="/thirdparty/jboss/jboss-deployers/lib/jboss-deployers-client-sources.jar"/>
-	<classpathentry kind="lib" path="/thirdparty/sun-jaxb/lib/jaxb-impl.jar"/>
 	<classpathentry kind="lib" path="/thirdparty/sun-jaf/lib/activation.jar"/>
 	<classpathentry kind="lib" path="/thirdparty/jboss/common-logging-spi/lib/jboss-logging-spi.jar"/>
 	<classpathentry kind="lib" path="/thirdparty/jboss/jboss-mdr/lib/jboss-mdr.jar" sourcepath="/thirdparty/jboss/jboss-mdr/lib/jboss-mdr-sources.jar"/>

Modified: branches/JBPAPP_5_1/system/src/main/org/jboss/system/Registry.java
===================================================================
--- branches/JBPAPP_5_1/system/src/main/org/jboss/system/Registry.java	2010-07-20 14:50:32 UTC (rev 106921)
+++ branches/JBPAPP_5_1/system/src/main/org/jboss/system/Registry.java	2010-07-20 15:14:48 UTC (rev 106922)
@@ -42,8 +42,16 @@
    
    public static Map<Object, Object> entries = new ConcurrentHashMap<Object, Object>();
    
+   // Permission required to bind/unbind would be RuntimePermission "org.jboss.system.Registry"
+   private static RuntimePermission perm = new RuntimePermission( Registry.class.getName() );
+   
    public static void bind(final Object key, final Object value)
    {
+      SecurityManager securityManager = System.getSecurityManager();
+      if( securityManager != null )
+      {
+         securityManager.checkPermission( perm );
+      }
       entries.put(key, value);
       if(log.isTraceEnabled())
          log.trace("bound " + key + "=" + value);
@@ -51,6 +59,12 @@
    
    public static Object unbind(final Object key)
    {
+      SecurityManager securityManager = System.getSecurityManager();
+      if( securityManager != null )
+      {
+         securityManager.checkPermission( perm );
+      }
+      
       Object obj = entries.remove(key);
       if(log.isTraceEnabled())
          log.trace("unbound " + key + "=" + obj);
@@ -64,4 +78,4 @@
          log.trace("lookup " + key + "=" + obj);
       return obj;
    }
-}
+}
\ No newline at end of file



More information about the jboss-cvs-commits mailing list