summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMark Wielaard <mark@klomp.org>2004-07-04 18:32:26 +0000
committerMark Wielaard <mark@klomp.org>2004-07-04 18:32:26 +0000
commit65ba2a5cc813f115066b88530df9f722369ca382 (patch)
treef4c781a11a5a2a416d32a0a2a4f7d719c3b14429
parent919c524de832b82d982b0815a94e84dc7bd64e50 (diff)
downloadclasspath-65ba2a5cc813f115066b88530df9f722369ca382.tar.gz
2004-07-04 Casey Marshall <csm@gnu.org>
* java/security/AccessControlContext.java (checkPermission): check for empty context. * vm/reference/java/security/VMAccessController.java (getContext): combine debugging statements. (getStack): implemented. * NEWS: Describe new platform dependent VMAccessController class.
-rw-r--r--ChangeLog10
-rw-r--r--NEWS10
-rw-r--r--java/security/AccessControlContext.java2
-rw-r--r--vm/reference/java/security/VMAccessController.java24
4 files changed, 37 insertions, 9 deletions
diff --git a/ChangeLog b/ChangeLog
index 60011361d..f05fb25c0 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,13 @@
+2004-07-04 Casey Marshall <csm@gnu.org>
+
+ * java/security/AccessControlContext.java
+ (checkPermission): check for empty context.
+ * vm/reference/java/security/VMAccessController.java
+ (getContext): combine debugging statements.
+ (getStack): implemented.
+
+ * NEWS: Describe new platform dependent VMAccessController class.
+
2004-07-04 Mark Wielaard <mark@klomp.org>
* java/lang/System.java (static): Add (fake) ASCII support to
diff --git a/NEWS b/NEWS
index 44ce6020e..4975a0f3d 100644
--- a/NEWS
+++ b/NEWS
@@ -21,6 +21,16 @@ New in release 0.10 (in preparation)
a default implementation written in java. For efficiency and to
prevent spurious wakeups a real 'native' runtime version can be supplied.
+* There is a new java.security.VMAccessController class that runtimes need
+ to implement to properly support SecurityManagers. The default
+ implementation that comes with GNU Classpath makes sure that ANY attempt
+ to access a protected resource is denied when a SecurityManager is
+ installed. Which is pretty secure, but also no very useful.
+ Please see the documentation in
+ vm/reference/java/security/VMAccessController.java,
+ and please give feedback on the GNU Classpath mailinglist whether or not
+ the current AccessController framework is flexible enough.
+
New in release 0.09 (2004/02/02)
* Includes updated GNU JAXP version from 2004-02-01.
diff --git a/java/security/AccessControlContext.java b/java/security/AccessControlContext.java
index 45d1410a7..8d2b59f8a 100644
--- a/java/security/AccessControlContext.java
+++ b/java/security/AccessControlContext.java
@@ -118,6 +118,8 @@ public final class AccessControlContext
*/
public void checkPermission(Permission perm) throws AccessControlException
{
+ if (protectionDomains.length == 0)
+ throw new AccessControlException ("permission not granted");
for (int i = 0; i < protectionDomains.length; i++)
if (!protectionDomains[i].implies(perm))
throw new AccessControlException ("permission not granted");
diff --git a/vm/reference/java/security/VMAccessController.java b/vm/reference/java/security/VMAccessController.java
index a9a580f92..d2780dcdd 100644
--- a/vm/reference/java/security/VMAccessController.java
+++ b/vm/reference/java/security/VMAccessController.java
@@ -169,9 +169,11 @@ final class VMAccessController
Class clazz = classes[i];
String method = methods[i];
- if (DEBUG) debug (">>> checking " + clazz + "." + method);
-
- if (DEBUG) debug (">>> loader = " + clazz.getClassLoader());
+ if (DEBUG)
+ {
+ debug (">>> checking " + clazz + "." + method);
+ debug (">>> loader = " + clazz.getClassLoader());
+ }
if (clazz.equals (AccessController.class)
&& method.equals ("doPrivileged"))
@@ -226,11 +228,15 @@ final class VMAccessController
* <i>i</i>. The arrays are clean; it will only contain Java methods,
* and no element of the list should be null.
*
- * <p>XXX note: this interface (VMAccessController) would possibly be
- * cleaner if we had a method similar to this, but returned an array
- * of java.lang.reflect.Method objects. Then, instead of having this
- * much logic in this class, we put everything in AccessController,
- * and simply have this single getStack method for a VM to implement.
+ * <p>The default implementation returns an empty stack, which will be
+ * interpreted as having no permissions whatsoever.
+ *
+ * @return A pair of arrays describing the current call stack. The first
+ * element is an array of Class objects, and the second is an array
+ * of Strings comprising the method names.
*/
- private static native Object[][] getStack();
+ private static Object[][] getStack()
+ {
+ return new Object[][] { new Class[0], new String[0] };
+ }
}