Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openanolis
dragonwell8_jdk
提交
3ce7e938
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看板
提交
3ce7e938
编写于
5月 23, 2012
作者:
W
weijun
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
7162687: enhance KDC server availability detection
Reviewed-by: valeriep
上级
bf28673e
变更
8
显示空白变更内容
内联
并排
Showing
8 changed file
with
118 addition
and
38 deletion
+118
-38
src/share/classes/sun/security/krb5/KdcComm.java
src/share/classes/sun/security/krb5/KdcComm.java
+27
-28
src/share/classes/sun/security/krb5/internal/NetClient.java
src/share/classes/sun/security/krb5/internal/NetClient.java
+5
-3
test/ProblemList.txt
test/ProblemList.txt
+3
-0
test/sun/security/krb5/auto/BadKdc.java
test/sun/security/krb5/auto/BadKdc.java
+13
-0
test/sun/security/krb5/auto/MaxRetries.java
test/sun/security/krb5/auto/MaxRetries.java
+8
-0
test/sun/security/krb5/auto/TcpTimeout.java
test/sun/security/krb5/auto/TcpTimeout.java
+1
-7
test/sun/security/krb5/auto/Unreachable.java
test/sun/security/krb5/auto/Unreachable.java
+52
-0
test/sun/security/krb5/auto/unreachable.krb5.conf
test/sun/security/krb5/auto/unreachable.krb5.conf
+9
-0
未找到文件。
src/share/classes/sun/security/krb5/KdcComm.java
浏览文件 @
3ce7e938
...
...
@@ -365,8 +365,8 @@ public final class KdcComm {
for
(
int
i
=
1
;
i
<=
retries
;
i
++)
{
String
proto
=
useTCP
?
"TCP"
:
"UDP"
;
NetClient
kdcClient
=
NetClient
.
getInstance
(
proto
,
kdc
,
port
,
timeout
)
;
try
(
NetClient
kdcClient
=
NetClient
.
getInstance
(
proto
,
kdc
,
port
,
timeout
)
)
{
if
(
DEBUG
)
{
System
.
out
.
println
(
">>> KDCCommunication: kdc="
+
kdc
+
" "
+
proto
+
":"
...
...
@@ -394,8 +394,7 @@ public final class KdcComm {
ibuf
=
null
;
throw
se
;
}
}
finally
{
kdcClient
.
close
();
}
}
}
return
ibuf
;
...
...
src/share/classes/sun/security/krb5/internal/NetClient.java
浏览文件 @
3ce7e938
...
...
@@ -34,7 +34,7 @@ package sun.security.krb5.internal;
import
java.io.*
;
import
java.net.*
;
public
abstract
class
NetClient
{
public
abstract
class
NetClient
implements
AutoCloseable
{
public
static
NetClient
getInstance
(
String
protocol
,
String
hostname
,
int
port
,
int
timeout
)
throws
IOException
{
if
(
protocol
.
equals
(
"TCP"
))
{
...
...
@@ -45,9 +45,7 @@ public abstract class NetClient {
}
abstract
public
void
send
(
byte
[]
data
)
throws
IOException
;
abstract
public
byte
[]
receive
()
throws
IOException
;
abstract
public
void
close
()
throws
IOException
;
}
...
...
@@ -190,6 +188,7 @@ class UDPClient extends NetClient {
iport
=
port
;
dgSocket
=
new
DatagramSocket
();
dgSocket
.
setSoTimeout
(
timeout
);
dgSocket
.
connect
(
iaddr
,
iport
);
}
@Override
...
...
@@ -207,6 +206,9 @@ class UDPClient extends NetClient {
dgSocket
.
receive
(
dgPacketIn
);
}
catch
(
SocketException
e
)
{
if
(
e
instanceof
PortUnreachableException
)
{
throw
e
;
}
dgSocket
.
receive
(
dgPacketIn
);
}
byte
[]
data
=
new
byte
[
dgPacketIn
.
getLength
()];
...
...
test/ProblemList.txt
浏览文件 @
3ce7e938
...
...
@@ -222,6 +222,9 @@ java/net/DatagramSocket/SendDatagramToBadAddress.java macosx-all
sun/net/www/protocol/http/B6299712.java macosx-all
java/net/CookieHandler/CookieManagerTest.java macosx-all
# 7164518
sun/security/krb5/auto/Unreachable.java macosx-all
# JPRT needs to set 127.0.0.1 in proxy bypass list
java/net/URLClassLoader/closetest/CloseTest.java macosx-all
############################################################################
...
...
test/sun/security/krb5/auto/BadKdc.java
浏览文件 @
3ce7e938
...
...
@@ -87,6 +87,10 @@ public class BadKdc {
throws
Exception
{
System
.
setProperty
(
"sun.security.krb5.debug"
,
"true"
);
// Idle UDP sockets will trigger a SocketTimeoutException, without it,
// a PortUnreachableException will be thrown.
DatagramSocket
d1
=
null
,
d2
=
null
,
d3
=
null
;
// Make sure KDCs' ports starts with 1 and 2 and 3,
// useful for checking debug output.
int
p1
=
10000
+
new
java
.
util
.
Random
().
nextInt
(
10000
);
...
...
@@ -109,6 +113,8 @@ public class BadKdc {
Config
.
refresh
();
// Turn on k3 only
d1
=
new
DatagramSocket
(
p1
);
d2
=
new
DatagramSocket
(
p2
);
KDC
k3
=
on
(
p3
);
test
(
expected
[
0
]);
...
...
@@ -117,10 +123,17 @@ public class BadKdc {
test
(
expected
[
2
]);
k3
.
terminate
();
// shutdown k3
d3
=
new
DatagramSocket
(
p3
);
d2
.
close
();
on
(
p2
);
// k2 is on
test
(
expected
[
3
]);
d1
.
close
();
on
(
p1
);
// k1 and k2 is on
test
(
expected
[
4
]);
d3
.
close
();
}
private
static
KDC
on
(
int
p
)
throws
Exception
{
...
...
test/sun/security/krb5/auto/MaxRetries.java
浏览文件 @
3ce7e938
...
...
@@ -24,11 +24,13 @@
/*
* @test
* @bug 6844193
* @compile -XDignore.symbol.file MaxRetries.java
* @run main/othervm/timeout=300 MaxRetries
* @summary support max_retries in krb5.conf
*/
import
java.io.*
;
import
java.net.DatagramSocket
;
import
java.security.Security
;
public
class
MaxRetries
{
...
...
@@ -37,6 +39,10 @@ public class MaxRetries {
System
.
setProperty
(
"sun.security.krb5.debug"
,
"true"
);
new
OneKDC
(
null
).
writeJAASConf
();
// An idle UDP socket to revent PortUnreachableException
DatagramSocket
ds
=
new
DatagramSocket
(
33333
);
System
.
setProperty
(
"java.security.krb5.conf"
,
"alternative-krb5.conf"
);
// For tryLast
...
...
@@ -78,6 +84,8 @@ public class MaxRetries {
rewriteUdpPrefLimit
(
10000
,
10
);
// realm rules
test2
(
"TCP"
);
ds
.
close
();
}
/**
...
...
test/sun/security/krb5/auto/TcpTimeout.java
浏览文件 @
3ce7e938
...
...
@@ -24,6 +24,7 @@
/*
* @test
* @bug 6952519
* @compile -XDignore.symbol.file TcpTimeout.java
* @run main/othervm TcpTimeout
* @summary kdc_timeout is not being honoured when using TCP
*/
...
...
@@ -73,9 +74,7 @@ public class TcpTimeout {
// 5 sec on p1, 5 sec on p1, fail
// 5 sec on p2, 5 sec on p2, fail
// p3 ok, p3 ok again for preauth.
// The total time should be 20sec + 2x. x is processing time for AS-REQ.
int
count
=
6
;
long
start
=
System
.
currentTimeMillis
();
ByteArrayOutputStream
bo
=
new
ByteArrayOutputStream
();
PrintStream
oldout
=
System
.
out
;
...
...
@@ -93,10 +92,5 @@ public class TcpTimeout {
if
(
count
!=
0
)
{
throw
new
Exception
(
"Retry count is "
+
count
+
" less"
);
}
long
end
=
System
.
currentTimeMillis
();
if
((
end
-
start
)/
1000L
<
20
)
{
throw
new
Exception
(
"Too fast? "
+
(
end
-
start
)/
1000L
);
}
}
}
test/sun/security/krb5/auto/Unreachable.java
0 → 100644
浏览文件 @
3ce7e938
/*
* Copyright (c) 2012, 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 7162687
* @summary enhance KDC server availability detection
* @compile -XDignore.symbol.file Unreachable.java
* @run main/othervm/timeout=10 Unreachable
*/
import
java.io.File
;
import
javax.security.auth.login.LoginException
;
import
sun.security.krb5.Config
;
public
class
Unreachable
{
public
static
void
main
(
String
[]
args
)
throws
Exception
{
File
f
=
new
File
(
System
.
getProperty
(
"test.src"
,
"."
),
"unreachable.krb5.conf"
);
System
.
setProperty
(
"java.security.krb5.conf"
,
f
.
getPath
());
Config
.
refresh
();
// If PortUnreachableException is not received, the login will consume
// about 3*3*30 seconds and the test will timeout.
try
{
Context
.
fromUserPass
(
"name"
,
"pass"
.
toCharArray
(),
true
);
}
catch
(
LoginException
le
)
{
// This is OK
}
}
}
test/sun/security/krb5/auto/unreachable.krb5.conf
0 → 100644
浏览文件 @
3ce7e938
[
libdefaults
]
default_realm
=
RABBIT
.
HOLE
[
realms
]
RABBIT
.
HOLE
= {
kdc
=
127
.
0
.
0
.
1
:
13434
kdc
=
127
.
0
.
0
.
1
:
13435
kdc
=
127
.
0
.
0
.
1
:
13436
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录