another KRB5 cleanup in java.naming JDK-8145252-TLS13-branch
authorweijun
Thu, 07 Jun 2018 23:53:56 +0800
branchJDK-8145252-TLS13-branch
changeset 56693 64aa781522be
parent 56692 7b0bde908f58
child 56694 aa54a1f8e426
another KRB5 cleanup in java.naming
src/java.naming/share/classes/com/sun/jndi/ldap/ext/StartTlsResponseImpl.java
--- a/src/java.naming/share/classes/com/sun/jndi/ldap/ext/StartTlsResponseImpl.java	Thu Jun 07 23:19:25 2018 +0800
+++ b/src/java.naming/share/classes/com/sun/jndi/ldap/ext/StartTlsResponseImpl.java	Thu Jun 07 23:53:56 2018 +0800
@@ -404,27 +404,16 @@
         try {
             HostnameChecker checker = HostnameChecker.getInstance(
                                                 HostnameChecker.TYPE_LDAP);
-            // Use ciphersuite to determine whether Kerberos is active.
-            if (session.getCipherSuite().startsWith("TLS_KRB5")) {
-                Principal principal = getPeerPrincipal(session);
-                if (!HostnameChecker.match(hostname, principal)) {
-                    throw new SSLPeerUnverifiedException(
-                        "hostname of the kerberos principal:" + principal +
-                        " does not match the hostname:" + hostname);
-                }
-            } else { // X.509
-
-                // get the subject's certificate
-                certs = session.getPeerCertificates();
-                X509Certificate peerCert;
-                if (certs[0] instanceof java.security.cert.X509Certificate) {
-                    peerCert = (java.security.cert.X509Certificate) certs[0];
-                } else {
-                    throw new SSLPeerUnverifiedException(
-                            "Received a non X509Certificate from the server");
-                }
-                checker.match(hostname, peerCert);
+            // get the subject's certificate
+            certs = session.getPeerCertificates();
+            X509Certificate peerCert;
+            if (certs[0] instanceof java.security.cert.X509Certificate) {
+                peerCert = (java.security.cert.X509Certificate) certs[0];
+            } else {
+                throw new SSLPeerUnverifiedException(
+                        "Received a non X509Certificate from the server");
             }
+            checker.match(hostname, peerCert);
 
             // no exception means verification passed
             return true;