Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openanolis
dragonwell8_jdk
提交
788a0cfd
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看板
提交
788a0cfd
编写于
2月 23, 2009
作者:
W
weijun
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
6789935: cross-realm capath search error
Reviewed-by: xuelei
上级
0495fecc
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
212 addition
and
16 deletion
+212
-16
src/share/classes/sun/security/krb5/Realm.java
src/share/classes/sun/security/krb5/Realm.java
+27
-16
test/sun/security/krb5/ParseCAPaths.java
test/sun/security/krb5/ParseCAPaths.java
+98
-0
test/sun/security/krb5/krb5-capaths.conf
test/sun/security/krb5/krb5-capaths.conf
+87
-0
未找到文件。
src/share/classes/sun/security/krb5/Realm.java
浏览文件 @
788a0cfd
...
...
@@ -39,7 +39,6 @@ import sun.security.krb5.RealmException;
import
sun.security.krb5.internal.Krb5
;
import
sun.security.util.*
;
import
java.io.IOException
;
import
java.io.OutputStream
;
import
java.util.StringTokenizer
;
import
java.util.Vector
;
import
java.util.Stack
;
...
...
@@ -364,7 +363,6 @@ public class Realm implements Cloneable {
}
String
tempTarget
=
null
,
tempRealm
=
null
;
StringTokenizer
strTok
=
null
;
Stack
<
String
>
iStack
=
new
Stack
<
String
>
();
/*
...
...
@@ -382,7 +380,7 @@ public class Realm implements Cloneable {
tempTarget
=
sRealm
;
}
do
{
out:
do
{
if
(
DEBUG
)
{
count
++;
System
.
out
.
println
(
">>> Realm parseCapaths: loop "
+
...
...
@@ -400,15 +398,21 @@ public class Realm implements Cloneable {
/*
* We have one or more space-separated intermediary realms.
* Stack them.
* Stack them. A null is always added between intermedies of
* different targets. When this null is popped, it means none
* of the intermedies for this target is useful (because of
* infinite loop), the target is then removed from the partial
* tempList, and the next possible intermediary is tried.
*/
strTok
=
new
StringTokenizer
(
intermediaries
,
" "
);
while
(
strTok
.
hasMoreTokens
())
iStack
.
push
(
null
);
String
[]
ints
=
intermediaries
.
split
(
"\\s+"
);
for
(
int
i
=
ints
.
length
-
1
;
i
>=
0
;
i
--)
{
tempRealm
=
strTok
.
nextToken
();
if
(!
tempRealm
.
equals
(
PrincipalName
.
REALM_COMPONENT_SEPARATOR_STR
)
&&
!
iStack
.
contains
(
tempRealm
))
{
tempRealm
=
ints
[
i
];
if
(
tempRealm
.
equals
(
PrincipalName
.
REALM_COMPONENT_SEPARATOR_STR
))
{
break
out
;
}
if
(!
tempList
.
contains
(
tempRealm
))
{
iStack
.
push
(
tempRealm
);
if
(
DEBUG
)
{
System
.
out
.
println
(
">>> Realm parseCapaths: loop "
+
...
...
@@ -418,16 +422,18 @@ public class Realm implements Cloneable {
}
}
else
if
(
DEBUG
)
{
System
.
out
.
println
(
">>> Realm parseCapaths: loop "
+
count
+
": ignoring realm: ["
+
tempRealm
+
"]"
);
}
}
}
else
if
(
DEBUG
)
{
System
.
out
.
println
(
">>> Realm parseCapaths: loop "
+
count
+
": no intermediaries"
);
}
else
{
if
(
DEBUG
)
{
System
.
out
.
println
(
">>> Realm parseCapaths: loop "
+
count
+
": no intermediaries"
);
}
break
;
}
/*
...
...
@@ -435,7 +441,12 @@ public class Realm implements Cloneable {
*/
try
{
tempTarget
=
iStack
.
pop
();
while
((
tempTarget
=
iStack
.
pop
())
==
null
)
{
tempList
.
removeElementAt
(
tempList
.
size
()-
1
);
if
(
DEBUG
)
{
System
.
out
.
println
(
">>> Realm parseCapaths: backtrack, remove tail"
);
}
}
}
catch
(
EmptyStackException
exc
)
{
tempTarget
=
null
;
}
...
...
test/sun/security/krb5/ParseCAPaths.java
0 → 100644
浏览文件 @
788a0cfd
/*
* Copyright 2009 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
* CA 95054 USA or visit www.sun.com if you need additional information or
* have any questions.
*/
/*
* @test
* @bug 6789935
* @summary cross-realm capath search error
*/
import
java.util.Arrays
;
import
sun.security.krb5.Realm
;
public
class
ParseCAPaths
{
static
boolean
failed
=
false
;
public
static
void
main
(
String
[]
args
)
throws
Exception
{
System
.
setProperty
(
"java.security.krb5.conf"
,
System
.
getProperty
(
"test.src"
,
"."
)
+
"/krb5-capaths.conf"
);
//System.setProperty("sun.security.krb5.debug", "true");
// Standard example
check
(
"ANL.GOV"
,
"TEST.ANL.GOV"
,
"ANL.GOV"
);
check
(
"ANL.GOV"
,
"ES.NET"
,
"ANL.GOV"
);
check
(
"ANL.GOV"
,
"PNL.GOV"
,
"ANL.GOV"
,
"ES.NET"
);
check
(
"ANL.GOV"
,
"NERSC.GOV"
,
"ANL.GOV"
,
"ES.NET"
);
// Hierachical
check
(
"N1.N.COM"
,
"N2.N.COM"
,
"N1.N.COM"
,
"N.COM"
);
// 2 common
check
(
"N1.N.COM"
,
"N2.N3.COM"
,
"N1.N.COM"
,
"N.COM"
,
// 1 common
"COM"
,
"N3.COM"
);
check
(
"N1.COM"
,
"N2.COM"
,
"N1.COM"
,
"COM"
);
// 1 common
check
(
"N1"
,
"N2"
,
"N1"
);
// 0 common
// Extra garbages
check
(
"A1.COM"
,
"A4.COM"
,
"A1.COM"
,
"A2.COM"
);
check
(
"B1.COM"
,
"B3.COM"
,
"B1.COM"
,
"B2.COM"
);
// Missing is "."
check
(
"C1.COM"
,
"C3.COM"
,
"C1.COM"
,
"C2.COM"
);
// Multiple path
check
(
"D1.COM"
,
"D4.COM"
,
"D1.COM"
,
"D2.COM"
);
check
(
"E1.COM"
,
"E4.COM"
,
"E1.COM"
,
"E2.COM"
);
check
(
"F1.COM"
,
"F4.COM"
,
"F1.COM"
,
"F9.COM"
);
// Infinite loop
check
(
"G1.COM"
,
"G3.COM"
,
"G1.COM"
,
"COM"
);
check
(
"H1.COM"
,
"H3.COM"
,
"H1.COM"
);
check
(
"I1.COM"
,
"I4.COM"
,
"I1.COM"
,
"I5.COM"
);
if
(
failed
)
{
throw
new
Exception
(
"Failed somewhere."
);
}
}
static
void
check
(
String
from
,
String
to
,
String
...
paths
)
{
try
{
check2
(
from
,
to
,
paths
);
}
catch
(
Exception
e
)
{
failed
=
true
;
e
.
printStackTrace
();
}
}
static
void
check2
(
String
from
,
String
to
,
String
...
paths
)
throws
Exception
{
System
.
out
.
println
(
from
+
" -> "
+
to
);
System
.
out
.
println
(
" expected: "
+
Arrays
.
toString
(
paths
));
String
[]
result
=
Realm
.
getRealmsList
(
from
,
to
);
System
.
out
.
println
(
" result: "
+
Arrays
.
toString
(
result
));
if
(
result
==
null
)
{
if
(
paths
.
length
==
0
)
{
// OK
}
else
{
throw
new
Exception
(
"Shouldn't have a valid path."
);
}
}
else
if
(
result
.
length
!=
paths
.
length
)
{
throw
new
Exception
(
"Length of path not correct"
);
}
else
{
for
(
int
i
=
0
;
i
<
result
.
length
;
i
++)
{
if
(!
result
[
i
].
equals
(
paths
[
i
]))
{
throw
new
Exception
(
"Path not same"
);
}
}
}
}
}
test/sun/security/krb5/krb5-capaths.conf
0 → 100644
浏览文件 @
788a0cfd
[
capaths
]
# Standard
ANL
.
GOV
= {
TEST
.
ANL
.
GOV
= .
PNL
.
GOV
=
ES
.
NET
NERSC
.
GOV
=
ES
.
NET
ES
.
NET
= .
}
TEST
.
ANL
.
GOV
= {
ANL
.
GOV
= .
}
PNL
.
GOV
= {
ANL
.
GOV
=
ES
.
NET
}
NERSC
.
GOV
= {
ANL
.
GOV
=
ES
.
NET
}
ES
.
NET
= {
ANL
.
GOV
= .
}
# Extra garbages
A1
.
COM
= {
A2
.
COM
= .
A4
.
COM
=
A2
.
COM
A3
.
COM
=
A4
.
COM
A3
.
COM
=
A2
.
COM
}
B1
.
COM
= {
B2
.
COM
= .
B3
.
COM
=
B2
.
COM
B3
.
COM
=
B4
.
COM
}
# Missing is "."
C1
.
COM
= {
C3
.
COM
=
C2
.
COM
}
# Multiple paths
D1
.
COM
= {
D2
.
COM
= .
D3
.
COM
= .
D4
.
COM
=
D2
.
COM
D4
.
COM
=
D3
.
COM
}
E1
.
COM
= {
E2
.
COM
= .
E3
.
COM
= .
E4
.
COM
=
E2
.
COM
E3
.
COM
E2
.
COM
}
# Shortest or First?
F1
.
COM
= {
F2
.
COM
= .
F3
.
COM
=
F2
.
COM
F4
.
COM
=
F9
.
COM
F4
.
COM
=
F3
.
COM
F4
.
COM
=
F2
.
COM
}
# Infinite loop
G1
.
COM
= {
G2
.
COM
=
G3
.
COM
G3
.
COM
=
G2
.
COM
}
H1
.
COM
= {
H2
.
COM
=
H3
.
COM
H3
.
COM
=
H2
.
COM
H3
.
COM
= .
}
I1
.
COM
= {
I2
.
COM
=
I3
.
COM
I3
.
COM
=
I2
.
COM
I4
.
COM
=
I2
.
COM
I5
.
COM
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录