Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openanolis
dragonwell8_jdk
提交
f8ec7c8a
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看板
提交
f8ec7c8a
编写于
1月 05, 2010
作者:
W
weijun
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
6895424: RFC 5653
Reviewed-by: valeriep
上级
dfe395b0
变更
6
隐藏空白更改
内联
并排
Showing
6 changed file
with
124 addition
and
22 deletion
+124
-22
src/share/classes/org/ietf/jgss/GSSName.java
src/share/classes/org/ietf/jgss/GSSName.java
+5
-4
src/share/classes/sun/security/jgss/GSSManagerImpl.java
src/share/classes/sun/security/jgss/GSSManagerImpl.java
+6
-1
src/share/classes/sun/security/jgss/GSSNameImpl.java
src/share/classes/sun/security/jgss/GSSNameImpl.java
+27
-1
src/share/classes/sun/security/jgss/GSSUtil.java
src/share/classes/sun/security/jgss/GSSUtil.java
+1
-4
src/share/classes/sun/security/jgss/wrapper/GSSNameElement.java
...are/classes/sun/security/jgss/wrapper/GSSNameElement.java
+5
-12
test/sun/security/krb5/auto/Test5653.java
test/sun/security/krb5/auto/Test5653.java
+80
-0
未找到文件。
src/share/classes/org/ietf/jgss/GSSName.java
浏览文件 @
f8ec7c8a
/*
/*
* Copyright 2000 Sun Microsystems, Inc. All Rights Reserved.
* Copyright 2000
-2010
Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
*
* This code is free software; you can redistribute it and/or modify it
* This code is free software; you can redistribute it and/or modify it
...
@@ -103,11 +103,12 @@ public interface GSSName {
...
@@ -103,11 +103,12 @@ public interface GSSName {
* follows: service@hostname.<p>
* follows: service@hostname.<p>
*
*
* It represents the following Oid value:<br>
* It represents the following Oid value:<br>
* <code>{ 1(iso), 3(org), 6(dod), 1(internet), 5(security),
* <code>{ iso(1) member-body(2) United
* 6(nametypes), 2(gss-host-based-services) }</code>
* States(840) mit(113554) infosys(1) gssapi(2) generic(1) service_name(4)
* }</code>
*/
*/
public
static
final
Oid
NT_HOSTBASED_SERVICE
public
static
final
Oid
NT_HOSTBASED_SERVICE
=
Oid
.
getInstance
(
"1.
3.6.1.5.6.2
"
);
=
Oid
.
getInstance
(
"1.
2.840.113554.1.2.1.4
"
);
/**
/**
* Name type to indicate a named user on a local system.<p>
* Name type to indicate a named user on a local system.<p>
...
...
src/share/classes/sun/security/jgss/GSSManagerImpl.java
浏览文件 @
f8ec7c8a
/*
/*
* Copyright 2000-20
09
Sun Microsystems, Inc. All Rights Reserved.
* Copyright 2000-20
10
Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
*
* This code is free software; you can redistribute it and/or modify it
* This code is free software; you can redistribute it and/or modify it
...
@@ -89,6 +89,11 @@ public class GSSManagerImpl extends GSSManager {
...
@@ -89,6 +89,11 @@ public class GSSManagerImpl extends GSSManager {
Oid
[]
retVal
=
new
Oid
[
mechs
.
length
];
Oid
[]
retVal
=
new
Oid
[
mechs
.
length
];
int
pos
=
0
;
int
pos
=
0
;
// Compatibility with RFC 2853 old NT_HOSTBASED_SERVICE value.
if
(
nameType
.
equals
(
GSSNameImpl
.
oldHostbasedServiceName
))
{
nameType
=
GSSName
.
NT_HOSTBASED_SERVICE
;
}
// Iterate thru all mechs in GSS
// Iterate thru all mechs in GSS
for
(
int
i
=
0
;
i
<
mechs
.
length
;
i
++)
{
for
(
int
i
=
0
;
i
<
mechs
.
length
;
i
++)
{
// what nametypes does this mech support?
// what nametypes does this mech support?
...
...
src/share/classes/sun/security/jgss/GSSNameImpl.java
浏览文件 @
f8ec7c8a
/*
/*
* Copyright 2000-20
06
Sun Microsystems, Inc. All Rights Reserved.
* Copyright 2000-20
10
Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
*
* This code is free software; you can redistribute it and/or modify it
* This code is free software; you can redistribute it and/or modify it
...
@@ -81,6 +81,29 @@ import sun.security.util.DerOutputStream;
...
@@ -81,6 +81,29 @@ import sun.security.util.DerOutputStream;
public
class
GSSNameImpl
implements
GSSName
{
public
class
GSSNameImpl
implements
GSSName
{
/**
* The old Oid used in RFC 2853. Now supported as
* input parameters in:
*
* 1. The four overloaded GSSManager.createName(*) methods
* 2. GSSManager.getMechsForName(Oid)
*
* Note that even if a GSSName is created with this old Oid,
* its internal name type and getStringNameType() output are
* always the new value.
*/
final
static
Oid
oldHostbasedServiceName
;
static
{
Oid
tmp
=
null
;
try
{
tmp
=
new
Oid
(
"1.3.6.1.5.6.2"
);
}
catch
(
Exception
e
)
{
// should never happen
}
oldHostbasedServiceName
=
tmp
;
}
private
GSSManagerImpl
gssManager
=
null
;
private
GSSManagerImpl
gssManager
=
null
;
/*
/*
...
@@ -134,6 +157,9 @@ public class GSSNameImpl implements GSSName {
...
@@ -134,6 +157,9 @@ public class GSSNameImpl implements GSSName {
Oid
mech
)
Oid
mech
)
throws
GSSException
{
throws
GSSException
{
if
(
oldHostbasedServiceName
.
equals
(
appNameType
))
{
appNameType
=
GSSName
.
NT_HOSTBASED_SERVICE
;
}
if
(
appName
==
null
)
if
(
appName
==
null
)
throw
new
GSSExceptionImpl
(
GSSException
.
BAD_NAME
,
throw
new
GSSExceptionImpl
(
GSSException
.
BAD_NAME
,
"Cannot import null name"
);
"Cannot import null name"
);
...
...
src/share/classes/sun/security/jgss/GSSUtil.java
浏览文件 @
f8ec7c8a
/*
/*
* Copyright 2000-20
09
Sun Microsystems, Inc. All Rights Reserved.
* Copyright 2000-20
10
Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
*
* This code is free software; you can redistribute it and/or modify it
* This code is free software; you can redistribute it and/or modify it
...
@@ -66,9 +66,6 @@ public class GSSUtil {
...
@@ -66,9 +66,6 @@ public class GSSUtil {
public
static
final
Oid
NT_GSS_KRB5_PRINCIPAL
=
public
static
final
Oid
NT_GSS_KRB5_PRINCIPAL
=
GSSUtil
.
createOid
(
"1.2.840.113554.1.2.2.1"
);
GSSUtil
.
createOid
(
"1.2.840.113554.1.2.2.1"
);
public
static
final
Oid
NT_HOSTBASED_SERVICE2
=
GSSUtil
.
createOid
(
"1.2.840.113554.1.2.1.4"
);
private
static
final
String
DEFAULT_HANDLER
=
private
static
final
String
DEFAULT_HANDLER
=
"auth.login.defaultCallbackHandler"
;
"auth.login.defaultCallbackHandler"
;
...
...
src/share/classes/sun/security/jgss/wrapper/GSSNameElement.java
浏览文件 @
f8ec7c8a
/*
/*
* Copyright 2005-20
06
Sun Microsystems, Inc. All Rights Reserved.
* Copyright 2005-20
10
Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
*
* This code is free software; you can redistribute it and/or modify it
* This code is free software; you can redistribute it and/or modify it
...
@@ -55,8 +55,7 @@ public class GSSNameElement implements GSSNameSpi {
...
@@ -55,8 +55,7 @@ public class GSSNameElement implements GSSNameSpi {
static
final
GSSNameElement
DEF_ACCEPTOR
=
new
GSSNameElement
();
static
final
GSSNameElement
DEF_ACCEPTOR
=
new
GSSNameElement
();
private
static
Oid
getNativeNameType
(
Oid
nameType
,
GSSLibStub
stub
)
{
private
static
Oid
getNativeNameType
(
Oid
nameType
,
GSSLibStub
stub
)
{
if
(
GSSUtil
.
NT_GSS_KRB5_PRINCIPAL
.
equals
(
nameType
)
||
if
(
GSSUtil
.
NT_GSS_KRB5_PRINCIPAL
.
equals
(
nameType
))
{
GSSName
.
NT_HOSTBASED_SERVICE
.
equals
(
nameType
))
{
Oid
[]
supportedNTs
=
null
;
Oid
[]
supportedNTs
=
null
;
try
{
try
{
supportedNTs
=
stub
.
inquireNamesForMech
();
supportedNTs
=
stub
.
inquireNamesForMech
();
...
@@ -83,15 +82,9 @@ public class GSSNameElement implements GSSNameSpi {
...
@@ -83,15 +82,9 @@ public class GSSNameElement implements GSSNameSpi {
if
(
supportedNTs
[
i
].
equals
(
nameType
))
return
nameType
;
if
(
supportedNTs
[
i
].
equals
(
nameType
))
return
nameType
;
}
}
// Special handling the specified name type
// Special handling the specified name type
if
(
GSSUtil
.
NT_GSS_KRB5_PRINCIPAL
.
equals
(
nameType
))
{
SunNativeProvider
.
debug
(
"Override "
+
nameType
+
SunNativeProvider
.
debug
(
"Override "
+
nameType
+
" with mechanism default(null)"
);
" with mechanism default(null)"
);
return
null
;
// Use mechanism specific default
return
null
;
// Use mechanism specific default
}
else
{
SunNativeProvider
.
debug
(
"Override "
+
nameType
+
" with "
+
GSSUtil
.
NT_HOSTBASED_SERVICE2
);
return
GSSUtil
.
NT_HOSTBASED_SERVICE2
;
}
}
}
}
}
return
nameType
;
return
nameType
;
...
...
test/sun/security/krb5/auto/Test5653.java
0 → 100644
浏览文件 @
f8ec7c8a
/*
* Copyright 2010 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 6895424
* @summary RFC 5653
*/
import
org.ietf.jgss.GSSContext
;
import
org.ietf.jgss.GSSManager
;
import
org.ietf.jgss.GSSName
;
import
org.ietf.jgss.Oid
;
import
sun.security.jgss.GSSUtil
;
public
class
Test5653
{
public
static
void
main
(
String
[]
args
)
throws
Exception
{
Oid
oldOid
=
new
Oid
(
"1.3.6.1.5.6.2"
);
new
OneKDC
(
null
).
writeJAASConf
();
System
.
setProperty
(
"javax.security.auth.useSubjectCredsOnly"
,
"false"
);
GSSManager
m
=
GSSManager
.
getInstance
();
boolean
found
=
false
;
// Test 1: the getMechsForName() method accepts it.
for
(
Oid
tmp:
m
.
getMechsForName
(
oldOid
))
{
if
(
tmp
.
equals
(
GSSUtil
.
GSS_KRB5_MECH_OID
))
{
found
=
true
;
break
;
}
}
if
(!
found
)
{
throw
new
Exception
(
"Cannot found krb5 mech for old name type"
);
}
// Test 2: the createName() method accepts it.
GSSName
name
=
m
.
createName
(
"server@host.rabbit.hole"
,
oldOid
);
// Test 3: its getStringNameType() output is correct
if
(!
name
.
getStringNameType
().
equals
(
GSSName
.
NT_HOSTBASED_SERVICE
))
{
throw
new
Exception
(
"GSSName not correct name type"
);
}
// Test 4: everything still works.
GSSContext
c1
=
m
.
createContext
(
name
,
GSSUtil
.
GSS_KRB5_MECH_OID
,
null
,
GSSContext
.
DEFAULT_LIFETIME
);
byte
[]
token
=
c1
.
initSecContext
(
new
byte
[
0
],
0
,
0
);
Context
s
;
s
=
Context
.
fromJAAS
(
"server"
);
s
.
startAsServer
(
GSSUtil
.
GSS_KRB5_MECH_OID
);
s
.
x
().
acceptSecContext
(
token
,
0
,
token
.
length
);
}
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录