Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openanolis
dragonwell8_jdk
提交
788f0fdd
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看板
提交
788f0fdd
编写于
12月 17, 2012
作者:
W
weijun
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
7197159: accept different kvno if there no match
Reviewed-by: xuelei
上级
a6d8e94d
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
103 addition
and
13 deletion
+103
-13
src/share/classes/sun/security/krb5/EncryptionKey.java
src/share/classes/sun/security/krb5/EncryptionKey.java
+16
-1
test/sun/security/krb5/auto/DynamicKeytab.java
test/sun/security/krb5/auto/DynamicKeytab.java
+7
-5
test/sun/security/krb5/auto/KvnoNA.java
test/sun/security/krb5/auto/KvnoNA.java
+72
-0
test/sun/security/krb5/auto/MoreKvno.java
test/sun/security/krb5/auto/MoreKvno.java
+8
-7
未找到文件。
src/share/classes/sun/security/krb5/EncryptionKey.java
浏览文件 @
788f0fdd
...
...
@@ -555,6 +555,12 @@ public class EncryptionKey
int
ktype
;
boolean
etypeFound
=
false
;
// When no matched kvno is found, returns tke key of the same
// etype with the highest kvno
int
kvno_found
=
0
;
EncryptionKey
key_found
=
null
;
for
(
int
i
=
0
;
i
<
keys
.
length
;
i
++)
{
ktype
=
keys
[
i
].
getEType
();
if
(
EType
.
isSupported
(
ktype
))
{
...
...
@@ -563,6 +569,10 @@ public class EncryptionKey
etypeFound
=
true
;
if
(
versionMatches
(
kvno
,
kv
))
{
return
keys
[
i
];
}
else
if
(
kv
>
kvno_found
)
{
// kv is not null
key_found
=
keys
[
i
];
kvno_found
=
kv
;
}
}
}
...
...
@@ -580,12 +590,17 @@ public class EncryptionKey
etypeFound
=
true
;
if
(
versionMatches
(
kvno
,
kv
))
{
return
new
EncryptionKey
(
etype
,
keys
[
i
].
getBytes
());
}
else
if
(
kv
>
kvno_found
)
{
key_found
=
new
EncryptionKey
(
etype
,
keys
[
i
].
getBytes
());
kvno_found
=
kv
;
}
}
}
}
if
(
etypeFound
)
{
throw
new
KrbException
(
Krb5
.
KRB_AP_ERR_BADKEYVER
);
return
key_found
;
// For compatibility, will not fail here.
//throw new KrbException(Krb5.KRB_AP_ERR_BADKEYVER);
}
return
null
;
}
...
...
test/sun/security/krb5/auto/DynamicKeytab.java
浏览文件 @
788f0fdd
...
...
@@ -110,11 +110,13 @@ public class DynamicKeytab {
throw
new
Exception
(
"Should not success"
);
}
catch
(
GSSException
gsse
)
{
System
.
out
.
println
(
gsse
);
KrbException
ke
=
(
KrbException
)
gsse
.
getCause
();
if
(
ke
.
returnCode
()
!=
Krb5
.
KRB_AP_ERR_BADKEYVER
)
{
throw
new
Exception
(
"Not expected failure code: "
+
ke
.
returnCode
());
}
// Since 7197159, different kvno is accepted, this return code
// will never be thrown out again.
//KrbException ke = (KrbException)gsse.getCause();
//if (ke.returnCode() != Krb5.KRB_AP_ERR_BADKEYVER) {
// throw new Exception("Not expected failure code: " +
// ke.returnCode());
//}
}
// Test 8: an empty KDC means revoke all
...
...
test/sun/security/krb5/auto/KvnoNA.java
0 → 100644
浏览文件 @
788f0fdd
/*
* Copyright (c) 2012, Oracle and/or its affiliates. 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 Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/*
* @test
* @bug 7197159
* @compile -XDignore.symbol.file KvnoNA.java
* @run main/othervm KvnoNA
* @summary accept different kvno if there no match
*/
import
org.ietf.jgss.GSSException
;
import
sun.security.jgss.GSSUtil
;
import
sun.security.krb5.KrbException
;
import
sun.security.krb5.PrincipalName
;
import
sun.security.krb5.internal.ktab.KeyTab
;
import
sun.security.krb5.internal.Krb5
;
public
class
KvnoNA
{
public
static
void
main
(
String
[]
args
)
throws
Exception
{
OneKDC
kdc
=
new
OneKDC
(
null
);
kdc
.
writeJAASConf
();
// In KDC, it's 2
char
[]
pass
=
"pass2"
.
toCharArray
();
kdc
.
addPrincipal
(
OneKDC
.
SERVER
,
pass
);
// In ktab, kvno is 1 or 3, 3 has the same password
KeyTab
ktab
=
KeyTab
.
create
(
OneKDC
.
KTAB
);
PrincipalName
p
=
new
PrincipalName
(
OneKDC
.
SERVER
+
"@"
+
OneKDC
.
REALM
,
PrincipalName
.
KRB_NT_SRV_HST
);
ktab
.
addEntry
(
p
,
"pass1"
.
toCharArray
(),
1
,
true
);
ktab
.
addEntry
(
p
,
"pass2"
.
toCharArray
(),
3
,
true
);
ktab
.
save
();
Context
c
,
s
;
c
=
Context
.
fromUserPass
(
"dummy"
,
"bogus"
.
toCharArray
(),
false
);
s
=
Context
.
fromJAAS
(
"server"
);
c
.
startAsClient
(
OneKDC
.
SERVER
,
GSSUtil
.
GSS_KRB5_MECH_OID
);
s
.
startAsServer
(
GSSUtil
.
GSS_KRB5_MECH_OID
);
Context
.
handshake
(
c
,
s
);
s
.
dispose
();
c
.
dispose
();
}
}
test/sun/security/krb5/auto/MoreKvno.java
浏览文件 @
788f0fdd
...
...
@@ -23,8 +23,7 @@
/*
* @test
* @bug 6893158
* @bug 6907425
* @bug 6893158 6907425 7197159
* @run main/othervm MoreKvno
* @summary AP_REQ check should use key version number
*/
...
...
@@ -69,11 +68,13 @@ public class MoreKvno {
go
(
OneKDC
.
SERVER
,
"com.sun.security.jgss.krb5.accept"
,
pass
);
throw
new
Exception
(
"This test should fail"
);
}
catch
(
GSSException
gsse
)
{
KrbException
ke
=
(
KrbException
)
gsse
.
getCause
();
if
(
ke
.
returnCode
()
!=
Krb5
.
KRB_AP_ERR_BADKEYVER
)
{
throw
new
Exception
(
"Not expected failure code: "
+
ke
.
returnCode
());
}
// Since 7197159, different kvno is accepted, this return code
// will never be thrown out again.
//KrbException ke = (KrbException)gsse.getCause();
//if (ke.returnCode() != Krb5.KRB_AP_ERR_BADKEYVER) {
// throw new Exception("Not expected failure code: " +
// ke.returnCode());
//}
}
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录