Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openanolis
dragonwell8_jdk
提交
4347eb29
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看板
提交
4347eb29
编写于
6月 25, 2014
作者:
W
weijun
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
8048073: Cannot read ccache entry with a realm-less service name
Reviewed-by: xuelei
上级
f5d812aa
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
94 addition
and
9 deletion
+94
-9
src/share/classes/sun/security/krb5/internal/ccache/CCacheInputStream.java
.../sun/security/krb5/internal/ccache/CCacheInputStream.java
+24
-5
test/sun/security/krb5/ccache/EmptyRealmCC.java
test/sun/security/krb5/ccache/EmptyRealmCC.java
+68
-0
test/sun/security/krb5/ccache/TimeInCCache.java
test/sun/security/krb5/ccache/TimeInCCache.java
+2
-4
未找到文件。
src/share/classes/sun/security/krb5/internal/ccache/CCacheInputStream.java
浏览文件 @
4347eb29
...
...
@@ -334,15 +334,29 @@ public class CCacheInputStream extends KrbDataInputStream implements FileCCacheC
* returns null.
*/
Credentials
readCred
(
int
version
)
throws
IOException
,
RealmException
,
KrbApErrException
,
Asn1Exception
{
PrincipalName
cpname
=
readPrincipal
(
version
);
if
(
DEBUG
)
PrincipalName
cpname
=
null
;
try
{
cpname
=
readPrincipal
(
version
);
}
catch
(
Exception
e
)
{
// Do not return here. All data for this cred should be fully
// consumed so that we can read the next one.
}
if
(
DEBUG
)
{
System
.
out
.
println
(
">>>DEBUG <CCacheInputStream> client principal is "
+
cpname
);
PrincipalName
spname
=
readPrincipal
(
version
);
if
(
DEBUG
)
}
PrincipalName
spname
=
null
;
try
{
spname
=
readPrincipal
(
version
);
}
catch
(
Exception
e
)
{
// same as above
}
if
(
DEBUG
)
{
System
.
out
.
println
(
">>>DEBUG <CCacheInputStream> server principal is "
+
spname
);
}
EncryptionKey
key
=
readKey
(
version
);
if
(
DEBUG
)
if
(
DEBUG
)
{
System
.
out
.
println
(
">>>DEBUG <CCacheInputStream> key type: "
+
key
.
getEType
());
}
long
times
[]
=
readTimes
();
KerberosTime
authtime
=
new
KerberosTime
(
times
[
0
]);
KerberosTime
starttime
=
...
...
@@ -375,6 +389,11 @@ public class CCacheInputStream extends KrbDataInputStream implements FileCCacheC
byte
[]
ticketData
=
readData
();
byte
[]
ticketData2
=
readData
();
// Skip this cred if either cpname or spname isn't created.
if
(
cpname
==
null
||
spname
==
null
)
{
return
null
;
}
try
{
return
new
Credentials
(
cpname
,
spname
,
key
,
authtime
,
starttime
,
endtime
,
renewTill
,
skey
,
tFlags
,
...
...
test/sun/security/krb5/ccache/EmptyRealmCC.java
0 → 100644
浏览文件 @
4347eb29
/*
* Copyright (c) 2014, 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 8048073
* @summary Cannot read ccache entry with a realm-less service name
* @compile -XDignore.symbol.file EmptyRealmCC.java
* @run main EmptyRealmCC
*/
import
java.nio.file.Files
;
import
java.nio.file.Paths
;
import
sun.security.krb5.internal.ccache.CredentialsCache
;
public
class
EmptyRealmCC
{
public
static
void
main
(
String
[]
args
)
throws
Exception
{
byte
[]
ccache
=
TimeInCCache
.
ccache
;
// The service name starts at 0x52:
//
// 0050: 00 00 00 02 00 00 00 0A 4D 41 58 49 2E 4C
// ----------- -----------
// 0060: 4F 43 41 4C 00 00 00 06 6B 72 62 74 67 74 00 00
// ----------- -----
// 0070: 00 0A 4D 41 58 49 2E 4C 4F 43 41 4C
// -----
//
// which contains 2 (the length of names), a 10-byte realm, a 6-byte
// name[0], and a 10-byte name[1].
// We will empty the realm, and pack the realm string to another
// name (6-byte ".LOCAL"). Finally "krbtgt/MAXI.LOCAL@MAXI.LOCAL"
// becomes ".LOCAL/krbtgt/MAXI.LOCAL@".
// length of names is now 3
ccache
[
0x55
]
=
3
;
// The empty realm
System
.
arraycopy
(
new
byte
[
4
],
0
,
ccache
,
0x56
,
4
);
// Length of inserted name is 6
System
.
arraycopy
(
new
byte
[]{
0
,
0
,
0
,
6
},
0
,
ccache
,
0x5A
,
4
);
Files
.
write
(
Paths
.
get
(
"tmpcc"
),
TimeInCCache
.
ccache
);
if
(
CredentialsCache
.
getInstance
(
"tmpcc"
).
getCredsList
()
!=
null
)
{
throw
new
Exception
(
"Nothing should be there"
);
}
}
}
test/sun/security/krb5/ccache/TimeInCCache.java
浏览文件 @
4347eb29
...
...
@@ -28,16 +28,14 @@
*/
import
java.io.ByteArrayInputStream
;
import
java.lang.reflect.Field
;
import
java.lang.reflect.Method
;
import
java.nio.file.Files
;
import
java.nio.file.Paths
;
import
sun.security.krb5.internal.ccache.CCacheInputStream
;
import
sun.security.krb5.internal.ccache.Credentials
;
public
class
TimeInCCache
{
// Attention: this field is also used by CorruptedCC.java test
// Attention: this field is also used by 2 other tests:
// CorruptedCC.java and EmptyRealmCC.java
public
static
byte
[]
ccache
;
static
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录