PR libgcj/46774: Create dynamic ProtectionDomain instances which check the system policy.
2010-12-13 Andrew John Hughes <ahughes@redhat.com> 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: r167952
This commit is contained in:
parent
ef875e12c7
commit
ffafe01a87
3 changed files with 21 additions and 7 deletions
|
@ -1,3 +1,15 @@
|
||||||
|
2010-12-13 Andrew John Hughes <ahughes@redhat.com>
|
||||||
|
|
||||||
|
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-06 Dave Korn <dave.korn.cygwin@gmail.com>
|
2010-12-06 Dave Korn <dave.korn.cygwin@gmail.com>
|
||||||
|
|
||||||
PR target/40125
|
PR target/40125
|
||||||
|
|
Binary file not shown.
|
@ -56,7 +56,7 @@ final class VMAccessController
|
||||||
Permissions permissions = new Permissions();
|
Permissions permissions = new Permissions();
|
||||||
permissions.add(new AllPermission());
|
permissions.add(new AllPermission());
|
||||||
ProtectionDomain[] domain = new ProtectionDomain[] {
|
ProtectionDomain[] domain = new ProtectionDomain[] {
|
||||||
new ProtectionDomain(source, permissions)
|
new ProtectionDomain(source, permissions, null, null)
|
||||||
};
|
};
|
||||||
DEFAULT_CONTEXT = new AccessControlContext(domain);
|
DEFAULT_CONTEXT = new AccessControlContext(domain);
|
||||||
}
|
}
|
||||||
|
@ -121,7 +121,7 @@ final class VMAccessController
|
||||||
LinkedList stack = state.getContexts();
|
LinkedList stack = state.getContexts();
|
||||||
if (!stack.isEmpty())
|
if (!stack.isEmpty())
|
||||||
{
|
{
|
||||||
stack.removeFirst();
|
stack.removeFirst();
|
||||||
}
|
}
|
||||||
else if (DEBUG)
|
else if (DEBUG)
|
||||||
{
|
{
|
||||||
|
@ -178,26 +178,27 @@ final class VMAccessController
|
||||||
for (int i = 3; i < classes.length; i++)
|
for (int i = 3; i < classes.length; i++)
|
||||||
{
|
{
|
||||||
Class clazz = classes[i];
|
Class clazz = classes[i];
|
||||||
|
ClassLoader loader = clazz.getClassLoader();
|
||||||
|
|
||||||
if (DEBUG)
|
if (DEBUG)
|
||||||
{
|
{
|
||||||
debug("checking " + clazz);
|
debug("checking " + clazz);
|
||||||
// subject to getClassLoader RuntimePermission
|
// subject to getClassLoader RuntimePermission
|
||||||
debug("loader = " + clazz.getClassLoader());
|
debug("loader = " + loader);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (privileged && i == classes.length - 2)
|
if (privileged && i == classes.length - 2)
|
||||||
{
|
{
|
||||||
// If there was a call to doPrivileged with a supplied context,
|
// If there was a call to doPrivileged with a supplied context,
|
||||||
// return that context. If using JAAS doAs*, it should be
|
// return that context. If using JAAS doAs*, it should be
|
||||||
// a context with a SubjectDomainCombiner
|
// a context with a SubjectDomainCombiner
|
||||||
LinkedList l = state.getContexts();
|
LinkedList l = state.getContexts();
|
||||||
if (!l.isEmpty())
|
if (!l.isEmpty())
|
||||||
context = (AccessControlContext) l.getFirst();
|
context = (AccessControlContext) l.getFirst();
|
||||||
}
|
}
|
||||||
|
|
||||||
// subject to getProtectionDomain RuntimePermission
|
// subject to getProtectionDomain RuntimePermission
|
||||||
ProtectionDomain domain = clazz.getProtectionDomain();
|
ProtectionDomain domain = clazz.getProtectionDomain();
|
||||||
|
|
||||||
if (domain == null)
|
if (domain == null)
|
||||||
continue;
|
continue;
|
||||||
|
@ -208,7 +209,8 @@ final class VMAccessController
|
||||||
// Create a static snapshot of this domain, which may change over time
|
// Create a static snapshot of this domain, which may change over time
|
||||||
// if the current policy changes.
|
// if the current policy changes.
|
||||||
domains.add(new ProtectionDomain(domain.getCodeSource(),
|
domains.add(new ProtectionDomain(domain.getCodeSource(),
|
||||||
domain.getPermissions()));
|
domain.getPermissions(),
|
||||||
|
loader, null));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (DEBUG)
|
if (DEBUG)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue