diff options
author | Andrew John Hughes <gnu_andrew@member.fsf.org> | 2010-12-03 01:02:03 +0000 |
---|---|---|
committer | Andrew John Hughes <gnu_andrew@member.fsf.org> | 2010-12-03 01:02:03 +0000 |
commit | 48e58efc8a95710ce87742f30d02a47bc494badc (patch) | |
tree | 19030cf404ce4a259ad3992fffbecec649300549 | |
parent | 42df42d68b891bedae8db7e1a81ea26aa3f56bca (diff) | |
download | classpath-48e58efc8a95710ce87742f30d02a47bc494badc.tar.gz |
PR46775: Ensure use of setPolicy is reflected by the default SecurityManager.
2010-12-02 Andrew John Hughes <ahughes@redhat.com>
PR classpath/46775
* vm/reference/java/security/VMAccessController.java:
(DEFAULT_CONTEXT): Create ProtectionDomain with
four argument constructor (arguments are the same
as those implied by the two argument constructor).
(getContext()): Create ProtectionDomain instances
with four argument constructor using a null Principal
array (as before) but including the classloader, which
was always null before.
-rw-r--r-- | ChangeLog | 12 | ||||
-rw-r--r-- | vm/reference/java/security/VMAccessController.java | 8 |
2 files changed, 17 insertions, 3 deletions
@@ -1,3 +1,15 @@ +2010-12-02 Andrew John Hughes <ahughes@redhat.com> + + PR classpath/46775 + * vm/reference/java/security/VMAccessController.java: + (DEFAULT_CONTEXT): Create ProtectionDomain with + four argument constructor (arguments are the same + as those implied by the two argument constructor). + (getContext()): Create ProtectionDomain instances + with four argument constructor using a null Principal + array (as before) but including the classloader, which + was always null before. + 2010-11-04 Andrew John Hughes <ahughes@redhat.com> * config.rpath: diff --git a/vm/reference/java/security/VMAccessController.java b/vm/reference/java/security/VMAccessController.java index 9299e6f84..6e02f5711 100644 --- a/vm/reference/java/security/VMAccessController.java +++ b/vm/reference/java/security/VMAccessController.java @@ -71,7 +71,7 @@ final class VMAccessController Permissions permissions = new Permissions(); permissions.add(new AllPermission()); ProtectionDomain[] domain = new ProtectionDomain[] { - new ProtectionDomain(source, permissions) + new ProtectionDomain(source, permissions, null, null) }; DEFAULT_CONTEXT = new AccessControlContext(domain); } @@ -188,12 +188,13 @@ final class VMAccessController { Class clazz = classes[i]; String method = methods[i]; + ClassLoader loader = clazz.getClassLoader(); if (DEBUG) { debug("checking " + clazz + "." + method); // subject to getClassLoader RuntimePermission - debug("loader = " + clazz.getClassLoader()); + debug("loader = " + loader); } // If the previous frame was a call to doPrivileged, then this is @@ -225,7 +226,8 @@ final class VMAccessController // Create a static snapshot of this domain, which may change over time // if the current policy changes. domains.add(new ProtectionDomain(domain.getCodeSource(), - domain.getPermissions())); + domain.getPermissions(), + loader, null)); } if (DEBUG) |