Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openanolis
dragonwell8_jdk
提交
d778db9d
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看板
提交
d778db9d
编写于
7月 10, 2013
作者:
W
weijun
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
8019267: NPE in AbstractSaslImpl when trace level >= FINER in KRB5
Reviewed-by: mullan
上级
8c2cfb7d
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
53 addition
and
16 deletion
+53
-16
src/share/classes/com/sun/security/sasl/util/AbstractSaslImpl.java
.../classes/com/sun/security/sasl/util/AbstractSaslImpl.java
+14
-8
test/sun/security/krb5/auto/SaslGSS.java
test/sun/security/krb5/auto/SaslGSS.java
+39
-8
未找到文件。
src/share/classes/com/sun/security/sasl/util/AbstractSaslImpl.java
浏览文件 @
d778db9d
...
...
@@ -252,13 +252,12 @@ public abstract class AbstractSaslImpl {
/**
* Outputs a byte array
and converts
* Outputs a byte array
. Can be null.
*/
protected
static
final
void
traceOutput
(
String
srcClass
,
String
srcMethod
,
String
traceTag
,
byte
[]
output
)
{
if
(
output
!=
null
)
{
traceOutput
(
srcClass
,
srcMethod
,
traceTag
,
output
,
0
,
output
.
length
);
}
traceOutput
(
srcClass
,
srcMethod
,
traceTag
,
output
,
0
,
output
==
null
?
0
:
output
.
length
);
}
protected
static
final
void
traceOutput
(
String
srcClass
,
String
srcMethod
,
...
...
@@ -274,13 +273,20 @@ public abstract class AbstractSaslImpl {
lev
=
Level
.
FINEST
;
}
ByteArrayOutputStream
out
=
new
ByteArrayOutputStream
(
len
);
new
HexDumpEncoder
().
encodeBuffer
(
new
ByteArrayInputStream
(
output
,
offset
,
len
),
out
);
String
content
;
if
(
output
!=
null
)
{
ByteArrayOutputStream
out
=
new
ByteArrayOutputStream
(
len
);
new
HexDumpEncoder
().
encodeBuffer
(
new
ByteArrayInputStream
(
output
,
offset
,
len
),
out
);
content
=
out
.
toString
();
}
else
{
content
=
"NULL"
;
}
// Message id supplied by caller as part of traceTag
logger
.
logp
(
lev
,
srcClass
,
srcMethod
,
"{0} ( {1} ): {2}"
,
new
Object
[]
{
traceTag
,
new
Integer
(
origlen
),
out
.
toString
()
});
new
Object
[]
{
traceTag
,
new
Integer
(
origlen
),
content
});
}
catch
(
Exception
e
)
{
logger
.
logp
(
Level
.
WARNING
,
srcClass
,
srcMethod
,
"SASLIMPL09:Error generating trace output: {0}"
,
e
);
...
...
test/sun/security/krb5/auto/SaslGSS.java
浏览文件 @
d778db9d
...
...
@@ -23,7 +23,7 @@
/*
* @test
* @bug 8012082
* @bug 8012082
8019267
* @summary SASL: auth-conf negotiated, but unencrypted data is accepted,
* reset to unencrypt
* @compile -XDignore.symbol.file SaslGSS.java
...
...
@@ -37,9 +37,16 @@ import javax.security.sasl.AuthorizeCallback;
import
javax.security.sasl.RealmCallback
;
import
javax.security.sasl.Sasl
;
import
javax.security.sasl.SaslServer
;
import
java.io.ByteArrayOutputStream
;
import
java.io.IOException
;
import
java.io.PrintStream
;
import
java.util.HashMap
;
import
java.util.Locale
;
import
java.util.logging.ConsoleHandler
;
import
java.util.logging.Handler
;
import
java.util.logging.Level
;
import
java.util.logging.Logger
;
import
org.ietf.jgss.*
;
import
sun.security.jgss.GSSUtil
;
...
...
@@ -79,14 +86,28 @@ public class SaslGSS {
}
});
// Handshake
ByteArrayOutputStream
bout
=
new
ByteArrayOutputStream
();
PrintStream
oldErr
=
System
.
err
;
System
.
setErr
(
new
PrintStream
(
bout
));
Logger
.
getLogger
(
"javax.security.sasl"
).
setLevel
(
Level
.
ALL
);
Handler
h
=
new
ConsoleHandler
();
h
.
setLevel
(
Level
.
ALL
);
Logger
.
getLogger
(
"javax.security.sasl"
).
addHandler
(
h
);
byte
[]
token
=
new
byte
[
0
];
token
=
sc
.
initSecContext
(
token
,
0
,
token
.
length
);
token
=
ss
.
evaluateResponse
(
token
);
token
=
sc
.
unwrap
(
token
,
0
,
token
.
length
,
new
MessageProp
(
0
,
false
));
token
[
0
]
=
(
byte
)(((
token
[
0
]
&
4
)
!=
0
)
?
4
:
2
);
token
=
sc
.
wrap
(
token
,
0
,
token
.
length
,
new
MessageProp
(
0
,
false
));
ss
.
evaluateResponse
(
token
);
try
{
// Handshake
token
=
sc
.
initSecContext
(
token
,
0
,
token
.
length
);
token
=
ss
.
evaluateResponse
(
token
);
token
=
sc
.
unwrap
(
token
,
0
,
token
.
length
,
new
MessageProp
(
0
,
false
));
token
[
0
]
=
(
byte
)(((
token
[
0
]
&
4
)
!=
0
)
?
4
:
2
);
token
=
sc
.
wrap
(
token
,
0
,
token
.
length
,
new
MessageProp
(
0
,
false
));
ss
.
evaluateResponse
(
token
);
}
finally
{
System
.
setErr
(
oldErr
);
}
// Talk
// 1. Client sends a auth-int message
...
...
@@ -102,5 +123,15 @@ public class SaslGSS {
if
(!
qop
.
getPrivacy
())
{
throw
new
Exception
();
}
for
(
String
s:
bout
.
toString
().
split
(
"\\n"
))
{
if
(
s
.
contains
(
"KRB5SRV04"
)
&&
s
.
contains
(
"NULL"
))
{
return
;
}
}
System
.
out
.
println
(
"======================="
);
System
.
out
.
println
(
bout
.
toString
());
System
.
out
.
println
(
"======================="
);
throw
new
Exception
(
"Haven't seen KRB5SRV04 with NULL"
);
}
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录