changeset 14174:10149d2837c2

8214440: ldap over a TLS connection negotiate failed with "javax.net.ssl.SSLPeerUnverifiedException: hostname of the server '' does not match the hostname in the server's certificate" Reviewed-by: vtewari, xuelei
author robm
date Thu, 10 Jan 2019 07:54:16 -0800
parents ea8bd96492c6
children e5da2855d413
files src/share/classes/com/sun/jndi/ldap/ext/StartTlsResponseImpl.java
diffstat 1 files changed, 2 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/src/share/classes/com/sun/jndi/ldap/ext/StartTlsResponseImpl.java	Wed Nov 04 21:53:16 2020 +0000
+++ b/src/share/classes/com/sun/jndi/ldap/ext/StartTlsResponseImpl.java	Thu Jan 10 07:54:16 2019 -0800
@@ -288,7 +288,8 @@
      */
     public void setConnection(Connection ldapConnection, String hostname) {
         this.ldapConnection = ldapConnection;
-        this.hostname = (hostname != null) ? hostname : ldapConnection.host;
+        this.hostname = (hostname == null || hostname.isEmpty())
+            ? ldapConnection.host : hostname;
         originalInputStream = ldapConnection.inStream;
         originalOutputStream = ldapConnection.outStream;
     }