Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openanolis
dragonwell8_jdk
提交
08f7cdd9
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看板
提交
08f7cdd9
编写于
10月 21, 2010
作者:
C
chegar
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
6992859: InetAddressCachePolicy.setIfNotSet() fails
Reviewed-by: michaelm
上级
16263640
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
18 addition
and
32 deletion
+18
-32
src/share/classes/sun/net/InetAddressCachePolicy.java
src/share/classes/sun/net/InetAddressCachePolicy.java
+18
-32
未找到文件。
src/share/classes/sun/net/InetAddressCachePolicy.java
浏览文件 @
08f7cdd9
...
...
@@ -25,7 +25,6 @@
package
sun.net
;
import
java.net.InetAddress
;
import
java.security.PrivilegedAction
;
import
java.security.Security
;
...
...
@@ -57,7 +56,7 @@ public final class InetAddressCachePolicy {
* caching. For security reasons, this caching is made forever when
* a security manager is set.
*/
private
static
int
cachePolicy
;
private
static
int
cachePolicy
=
FOREVER
;
/* The Java-level namelookup cache policy for negative lookups:
*
...
...
@@ -67,31 +66,24 @@ public final class InetAddressCachePolicy {
* default value is 0. It can be set to some other value for
* performance reasons.
*/
private
static
int
negativeCachePolicy
;
private
static
int
negativeCachePolicy
=
NEVER
;
/*
* Whether or not the cache policy for successful lookups was set
* using a property (cmd line).
*/
private
static
boolean
set
=
false
;
private
static
boolean
propertySet
;
/*
* Whether or not the cache policy for negative lookups was set
* using a property (cmd line).
*/
private
static
boolean
negativeSet
=
false
;
private
static
boolean
propertyNegativeSet
;
/*
* Initialize
*/
static
{
set
=
false
;
negativeSet
=
false
;
cachePolicy
=
FOREVER
;
negativeCachePolicy
=
0
;
Integer
tmp
=
null
;
try
{
...
...
@@ -110,7 +102,7 @@ public final class InetAddressCachePolicy {
if
(
cachePolicy
<
0
)
{
cachePolicy
=
FOREVER
;
}
s
et
=
true
;
propertyS
et
=
true
;
}
else
{
tmp
=
java
.
security
.
AccessController
.
doPrivileged
(
new
sun
.
security
.
action
.
GetIntegerAction
(
cachePolicyPropFallback
));
...
...
@@ -119,7 +111,14 @@ public final class InetAddressCachePolicy {
if
(
cachePolicy
<
0
)
{
cachePolicy
=
FOREVER
;
}
set
=
true
;
propertySet
=
true
;
}
else
{
/* No properties defined for positive caching. If there is no
* security manager then use the default positive cache value.
*/
if
(
System
.
getSecurityManager
()
==
null
)
{
cachePolicy
=
DEFAULT_POSITIVE
;
}
}
}
...
...
@@ -140,7 +139,7 @@ public final class InetAddressCachePolicy {
if
(
negativeCachePolicy
<
0
)
{
negativeCachePolicy
=
FOREVER
;
}
n
egativeSet
=
true
;
propertyN
egativeSet
=
true
;
}
else
{
tmp
=
java
.
security
.
AccessController
.
doPrivileged
(
new
sun
.
security
.
action
.
GetIntegerAction
(
negativeCachePolicyPropFallback
));
...
...
@@ -149,17 +148,13 @@ public final class InetAddressCachePolicy {
if
(
negativeCachePolicy
<
0
)
{
negativeCachePolicy
=
FOREVER
;
}
n
egativeSet
=
true
;
propertyN
egativeSet
=
true
;
}
}
}
public
static
synchronized
int
get
()
{
if
(!
set
&&
System
.
getSecurityManager
()
==
null
)
{
return
DEFAULT_POSITIVE
;
}
else
{
return
cachePolicy
;
}
return
cachePolicy
;
}
public
static
synchronized
int
getNegative
()
{
...
...
@@ -174,21 +169,17 @@ public final class InetAddressCachePolicy {
* should be cached
*/
public
static
synchronized
void
setIfNotSet
(
int
newPolicy
)
{
/*
* When setting the new value we may want to signal that the
* cache should be flushed, though this doesn't seem strictly
* necessary.
*/
if
(!
set
)
{
if
(!
propertySet
)
{
checkValue
(
newPolicy
,
cachePolicy
);
cachePolicy
=
newPolicy
;
}
}
/**
* Sets the cache policy for negative lookups if the user has not
* already specified a cache policy for it using a
...
...
@@ -197,14 +188,12 @@ public final class InetAddressCachePolicy {
* should be cached
*/
public
static
synchronized
void
setNegativeIfNotSet
(
int
newPolicy
)
{
/*
* When setting the new value we may want to signal that the
* cache should be flushed, though this doesn't seem strictly
* necessary.
*/
if
(!
negativeSet
)
{
if
(!
propertyNegativeSet
)
{
// Negative caching does not seem to have any security
// implications.
// checkValue(newPolicy, negativeCachePolicy);
...
...
@@ -213,13 +202,11 @@ public final class InetAddressCachePolicy {
}
private
static
void
checkValue
(
int
newPolicy
,
int
oldPolicy
)
{
/*
* If malicious code gets a hold of this method, prevent
* setting the cache policy to something laxer or some
* invalid negative value.
*/
if
(
newPolicy
==
FOREVER
)
return
;
...
...
@@ -229,7 +216,6 @@ public final class InetAddressCachePolicy {
throw
new
SecurityException
(
"can't make InetAddress cache more lax"
);
}
}
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录