Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openanolis
dragonwell8_jdk
提交
76638d18
D
dragonwell8_jdk
项目概览
openanolis
/
dragonwell8_jdk
通知
3
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看板
体验新版 GitCode,发现更多精彩内容 >>
提交
76638d18
编写于
7月 19, 2010
作者:
W
weijun
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
6969292: make DNS lookup for realm/kdc really work
Reviewed-by: alanb, valeriep
上级
41702346
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
43 addition
and
17 deletion
+43
-17
src/share/classes/sun/security/krb5/Config.java
src/share/classes/sun/security/krb5/Config.java
+43
-17
未找到文件。
src/share/classes/sun/security/krb5/Config.java
浏览文件 @
76638d18
...
...
@@ -42,6 +42,8 @@ import java.util.Enumeration;
import
java.util.StringTokenizer
;
import
java.net.InetAddress
;
import
java.net.UnknownHostException
;
import
java.util.List
;
import
sun.net.dns.ResolverConfiguration
;
import
sun.security.krb5.internal.crypto.EType
;
import
sun.security.krb5.internal.ktab.*
;
import
sun.security.krb5.internal.Krb5
;
...
...
@@ -1180,6 +1182,33 @@ public class Config {
}
// get the domain realm mapping from the configuration
String
mapRealm
=
PrincipalName
.
mapHostToRealm
(
hostName
);
if
(
mapRealm
==
null
)
{
// No match. Try search and/or domain in /etc/resolv.conf
List
<
String
>
srchlist
=
ResolverConfiguration
.
open
().
searchlist
();
for
(
String
domain:
srchlist
)
{
realm
=
checkRealm
(
domain
);
if
(
realm
!=
null
)
{
break
;
}
}
}
else
{
realm
=
checkRealm
(
mapRealm
);
}
if
(
realm
==
null
)
{
throw
new
KrbException
(
Krb5
.
KRB_ERR_GENERIC
,
"Unable to locate Kerberos realm"
);
}
return
realm
;
}
/**
* Check if the provided realm is the correct realm
* @return the realm if correct, or null otherwise
*/
private
static
String
checkRealm
(
String
mapRealm
)
{
if
(
DEBUG
)
{
System
.
out
.
println
(
"getRealmFromDNS: trying "
+
mapRealm
);
}
String
[]
records
=
null
;
String
newRealm
=
mapRealm
;
while
((
records
==
null
)
&&
(
newRealm
!=
null
))
{
...
...
@@ -1188,23 +1217,14 @@ public class Config {
newRealm
=
Realm
.
parseRealmComponent
(
newRealm
);
// if no DNS TXT records found, try again using sub-realm
}
if
(
records
==
null
)
{
// no DNS TXT records
throw
new
KrbException
(
Krb5
.
KRB_ERR_GENERIC
,
"Unable to locate Kerberos realm"
);
}
boolean
found
=
false
;
for
(
int
i
=
0
;
i
<
records
.
length
;
i
++)
{
if
(
records
[
i
].
equals
(
mapRealm
))
{
found
=
true
;
realm
=
records
[
i
];
if
(
records
!=
null
)
{
for
(
int
i
=
0
;
i
<
records
.
length
;
i
++)
{
if
(
records
[
i
].
equalsIgnoreCase
(
mapRealm
))
{
return
records
[
i
];
}
}
}
if
(
found
==
false
)
{
throw
new
KrbException
(
Krb5
.
KRB_ERR_GENERIC
,
"Unable to locate Kerberos realm"
);
}
return
realm
;
return
null
;
}
/**
...
...
@@ -1218,10 +1238,16 @@ public class Config {
String
kdcs
=
null
;
String
[]
srvs
=
null
;
// locate DNS SRV record using UDP
srvs
=
KrbServiceLocator
.
getKerberosService
(
realm
,
"_udp."
);
if
(
DEBUG
)
{
System
.
out
.
println
(
"getKDCFromDNS using UDP"
);
}
srvs
=
KrbServiceLocator
.
getKerberosService
(
realm
,
"_udp"
);
if
(
srvs
==
null
)
{
// locate DNS SRV record using TCP
srvs
=
KrbServiceLocator
.
getKerberosService
(
realm
,
"_tcp."
);
if
(
DEBUG
)
{
System
.
out
.
println
(
"getKDCFromDNS using UDP"
);
}
srvs
=
KrbServiceLocator
.
getKerberosService
(
realm
,
"_tcp"
);
}
if
(
srvs
==
null
)
{
// no DNS SRV records
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录