[kaffe] CVS kaffe (robilad): Resynced with GNU Classpath: use AccessControler.doPrivileged to access system p

Kaffe CVS cvs-commits at kaffe.org
Mon Oct 11 17:54:10 PDT 2004


PatchSet 5272 
Date: 2004/10/12 00:50:16
Author: robilad
Branch: HEAD
Tag: (none) 
Log:
Resynced with GNU Classpath: use AccessControler.doPrivileged to access system properties

2004-10-11  Dalibor Topic <robilad at kaffe.org>

        * libraries/javalib/java/lang/SecurityManager.java,
        libraries/javalib/java/security/Security.java:
        Resynced with GNU Classpath.

        2004-10-11  Jeroen Frijters  <jeroen at frijters.net>

        * java/lang/SecurityManager.java
        (checkPackageList): Use AccessController.doPrivileged to get
        security property.
        * java/security/Security.java
        (static): Use AccessController.doPrivileged to get system property.

Members: 
	ChangeLog:1.2824->1.2825 
	libraries/javalib/java/lang/SecurityManager.java:1.21->1.22 
	libraries/javalib/java/security/Security.java:1.15->1.16 

Index: kaffe/ChangeLog
diff -u kaffe/ChangeLog:1.2824 kaffe/ChangeLog:1.2825
--- kaffe/ChangeLog:1.2824	Tue Oct 12 00:24:55 2004
+++ kaffe/ChangeLog	Tue Oct 12 00:50:16 2004
@@ -1,5 +1,19 @@
 2004-10-11  Dalibor Topic <robilad at kaffe.org>
 
+	* libraries/javalib/java/lang/SecurityManager.java,
+	libraries/javalib/java/security/Security.java:
+	Resynced with GNU Classpath.
+
+	2004-10-11  Jeroen Frijters  <jeroen at frijters.net>
+
+        * java/lang/SecurityManager.java
+        (checkPackageList): Use AccessController.doPrivileged to get
+        security property.
+        * java/security/Security.java
+        (static): Use AccessController.doPrivileged to get system property.
+
+2004-10-11  Dalibor Topic <robilad at kaffe.org>
+
 	* libraries/javalib/java/security/IdentityScope.java:
 	Replaced by implementation from GNU Classpath.
 
Index: kaffe/libraries/javalib/java/lang/SecurityManager.java
diff -u kaffe/libraries/javalib/java/lang/SecurityManager.java:1.21 kaffe/libraries/javalib/java/lang/SecurityManager.java:1.22
--- kaffe/libraries/javalib/java/lang/SecurityManager.java:1.21	Fri Jun  4 17:45:19 2004
+++ kaffe/libraries/javalib/java/lang/SecurityManager.java	Tue Oct 12 00:50:17 2004
@@ -49,6 +49,7 @@
 import java.security.AccessController;
 import java.security.AllPermission;
 import java.security.Permission;
+import java.security.PrivilegedAction;
 import java.security.Security;
 import java.security.SecurityPermission;
 import java.util.PropertyPermission;
@@ -1013,12 +1014,16 @@
    * @see #checkPackageAccess(String)
    * @see #checkPackageDefinition(String)
    */
-  void checkPackageList(String packageName, String restriction,
+  void checkPackageList(String packageName, final String restriction,
                         String permission)
   {
     // Use the toString() hack to do the null check.
     Permission p = new RuntimePermission(permission + packageName.toString());
-    String list = Security.getProperty("package." + restriction);
+    String list = (String)AccessController.doPrivileged(new PrivilegedAction() {
+	public Object run() {
+	    return Security.getProperty("package." + restriction);
+	}
+    });
     if (list == null)
       return;
     while (! "".equals(packageName))
Index: kaffe/libraries/javalib/java/security/Security.java
diff -u kaffe/libraries/javalib/java/security/Security.java:1.15 kaffe/libraries/javalib/java/security/Security.java:1.16
--- kaffe/libraries/javalib/java/security/Security.java:1.15	Sat Sep 25 16:40:01 2004
+++ kaffe/libraries/javalib/java/security/Security.java	Tue Oct 12 00:50:18 2004
@@ -37,10 +37,12 @@
 
 package java.security;
 
+import gnu.java.security.action.GetPropertyAction;
 import java.io.FileNotFoundException;
 import java.io.InputStream;
 import java.io.IOException;
 import java.net.URL;
+import java.security.AccessController;
 import java.security.Provider;
 import java.util.Collections;
 import java.util.Enumeration;
@@ -68,9 +70,11 @@
   
   static
     {
-      String base = System.getProperty ("gnu.classpath.home.url");
-      String vendor = System.getProperty ("gnu.classpath.vm.shortname");
-    
+      GetPropertyAction getProp = new GetPropertyAction("gnu.classpath.home.url");
+      String base = (String) AccessController.doPrivileged(getProp);
+      getProp = new GetPropertyAction("gnu.classpath.vm.shortname");
+      String vendor = (String) AccessController.doPrivileged(getProp);
+
       // Try VM specific security file
       boolean loaded = loadProviders (base, vendor);
 




More information about the kaffe mailing list