Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openanolis
dragonwell8_jdk
提交
3efae8d9
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看板
提交
3efae8d9
编写于
7月 08, 2009
作者:
W
weijun
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
6857795: krb5.conf ignored if system properties on realm and kdc are provided
Reviewed-by: xuelei
上级
1a2aac7d
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
133 addition
and
14 deletion
+133
-14
src/share/classes/sun/security/krb5/Config.java
src/share/classes/sun/security/krb5/Config.java
+21
-14
test/sun/security/krb5/ConfPlusProp.java
test/sun/security/krb5/ConfPlusProp.java
+94
-0
test/sun/security/krb5/confplusprop.conf
test/sun/security/krb5/confplusprop.conf
+11
-0
test/sun/security/krb5/confplusprop2.conf
test/sun/security/krb5/confplusprop2.conf
+7
-0
未找到文件。
src/share/classes/sun/security/krb5/Config.java
浏览文件 @
3efae8d9
...
...
@@ -123,7 +123,7 @@ public class Config {
java
.
security
.
AccessController
.
doPrivileged
(
new
sun
.
security
.
action
.
GetPropertyAction
(
"java.security.krb5.kdc"
));
defaultRealm
=
defaultRealm
=
java
.
security
.
AccessController
.
doPrivileged
(
new
sun
.
security
.
action
.
GetPropertyAction
(
"java.security.krb5.realm"
));
...
...
@@ -134,6 +134,16 @@ public class Config {
"java.security.krb5.realm both must be set or "
+
"neither must be set."
);
}
// Read the Kerberos configuration file
try
{
Vector
<
String
>
configFile
;
configFile
=
loadConfigFile
();
stanzaTable
=
parseStanzaTable
(
configFile
);
}
catch
(
IOException
ioe
)
{
// No krb5.conf, no problem. We'll use DNS etc.
}
if
(
kdchost
!=
null
)
{
/*
* If configuration information is only specified by
...
...
@@ -141,22 +151,19 @@ public class Config {
* java.security.krb5.realm, we put both in the hashtable
* under [libdefaults].
*/
Hashtable
<
String
,
String
>
kdcs
=
new
Hashtable
<
String
,
String
>
();
if
(
stanzaTable
==
null
)
{
stanzaTable
=
new
Hashtable
<
String
,
Object
>
();
}
Hashtable
<
String
,
String
>
kdcs
=
(
Hashtable
<
String
,
String
>)
stanzaTable
.
get
(
"libdefaults"
);
if
(
kdcs
==
null
)
{
kdcs
=
new
Hashtable
<
String
,
String
>
();
stanzaTable
.
put
(
"libdefaults"
,
kdcs
);
}
kdcs
.
put
(
"default_realm"
,
defaultRealm
);
// The user can specify a list of kdc hosts separated by ":"
kdchost
=
kdchost
.
replace
(
':'
,
' '
);
kdcs
.
put
(
"kdc"
,
kdchost
);
stanzaTable
=
new
Hashtable
<
String
,
Object
>
();
stanzaTable
.
put
(
"libdefaults"
,
kdcs
);
}
else
{
// Read the Kerberos configuration file
try
{
Vector
<
String
>
configFile
;
configFile
=
loadConfigFile
();
stanzaTable
=
parseStanzaTable
(
configFile
);
}
catch
(
IOException
ioe
)
{
// No krb5.conf, no problem. We'll use DNS etc.
}
}
}
...
...
@@ -294,7 +301,7 @@ public class Config {
* hashtable.
*/
if
(
name
.
equalsIgnoreCase
(
"kdc"
)
&&
(
!
section
.
equalsIgnoreCase
(
"libdefaults"
))
&&
(
section
.
equalsIgnoreCase
(
getDefault
(
"default_realm"
,
"libdefaults"
)
))
&&
(
java
.
security
.
AccessController
.
doPrivileged
(
new
sun
.
security
.
action
.
GetPropertyAction
(
"java.security.krb5.kdc"
))
!=
null
))
{
...
...
test/sun/security/krb5/ConfPlusProp.java
0 → 100644
浏览文件 @
3efae8d9
/*
* Copyright 2009 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 6857795
* @summary krb5.conf ignored if system properties on realm and kdc are provided
*/
import
sun.security.krb5.Config
;
import
sun.security.krb5.KrbException
;
public
class
ConfPlusProp
{
public
static
void
main
(
String
[]
args
)
throws
Exception
{
System
.
setProperty
(
"java.security.krb5.realm"
,
"R2"
);
System
.
setProperty
(
"java.security.krb5.kdc"
,
"k2"
);
// Point to a file with existing default_realm
System
.
setProperty
(
"java.security.krb5.conf"
,
System
.
getProperty
(
"test.src"
,
"."
)
+
"/confplusprop.conf"
);
Config
config
=
Config
.
getInstance
();
if
(!
config
.
getDefaultRealm
().
equals
(
"R2"
))
{
throw
new
Exception
(
"Default realm error"
);
}
if
(!
config
.
getKDCList
(
"R1"
).
equals
(
"k1"
))
{
throw
new
Exception
(
"R1 kdc error"
);
}
if
(!
config
.
getKDCList
(
"R2"
).
equals
(
"k2"
))
{
throw
new
Exception
(
"R2 kdc error"
);
}
if
(!
config
.
getDefault
(
"forwardable"
,
"libdefaults"
).
equals
(
"well"
))
{
throw
new
Exception
(
"Extra config error"
);
}
// Point to a file with no libdefaults
System
.
setProperty
(
"java.security.krb5.conf"
,
System
.
getProperty
(
"test.src"
,
"."
)
+
"/confplusprop2.conf"
);
Config
.
refresh
();
config
=
Config
.
getInstance
();
if
(!
config
.
getDefaultRealm
().
equals
(
"R2"
))
{
throw
new
Exception
(
"Default realm error again"
);
}
if
(!
config
.
getKDCList
(
"R1"
).
equals
(
"k12"
))
{
throw
new
Exception
(
"R1 kdc error"
);
}
if
(!
config
.
getKDCList
(
"R2"
).
equals
(
"k2"
))
{
throw
new
Exception
(
"R2 kdc error"
);
}
// Point to a non-existing file
System
.
setProperty
(
"java.security.krb5.conf"
,
"i-am-not-a file"
);
Config
.
refresh
();
config
=
Config
.
getInstance
();
if
(!
config
.
getDefaultRealm
().
equals
(
"R2"
))
{
throw
new
Exception
(
"Default realm error"
);
}
try
{
config
.
getKDCList
(
"R1"
);
throw
new
Exception
(
"R1 is nowhere"
);
}
catch
(
KrbException
ke
)
{
// OK
}
if
(!
config
.
getKDCList
(
"R2"
).
equals
(
"k2"
))
{
throw
new
Exception
(
"R2 kdc error"
);
}
if
(
config
.
getDefault
(
"forwardable"
,
"libdefaults"
)
!=
null
)
{
throw
new
Exception
(
"Extra config error"
);
}
}
}
test/sun/security/krb5/confplusprop.conf
0 → 100644
浏览文件 @
3efae8d9
[
libdefaults
]
default_realm
=
R1
forwardable
=
well
[
realms
]
R1
= {
kdc
=
k1
}
R2
= {
kdc
=
old
}
test/sun/security/krb5/confplusprop2.conf
0 → 100644
浏览文件 @
3efae8d9
[
realms
]
R1
= {
kdc
=
k12
}
R2
= {
kdc
=
old
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录