From: Andrew John Hughes Date: Mon, 20 Dec 2010 18:19:52 +0000 (+0000) Subject: PR libgcj/46774: Create dynamic ProtectionDomain instances which check the system... X-Git-Tag: releases/gcc-4.5.3~354 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=053bc0eec816d9740528d35b9324ffb6a635c3b5;p=thirdparty%2Fgcc.git PR libgcj/46774: Create dynamic ProtectionDomain instances which check the system policy. 2010-12-13 Andrew John Hughes PR libgcj/46774 * libjava/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. From-SVN: r168092 --- diff --git a/libjava/ChangeLog b/libjava/ChangeLog index 036bdddc0ae7..94e698eca8f2 100644 --- a/libjava/ChangeLog +++ b/libjava/ChangeLog @@ -1,3 +1,15 @@ +2010-12-13 Andrew John Hughes + + PR libgcj/46774 + * libjava/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-12-16 Release Manager * GCC 4.5.2 released. diff --git a/libjava/classpath/lib/java/security/VMAccessController.class b/libjava/classpath/lib/java/security/VMAccessController.class index d05cd9c84563..9a129803916b 100644 Binary files a/libjava/classpath/lib/java/security/VMAccessController.class and b/libjava/classpath/lib/java/security/VMAccessController.class differ diff --git a/libjava/java/security/VMAccessController.java b/libjava/java/security/VMAccessController.java index 8436c9ccb60b..587f311142d1 100644 --- a/libjava/java/security/VMAccessController.java +++ b/libjava/java/security/VMAccessController.java @@ -56,7 +56,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); } @@ -178,12 +178,13 @@ final class VMAccessController for (int i = 3; i < classes.length; i++) { Class clazz = classes[i]; + ClassLoader loader = clazz.getClassLoader(); if (DEBUG) { debug("checking " + clazz); // subject to getClassLoader RuntimePermission - debug("loader = " + clazz.getClassLoader()); + debug("loader = " + loader); } if (privileged && i == classes.length - 2) @@ -208,7 +209,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)