changeset 1510:538d1a817e21

2009-05-06 Lillian Angel <langel@redhat.com> Fixes bz#498108 * rt/net/sourceforge/jnlp/NetxPanel.java (runLoader): Pass false to JNLPRuntime.initialize, since this is an applet. * rt/net/sourceforge/jnlp/runtime/JNLPSecurityManager.java (PluginAppletSecurityContext): Likewise. * rt/net/sourceforge/jnlp/runtime/Boot.java (run): Pass true to JNLPRuntime.initialize, since this is a webstart app. * rt/net/sourceforge/jnlp/runtime/JNLPRuntime.java (initialize): Added new parameter isApplication, which is used to set global static variable isWebstartApplication. (isWebstartApplication): New accessor function. * rt/net/sourceforge/jnlp/runtime/JNLPSecurityManager.java: (checkPermission): Added call to JNLPRuntime.isWebstartApplication so the check is bypassed if the permissions are to be checked for a webstart application.
author Lillian Angel <langel@redhat.com>
date Wed, 06 May 2009 14:09:31 -0400
parents 19e655aeb5fb
children c5c31d555ae3
files ChangeLog plugin/icedtea/sun/applet/PluginAppletSecurityContext.java rt/net/sourceforge/jnlp/NetxPanel.java rt/net/sourceforge/jnlp/runtime/Boot.java rt/net/sourceforge/jnlp/runtime/JNLPRuntime.java rt/net/sourceforge/jnlp/runtime/JNLPSecurityManager.java
diffstat 6 files changed, 43 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog	Tue May 05 17:04:37 2009 -0400
+++ b/ChangeLog	Wed May 06 14:09:31 2009 -0400
@@ -1,3 +1,23 @@
+2009-05-06  Lillian Angel  <langel@redhat.com>
+
+	Fixes bz#498108
+	* rt/net/sourceforge/jnlp/NetxPanel.java
+	(runLoader): Pass false to JNLPRuntime.initialize, since this is an 
+	applet.
+	* rt/net/sourceforge/jnlp/runtime/JNLPSecurityManager.java
+	(PluginAppletSecurityContext): Likewise.
+	* rt/net/sourceforge/jnlp/runtime/Boot.java
+	(run): Pass true to JNLPRuntime.initialize, since this 
+	is a webstart app.
+	* rt/net/sourceforge/jnlp/runtime/JNLPRuntime.java
+	(initialize): Added new parameter isApplication, which is used to set
+	global static variable isWebstartApplication.
+	(isWebstartApplication): New accessor function.
+	* rt/net/sourceforge/jnlp/runtime/JNLPSecurityManager.java:
+	(checkPermission): Added call to JNLPRuntime.isWebstartApplication so
+	the check is bypassed if the permissions are to be checked for
+	a webstart application. 
+
 2009-05-05  Deepak Bhole <dbhole@redhat.com>
 
 	* IcedTeaPlugin.cc: Add conditional compilation block.
--- a/plugin/icedtea/sun/applet/PluginAppletSecurityContext.java	Tue May 05 17:04:37 2009 -0400
+++ b/plugin/icedtea/sun/applet/PluginAppletSecurityContext.java	Wed May 06 14:09:31 2009 -0400
@@ -248,7 +248,7 @@
 		// an applet will be loaded at some point, we should make it the SM 
 		// that JNLPRuntime will try to install
 		if (System.getSecurityManager() == null) {
-			JNLPRuntime.initialize();
+			JNLPRuntime.initialize(false);
 		}
 
 		JNLPRuntime.disableExit();
--- a/rt/net/sourceforge/jnlp/NetxPanel.java	Tue May 05 17:04:37 2009 -0400
+++ b/rt/net/sourceforge/jnlp/NetxPanel.java	Wed May 06 14:09:31 2009 -0400
@@ -78,7 +78,7 @@
     			    if (JNLPRuntime.isDebug())
     			        System.out.println("initializing JNLPRuntime...");
 
-    				JNLPRuntime.initialize();
+    				JNLPRuntime.initialize(false);
     			} else {
     			    if (JNLPRuntime.isDebug())
     			        System.out.println("JNLPRuntime already initialized");
--- a/rt/net/sourceforge/jnlp/runtime/Boot.java	Tue May 05 17:04:37 2009 -0400
+++ b/rt/net/sourceforge/jnlp/runtime/Boot.java	Wed May 06 14:09:31 2009 -0400
@@ -197,7 +197,7 @@
     public Object run() {
         JNLPRuntime.setBaseDir(getBaseDir());
         JNLPRuntime.setSecurityEnabled(null == getOption("-nosecurity"));
-        JNLPRuntime.initialize();
+        JNLPRuntime.initialize(true);
 
         try {
             new Launcher().launch(getFile());
--- a/rt/net/sourceforge/jnlp/runtime/JNLPRuntime.java	Tue May 05 17:04:37 2009 -0400
+++ b/rt/net/sourceforge/jnlp/runtime/JNLPRuntime.java	Wed May 06 14:09:31 2009 -0400
@@ -94,6 +94,9 @@
     /** mutex to wait on, for initialization */
     public static Object initMutex = new Object();
 
+    /** set to true if this is a webstart application. */
+    private static boolean isWebstartApplication; 
+
     /**
      * Returns whether the JNLP runtime environment has been
      * initialized.  Once initialized, some properties such as the
@@ -112,10 +115,14 @@
      * initialized, methods that alter the runtime can only be
      * called by the exit class.<p>
      *
+     * @param isApplication is true if a webstart application is being initialized
+     *
      * @throws IllegalStateException if the runtime was previously initialized
      */
-    public static void initialize() throws IllegalStateException {
+    public static void initialize(boolean isApplication) throws IllegalStateException {
         checkInitialized();
+     
+        isWebstartApplication = isApplication;
 
         if (headless == false)
             checkHeadless();
@@ -149,6 +156,14 @@
     }
 
     /**
+     * Returns true if a webstart application has been initialized, and false
+     * for a plugin applet.
+     */
+    public static boolean isWebstartApplication() {
+        return isWebstartApplication;
+    }
+
+    /**
      * Returns the window icon.
      */
     public static Image getWindowIcon() {
--- a/rt/net/sourceforge/jnlp/runtime/JNLPSecurityManager.java	Tue May 05 17:04:37 2009 -0400
+++ b/rt/net/sourceforge/jnlp/runtime/JNLPSecurityManager.java	Wed May 06 14:09:31 2009 -0400
@@ -255,13 +255,14 @@
      */
     public void checkPermission(Permission perm) {
         String name = perm.getName();
-        
+
         // Enable this manually -- it'll produce too much output for -verbose
         // otherwise.
 //		if (true)
 //			System.out.println("Checking permission: " + perm.toString());
-        if ("setPolicy".equals(name) ||
-            "setSecurityManager".equals(name))
+
+        if (!JNLPRuntime.isWebstartApplication() && ("setPolicy".equals(name) ||
+            "setSecurityManager".equals(name)))
             throw new SecurityException(R("RCantReplaceSM"));
 
         try {