Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openanolis
dragonwell8_jdk
提交
104c1e52
D
dragonwell8_jdk
项目概览
openanolis
/
dragonwell8_jdk
通知
4
Star
2
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
D
dragonwell8_jdk
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
104c1e52
编写于
4月 05, 2013
作者:
M
mullan
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
8001330: Improve on checking order
Reviewed-by: acorn, hawtin
上级
2243ee91
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
44 addition
and
25 deletion
+44
-25
src/share/classes/java/security/AccessControlContext.java
src/share/classes/java/security/AccessControlContext.java
+10
-3
src/share/classes/java/security/AccessController.java
src/share/classes/java/security/AccessController.java
+28
-21
src/share/classes/java/security/ProtectionDomain.java
src/share/classes/java/security/ProtectionDomain.java
+6
-1
未找到文件。
src/share/classes/java/security/AccessControlContext.java
浏览文件 @
104c1e52
/*
/*
* Copyright (c) 1997, 201
1
, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1997, 201
3
, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
*
* This code is free software; you can redistribute it and/or modify it
* This code is free software; you can redistribute it and/or modify it
...
@@ -77,7 +77,10 @@ import sun.security.util.SecurityConstants;
...
@@ -77,7 +77,10 @@ import sun.security.util.SecurityConstants;
public
final
class
AccessControlContext
{
public
final
class
AccessControlContext
{
private
ProtectionDomain
context
[];
private
ProtectionDomain
context
[];
// isPrivileged and isAuthorized are referenced by the VM - do not remove
// or change their names
private
boolean
isPrivileged
;
private
boolean
isPrivileged
;
private
boolean
isAuthorized
=
false
;
// Note: This field is directly used by the virtual machine
// Note: This field is directly used by the virtual machine
// native codes. Don't touch it.
// native codes. Don't touch it.
...
@@ -163,6 +166,7 @@ public final class AccessControlContext {
...
@@ -163,6 +166,7 @@ public final class AccessControlContext {
SecurityManager
sm
=
System
.
getSecurityManager
();
SecurityManager
sm
=
System
.
getSecurityManager
();
if
(
sm
!=
null
)
{
if
(
sm
!=
null
)
{
sm
.
checkPermission
(
SecurityConstants
.
CREATE_ACC_PERMISSION
);
sm
.
checkPermission
(
SecurityConstants
.
CREATE_ACC_PERMISSION
);
this
.
isAuthorized
=
true
;
}
}
this
.
context
=
acc
.
context
;
this
.
context
=
acc
.
context
;
...
@@ -184,6 +188,7 @@ public final class AccessControlContext {
...
@@ -184,6 +188,7 @@ public final class AccessControlContext {
this
.
context
=
context
.
clone
();
this
.
context
=
context
.
clone
();
}
}
this
.
combiner
=
combiner
;
this
.
combiner
=
combiner
;
this
.
isAuthorized
=
true
;
}
}
/**
/**
...
@@ -191,10 +196,11 @@ public final class AccessControlContext {
...
@@ -191,10 +196,11 @@ public final class AccessControlContext {
*/
*/
AccessControlContext
(
ProtectionDomain
context
[],
AccessControlContext
(
ProtectionDomain
context
[],
boolean
isPrivileged
)
boolean
isPrivileged
)
{
{
this
.
context
=
context
;
this
.
context
=
context
;
this
.
isPrivileged
=
isPrivileged
;
this
.
isPrivileged
=
isPrivileged
;
this
.
isAuthorized
=
true
;
}
}
/**
/**
...
@@ -475,7 +481,7 @@ public final class AccessControlContext {
...
@@ -475,7 +481,7 @@ public final class AccessControlContext {
}
}
private
AccessControlContext
goCombiner
(
ProtectionDomain
[]
current
,
private
AccessControlContext
goCombiner
(
ProtectionDomain
[]
current
,
AccessControlContext
assigned
)
{
AccessControlContext
assigned
)
{
// the assigned ACC's combiner is not null --
// the assigned ACC's combiner is not null --
// let the combiner do its thing
// let the combiner do its thing
...
@@ -497,6 +503,7 @@ public final class AccessControlContext {
...
@@ -497,6 +503,7 @@ public final class AccessControlContext {
this
.
context
=
combinedPds
;
this
.
context
=
combinedPds
;
this
.
combiner
=
assigned
.
combiner
;
this
.
combiner
=
assigned
.
combiner
;
this
.
isPrivileged
=
false
;
this
.
isPrivileged
=
false
;
this
.
isAuthorized
=
assigned
.
isAuthorized
;
return
this
;
return
this
;
}
}
...
...
src/share/classes/java/security/AccessController.java
浏览文件 @
104c1e52
/*
/*
* Copyright (c) 1997, 201
2
, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1997, 201
3
, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
*
* This code is free software; you can redistribute it and/or modify it
* This code is free software; you can redistribute it and/or modify it
...
@@ -304,28 +304,31 @@ public final class AccessController {
...
@@ -304,28 +304,31 @@ public final class AccessController {
/**
/**
* Performs the specified <code>PrivilegedAction</code> with privileges
* Performs the specified {@code PrivilegedAction} with privileges
* enabled and restricted by the specified
* enabled and restricted by the specified {@code AccessControlContext}.
* <code>AccessControlContext</code>.
* The action is performed with the intersection of the permissions
* The action is performed with the intersection of the permissions
* possessed by the caller's protection domain, and those possessed
* possessed by the caller's protection domain, and those possessed
* by the domains represented by the specified
* by the domains represented by the specified {@code AccessControlContext}.
* <code>AccessControlContext</code>.
* <p>
* <p>
* If the action's
<code>run</code>
method throws an (unchecked) exception,
* If the action's
{@code run}
method throws an (unchecked) exception,
* it will propagate through this method.
* it will propagate through this method.
* <p>
* If a security manager is installed and the {@code AccessControlContext}
* was not created by system code and the caller's {@code ProtectionDomain}
* has not been granted the {@literal "createAccessControlContext"}
* {@link java.security.SecurityPermission}, then the action is performed
* with no permissions.
*
*
* @param action the action to be performed.
* @param action the action to be performed.
* @param context an <i>access control context</i>
* @param context an <i>access control context</i>
* representing the restriction to be applied to the
* representing the restriction to be applied to the
* caller's domain's privileges before performing
* caller's domain's privileges before performing
* the specified action. If the context is
* the specified action. If the context is
* <code>null</code>,
* {@code null}, then no additional restriction is applied.
* then no additional restriction is applied.
*
*
* @return the value returned by the action's
<code>run</code>
method.
* @return the value returned by the action's
{@code run}
method.
*
*
* @exception NullPointerException if the action is
<code>null</code>
* @exception NullPointerException if the action is
{@code null}
*
*
* @see #doPrivileged(PrivilegedAction)
* @see #doPrivileged(PrivilegedAction)
* @see #doPrivileged(PrivilegedExceptionAction,AccessControlContext)
* @see #doPrivileged(PrivilegedExceptionAction,AccessControlContext)
...
@@ -428,30 +431,34 @@ public final class AccessController {
...
@@ -428,30 +431,34 @@ public final class AccessController {
/**
/**
* Performs the specified
<code>PrivilegedExceptionAction</code>
with
* Performs the specified
{@code PrivilegedExceptionAction}
with
* privileges enabled and restricted by the specified
* privileges enabled and restricted by the specified
*
<code>AccessControlContext</code>
. The action is performed with the
*
{@code AccessControlContext}
. The action is performed with the
* intersection of the permissions possessed by the caller's
* intersection of the permissions possessed by the caller's
* protection domain, and those possessed by the domains represented by the
* protection domain, and those possessed by the domains represented by the
* specified
<code>AccessControlContext</code>
.
* specified
{@code AccessControlContext}
.
* <p>
* <p>
* If the action's
<code>run</code>
method throws an <i>unchecked</i>
* If the action's
{@code run}
method throws an <i>unchecked</i>
* exception, it will propagate through this method.
* exception, it will propagate through this method.
* <p>
* If a security manager is installed and the {@code AccessControlContext}
* was not created by system code and the caller's {@code ProtectionDomain}
* has not been granted the {@literal "createAccessControlContext"}
* {@link java.security.SecurityPermission}, then the action is performed
* with no permissions.
*
*
* @param action the action to be performed
* @param action the action to be performed
* @param context an <i>access control context</i>
* @param context an <i>access control context</i>
* representing the restriction to be applied to the
* representing the restriction to be applied to the
* caller's domain's privileges before performing
* caller's domain's privileges before performing
* the specified action. If the context is
* the specified action. If the context is
* <code>null</code>,
* {@code null}, then no additional restriction is applied.
* then no additional restriction is applied.
*
*
* @return the value returned by the action's
<code>run</code>
method
* @return the value returned by the action's
{@code run}
method
*
*
* @exception PrivilegedActionException if the specified action's
* @exception PrivilegedActionException if the specified action's
* <code>run</code> method
* {@code run} method threw a <i>checked</i> exception
* threw a <i>checked</i> exception
* @exception NullPointerException if the action is {@code null}
* @exception NullPointerException if the action is <code>null</code>
*
*
* @see #doPrivileged(PrivilegedAction)
* @see #doPrivileged(PrivilegedAction)
* @see #doPrivileged(PrivilegedExceptionAction,AccessControlContext)
* @see #doPrivileged(PrivilegedExceptionAction,AccessControlContext)
...
...
src/share/classes/java/security/ProtectionDomain.java
浏览文件 @
104c1e52
/*
/*
* Copyright (c) 1997, 201
1
, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1997, 201
3
, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
*
* This code is free software; you can redistribute it and/or modify it
* This code is free software; you can redistribute it and/or modify it
...
@@ -277,6 +277,11 @@ public class ProtectionDomain {
...
@@ -277,6 +277,11 @@ public class ProtectionDomain {
return
false
;
return
false
;
}
}
// called by the VM -- do not remove
boolean
impliesCreateAccessControlContext
()
{
return
implies
(
SecurityConstants
.
CREATE_ACC_PERMISSION
);
}
/**
/**
* Convert a ProtectionDomain to a String.
* Convert a ProtectionDomain to a String.
*/
*/
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录