HADOOP-12656. MiniKdc throws "address in use" BindException. (Contributed by Wei-Chiu Chuang)
This commit is contained in:
parent
223b47b398
commit
e0a40b2dc2
|
@ -776,6 +776,9 @@ Release 2.8.0 - UNRELEASED
|
||||||
HADOOP-12468. Partial group resolution failure should not result in user
|
HADOOP-12468. Partial group resolution failure should not result in user
|
||||||
lockout. (Wei-Chiu Chuang via Yongjun Zhang)
|
lockout. (Wei-Chiu Chuang via Yongjun Zhang)
|
||||||
|
|
||||||
|
HADOOP-12656. MiniKdc throws "address in use" BindException.
|
||||||
|
(Wei-Chiu Chuang via Arpit Agarwal)
|
||||||
|
|
||||||
OPTIMIZATIONS
|
OPTIMIZATIONS
|
||||||
|
|
||||||
HADOOP-12051. ProtobufRpcEngine.invoke() should use Exception.toString()
|
HADOOP-12051. ProtobufRpcEngine.invoke() should use Exception.toString()
|
||||||
|
|
|
@ -41,6 +41,7 @@ import org.apache.directory.server.kerberos.kdc.KdcServer;
|
||||||
import org.apache.directory.server.kerberos.shared.crypto.encryption.KerberosKeyFactory;
|
import org.apache.directory.server.kerberos.shared.crypto.encryption.KerberosKeyFactory;
|
||||||
import org.apache.directory.server.kerberos.shared.keytab.Keytab;
|
import org.apache.directory.server.kerberos.shared.keytab.Keytab;
|
||||||
import org.apache.directory.server.kerberos.shared.keytab.KeytabEntry;
|
import org.apache.directory.server.kerberos.shared.keytab.KeytabEntry;
|
||||||
|
import org.apache.directory.server.protocol.shared.transport.AbstractTransport;
|
||||||
import org.apache.directory.server.protocol.shared.transport.TcpTransport;
|
import org.apache.directory.server.protocol.shared.transport.TcpTransport;
|
||||||
import org.apache.directory.server.protocol.shared.transport.UdpTransport;
|
import org.apache.directory.server.protocol.shared.transport.UdpTransport;
|
||||||
import org.apache.directory.server.xdbm.Index;
|
import org.apache.directory.server.xdbm.Index;
|
||||||
|
@ -63,8 +64,7 @@ import java.io.InputStream;
|
||||||
import java.io.InputStreamReader;
|
import java.io.InputStreamReader;
|
||||||
import java.io.StringReader;
|
import java.io.StringReader;
|
||||||
import java.lang.reflect.Method;
|
import java.lang.reflect.Method;
|
||||||
import java.net.InetAddress;
|
import java.net.InetSocketAddress;
|
||||||
import java.net.ServerSocket;
|
|
||||||
import java.text.MessageFormat;
|
import java.text.MessageFormat;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
|
@ -264,12 +264,6 @@ public class MiniKdc {
|
||||||
LOG.info("---------------------------------------------------------------");
|
LOG.info("---------------------------------------------------------------");
|
||||||
this.conf = conf;
|
this.conf = conf;
|
||||||
port = Integer.parseInt(conf.getProperty(KDC_PORT));
|
port = Integer.parseInt(conf.getProperty(KDC_PORT));
|
||||||
if (port == 0) {
|
|
||||||
ServerSocket ss = new ServerSocket(0, 1, InetAddress.getByName
|
|
||||||
(conf.getProperty(KDC_BIND_ADDRESS)));
|
|
||||||
port = ss.getLocalPort();
|
|
||||||
ss.close();
|
|
||||||
}
|
|
||||||
String orgName= conf.getProperty(ORG_NAME);
|
String orgName= conf.getProperty(ORG_NAME);
|
||||||
String orgDomain = conf.getProperty(ORG_DOMAIN);
|
String orgDomain = conf.getProperty(ORG_DOMAIN);
|
||||||
realm = orgName.toUpperCase(Locale.ENGLISH) + "."
|
realm = orgName.toUpperCase(Locale.ENGLISH) + "."
|
||||||
|
@ -432,15 +426,23 @@ public class MiniKdc {
|
||||||
|
|
||||||
// transport
|
// transport
|
||||||
String transport = conf.getProperty(TRANSPORT);
|
String transport = conf.getProperty(TRANSPORT);
|
||||||
|
AbstractTransport absTransport;
|
||||||
if (transport.trim().equals("TCP")) {
|
if (transport.trim().equals("TCP")) {
|
||||||
kdc.addTransports(new TcpTransport(bindAddress, port, 3, 50));
|
absTransport = new TcpTransport(bindAddress, port, 3, 50);
|
||||||
} else if (transport.trim().equals("UDP")) {
|
} else if (transport.trim().equals("UDP")) {
|
||||||
kdc.addTransports(new UdpTransport(port));
|
absTransport = new UdpTransport(port);
|
||||||
} else {
|
} else {
|
||||||
throw new IllegalArgumentException("Invalid transport: " + transport);
|
throw new IllegalArgumentException("Invalid transport: " + transport);
|
||||||
}
|
}
|
||||||
|
kdc.addTransports(absTransport);
|
||||||
kdc.setServiceName(conf.getProperty(INSTANCE));
|
kdc.setServiceName(conf.getProperty(INSTANCE));
|
||||||
kdc.start();
|
kdc.start();
|
||||||
|
// if using ephemeral port, update port number for binding
|
||||||
|
if (port == 0) {
|
||||||
|
InetSocketAddress addr =
|
||||||
|
(InetSocketAddress)absTransport.getAcceptor().getLocalAddress();
|
||||||
|
port = addr.getPort();
|
||||||
|
}
|
||||||
|
|
||||||
StringBuilder sb = new StringBuilder();
|
StringBuilder sb = new StringBuilder();
|
||||||
InputStream is2 = cl.getResourceAsStream("minikdc-krb5.conf");
|
InputStream is2 = cl.getResourceAsStream("minikdc-krb5.conf");
|
||||||
|
|
Loading…
Reference in New Issue