Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openanolis
dragonwell8_jdk
提交
2ebcf8ad
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看板
提交
2ebcf8ad
编写于
5月 05, 2015
作者:
I
igerasim
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
8078439: SPNEGO auth fails if client proposes MS krb5 OID
Reviewed-by: valeriep
上级
20258352
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
192 addition
and
2 deletion
+192
-2
src/share/classes/sun/security/jgss/GSSUtil.java
src/share/classes/sun/security/jgss/GSSUtil.java
+4
-1
src/share/classes/sun/security/jgss/spnego/SpNegoContext.java
...share/classes/sun/security/jgss/spnego/SpNegoContext.java
+8
-1
test/sun/security/jgss/spnego/MSOID.java
test/sun/security/jgss/spnego/MSOID.java
+75
-0
test/sun/security/jgss/spnego/msoid.txt
test/sun/security/jgss/spnego/msoid.txt
+27
-0
test/sun/security/krb5/auto/MSOID2.java
test/sun/security/krb5/auto/MSOID2.java
+78
-0
未找到文件。
src/share/classes/sun/security/jgss/GSSUtil.java
浏览文件 @
2ebcf8ad
...
...
@@ -59,6 +59,8 @@ public class GSSUtil {
GSSUtil
.
createOid
(
"1.2.840.113554.1.2.2"
);
public
static
final
Oid
GSS_KRB5_MECH_OID2
=
GSSUtil
.
createOid
(
"1.3.5.1.5.2"
);
public
static
final
Oid
GSS_KRB5_MECH_OID_MS
=
GSSUtil
.
createOid
(
"1.2.840.48018.1.2.2"
);
public
static
final
Oid
GSS_SPNEGO_MECH_OID
=
GSSUtil
.
createOid
(
"1.3.6.1.5.5.2"
);
...
...
@@ -101,7 +103,8 @@ public class GSSUtil {
public
static
boolean
isKerberosMech
(
Oid
oid
)
{
return
(
GSS_KRB5_MECH_OID
.
equals
(
oid
)
||
GSS_KRB5_MECH_OID2
.
equals
(
oid
));
GSS_KRB5_MECH_OID2
.
equals
(
oid
)
||
GSS_KRB5_MECH_OID_MS
.
equals
(
oid
));
}
...
...
src/share/classes/sun/security/jgss/spnego/SpNegoContext.java
浏览文件 @
2ebcf8ad
...
...
@@ -540,14 +540,21 @@ public class SpNegoContext implements GSSContextSpi {
// get the token for mechanism
byte
[]
accept_token
;
if
(
mechList
[
0
].
equals
(
mech_wanted
))
{
if
(
mechList
[
0
].
equals
(
mech_wanted
)
||
(
GSSUtil
.
isKerberosMech
(
mechList
[
0
])
&&
GSSUtil
.
isKerberosMech
(
mech_wanted
)))
{
// get the mechanism token
if
(
DEBUG
&&
!
mech_wanted
.
equals
(
mechList
[
0
]))
{
System
.
out
.
println
(
"SpNegoContext.acceptSecContext: "
+
"negotiated mech adjusted to "
+
mechList
[
0
]);
}
byte
[]
mechToken
=
initToken
.
getMechToken
();
if
(
mechToken
==
null
)
{
throw
new
GSSException
(
GSSException
.
FAILURE
,
-
1
,
"mechToken is missing"
);
}
accept_token
=
GSS_acceptSecContext
(
mechToken
);
mech_wanted
=
mechList
[
0
];
}
else
{
accept_token
=
null
;
}
...
...
test/sun/security/jgss/spnego/MSOID.java
0 → 100644
浏览文件 @
2ebcf8ad
/*
* Copyright (c) 2015, 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 8078439
* @summary SPNEGO auth fails if client proposes MS krb5 OID
*/
import
org.ietf.jgss.GSSContext
;
import
org.ietf.jgss.GSSCredential
;
import
org.ietf.jgss.GSSException
;
import
org.ietf.jgss.GSSManager
;
import
java.lang.Exception
;
import
java.nio.file.Files
;
import
java.nio.file.Paths
;
import
java.util.Arrays
;
import
java.util.Base64
;
public
class
MSOID
{
public
static
void
main
(
String
[]
args
)
throws
Exception
{
// msoid.txt is a NegTokenInit packet sent from Internet Explorer to
// IIS server on a test machine. No sensitive info included.
byte
[]
header
=
Files
.
readAllBytes
(
Paths
.
get
(
System
.
getProperty
(
"test.src"
),
"msoid.txt"
));
byte
[]
token
=
Base64
.
getMimeDecoder
().
decode
(
Arrays
.
copyOfRange
(
header
,
10
,
header
.
length
));
GSSCredential
cred
=
null
;
GSSContext
ctx
=
GSSManager
.
getInstance
().
createContext
(
cred
);
try
{
ctx
.
acceptSecContext
(
token
,
0
,
token
.
length
);
// Before the fix, GSS_KRB5_MECH_OID_MS is not recognized
// and acceptor chooses another mech and goes on
throw
new
Exception
(
"Should fail"
);
}
catch
(
GSSException
gsse
)
{
// After the fix, GSS_KRB5_MECH_OID_MS is recognized but the token
// cannot be accepted because we don't have any krb5 credential.
gsse
.
printStackTrace
();
if
(
gsse
.
getMajor
()
!=
GSSException
.
NO_CRED
)
{
throw
gsse
;
}
for
(
StackTraceElement
st:
gsse
.
getStackTrace
())
{
if
(
st
.
getClassName
().
startsWith
(
"sun.security.jgss.krb5."
))
{
// Good, it is already in krb5 mech's hand.
return
;
}
}
throw
gsse
;
}
}
}
test/sun/security/jgss/spnego/msoid.txt
0 → 100644
浏览文件 @
2ebcf8ad
Negotiate YIIGPAYGKwYBBQUCoIIGMDCCBiygMDAuBgkqhkiC9xIBAgIGCSqGSIb3EgECAgYKKwYBBA
GCNwICHgYKKwYBBAGCNwICCqKCBfYEggXyYIIF7gYJKoZIhvcSAQICAQBuggXdMIIF2aADAgEFoQMCAQ
6iBwMFACAAAACjggTIYYIExDCCBMCgAwIBBaEOGwxUV0VMVkUuVEhJTkuiIzAhoAMCAQKhGjAYGwRIVF
RQGxBrZGMuVFdFTFZFLlRISU5Lo4IEgjCCBH6gAwIBEqEDAgEJooIEcASCBGyoIL0zQevk57pY6D25+1
SQbAeldYXkpdn8JlKgSyz1cdiTpwqDt8B7pj7AoKMPHCiVss37XCEpBIuZClBK3Jmry+QWXCbQemKvyO
Caz806RDNB7TA7l1NxUJ6LsCiQncNV1TEq37NM6H8il6PjnbcBoMcHH/+cFGVPNP3eP+Z5Kd+5DZELPV
qQkYogXybmngmYy2168OsfyANzotUpm/HBwEHKujCPH9Gbhwhmx4tUcBvCetPNoXmHOQZLB4u7uyblKO
c6R2yGTFCa8DBQNXx38RRHgsvlNGlx+UsSoF4/DixAreNRkZnpKabn1cRK/KZh6vHfbL2QVegr1hrp71
IJwyVuR+RTGL/7WCSWFClJyWD3Cm4+eK46uVj4MKPUJBc0XVViV/Dsh4N9EomVDkovWU/v+0d+W4pQJk
BFnJoNYuaG8UnLWrxMKGNwVOfsblcJtB7B5zuZzsWsUIdmMT1n8mtWrv0wYiwvotfT6z/suk+Vhg9MGd
uDmeneeG9deMDUMwrwB8u5J2VEeWKurBfDB02jv/08qAZS2ovBfV2SiXCuky5z7llvQ8uPsoezVwYdhu
HmBuPE7PqDIkmkEJRWpq95dqxllCXvlL4uINxFadkhcbzuCDjSGil78p6FJTKc4Dt/kuug1zJuXhJO1L
2CgkMsYPTogoUvAtplzIDF0nSM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UYtidwxcRRkvCaNEhphtr8hp8
hXWQkuxVvF2TiQyHF4PnJkgb1Zr6GXydOmMgMJE1anPFKFKWH6PZWGnp8mw0F5zw==
test/sun/security/krb5/auto/MSOID2.java
0 → 100644
浏览文件 @
2ebcf8ad
/*
* Copyright (c) 2015, 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 8078439
* @summary SPNEGO auth fails if client proposes MS krb5 OID
* @compile -XDignore.symbol.file MSOID2.java
* @run main/othervm MSOID2
*/
import
sun.security.jgss.GSSUtil
;
// The basic krb5 test skeleton you can copy from
public
class
MSOID2
{
public
static
void
main
(
String
[]
args
)
throws
Exception
{
new
OneKDC
(
null
).
writeJAASConf
();
Context
c
,
s
;
c
=
Context
.
fromJAAS
(
"client"
);
s
=
Context
.
fromJAAS
(
"server"
);
c
.
startAsClient
(
OneKDC
.
SERVER
,
GSSUtil
.
GSS_SPNEGO_MECH_OID
);
s
.
startAsServer
(
GSSUtil
.
GSS_SPNEGO_MECH_OID
);
byte
[]
t
=
new
byte
[
0
];
boolean
first
=
true
;
while
(
true
)
{
if
(
t
!=
null
||
!
c
.
x
().
isEstablished
())
t
=
c
.
take
(
t
);
if
(
first
)
{
// Tweak the packet to append an extra OID
int
len
=
t
.
length
;
byte
[]
nt
=
new
byte
[
len
+
11
];
System
.
arraycopy
(
t
,
0
,
nt
,
0
,
0x23
);
System
.
arraycopy
(
t
,
0x18
,
nt
,
0x23
,
11
);
// dup the OID
System
.
arraycopy
(
t
,
0x23
,
nt
,
0x2e
,
len
-
0x23
);
nt
[
0x1d
]
=
(
byte
)
0x82
;
// change the 1st to MS OID
// Length bytes to be tweaked
for
(
int
pos:
new
int
[]
{
3
,
0xf
,
0x13
,
0x15
,
0x17
})
{
nt
[
pos
]
=
(
byte
)(
nt
[
pos
]
+
11
);
}
t
=
nt
;
new
sun
.
misc
.
HexDumpEncoder
().
encodeBuffer
(
t
,
System
.
out
);
}
if
(
t
!=
null
||
!
s
.
x
().
isEstablished
())
t
=
s
.
take
(
t
);
if
(
c
.
x
().
isEstablished
()
&&
s
.
x
().
isEstablished
())
break
;
first
=
false
;
}
Context
.
transmit
(
"i say high --"
,
c
,
s
);
Context
.
transmit
(
" you say low"
,
s
,
c
);
s
.
dispose
();
c
.
dispose
();
}
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录