gcjwebplugin-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Gcjwebplugin-devel] [patch] Enable security manager by default, and mak


From: Petter Reinholdtsen
Subject: [Gcjwebplugin-devel] [patch] Enable security manager by default, and make hidden switch to disable it
Date: Wed, 05 Apr 2006 21:00:40 +0200
User-agent: Gnus/5.1006 (Gnus v5.10.6) Emacs/21.4 (usg-unix-v)

As discussed with Thomas Fitzsimmons on #classpath, here is a patch to
enable the Security Manager by default, and make it possible to
disable it using an environment variable.

This make it possible to switch between testing the security manager
features and the class library, and thus make it easier for testers to
pinpoint the source of Applet problems.

Please include this in a future version of gcjwebplugin.

Index: AppletViewer.java
===================================================================
RCS file: 
/sources/gcjwebplugin/gcjwebplugin/src/gnu/gcjwebplugin/AppletViewer.java,v
retrieving revision 1.41
diff -u -3 -p -u -r1.41 AppletViewer.java
--- AppletViewer.java   11 Feb 2006 18:06:56 -0000      1.41
+++ AppletViewer.java   5 Apr 2006 18:52:43 -0000
@@ -38,6 +38,7 @@ import java.util.LinkedList;
 import java.util.List;
 import java.util.MissingResourceException;
 import java.util.ResourceBundle;
+import java.util.Properties;
 
 
 class AppletViewer
@@ -122,6 +123,12 @@ class AppletViewer
     System.exit(status);
   }
 
+  public static Properties getEnvironment() throws java.io.IOException {
+    Properties env = new Properties();
+    env.load(Runtime.getRuntime().exec("env").getInputStream());
+    return env;
+  }
+
   /**
    * The main method starting the applet viewer.
    *
@@ -208,6 +215,18 @@ class AppletViewer
     boolean heightGiven = false;
     boolean pluginMode = false;
     boolean verbose = false;
+    boolean secure = true;
+
+
+    /*
+     * Hidden option MAKE_GCJAPPLETVIEWER_INSECURE=true for testers
+     * willing to ignore the security problems to be able to test the
+     * class library.
+     */
+    Properties env = getEnvironment();
+    if (null != env.getProperty("MAKE_GCJAPPLETVIEWER_INSECURE")
+       && env.getProperty("MAKE_GCJAPPLETVIEWER_INSECURE").equals("true"))
+       secure = false;
 
     // This loop parses the command line, placing all option arguments
     // at the start of args, all non-options at the end, and setting
@@ -267,7 +286,8 @@ class AppletViewer
     if (dimensions.width < 0)
       dimensions.width = (int) (1.6 * dimensions.height);
 
-    //System.setSecurityManager(new AppletSecurityManager(pluginMode));
+    if (secure)
+       System.setSecurityManager(new AppletSecurityManager(pluginMode));
     
     if (pluginMode)
       {




reply via email to

[Prev in Thread] Current Thread [Next in Thread]