提交 8144faa2 编写于 作者: I igerasim

8077670: sun/security/krb5/auto/MaxRetries.java may fail with BindException

Reviewed-by: chegar
上级 7c594240
...@@ -34,14 +34,18 @@ import java.net.DatagramSocket; ...@@ -34,14 +34,18 @@ import java.net.DatagramSocket;
import java.security.Security; import java.security.Security;
public class MaxRetries { public class MaxRetries {
static int idlePort = -1;
public static void main(String[] args) public static void main(String[] args)
throws Exception { throws Exception {
System.setProperty("sun.security.krb5.debug", "true"); System.setProperty("sun.security.krb5.debug", "true");
new OneKDC(null).writeJAASConf(); new OneKDC(null).writeJAASConf();
// An idle UDP socket to revent PortUnreachableException // An idle UDP socket to prevent PortUnreachableException
DatagramSocket ds = new DatagramSocket(33333); DatagramSocket ds = new DatagramSocket();
idlePort = ds.getLocalPort();
System.setProperty("java.security.krb5.conf", "alternative-krb5.conf"); System.setProperty("java.security.krb5.conf", "alternative-krb5.conf");
...@@ -200,7 +204,7 @@ public class MaxRetries { ...@@ -200,7 +204,7 @@ public class MaxRetries {
fw.write(" kdc_timeout = " + BadKdc.toReal(value*1000) + "\n"); fw.write(" kdc_timeout = " + BadKdc.toReal(value*1000) + "\n");
} }
// Add a bad KDC as the first candidate // Add a bad KDC as the first candidate
fw.write(" kdc = localhost:33333\n"); fw.write(" kdc = localhost:" + idlePort + "\n");
} }
fw.write(s + "\n"); fw.write(s + "\n");
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册