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"

Thu, 10 Jan 2019 07:54:16 -0800

author
robm
date
Thu, 10 Jan 2019 07:54:16 -0800
changeset 14227
10149d2837c2
parent 14226
ea8bd96492c6
child 14228
e5da2855d413

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

src/share/classes/com/sun/jndi/ldap/ext/StartTlsResponseImpl.java file | annotate | diff | comparison | revisions
     1.1 --- a/src/share/classes/com/sun/jndi/ldap/ext/StartTlsResponseImpl.java	Wed Nov 04 21:53:16 2020 +0000
     1.2 +++ b/src/share/classes/com/sun/jndi/ldap/ext/StartTlsResponseImpl.java	Thu Jan 10 07:54:16 2019 -0800
     1.3 @@ -288,7 +288,8 @@
     1.4       */
     1.5      public void setConnection(Connection ldapConnection, String hostname) {
     1.6          this.ldapConnection = ldapConnection;
     1.7 -        this.hostname = (hostname != null) ? hostname : ldapConnection.host;
     1.8 +        this.hostname = (hostname == null || hostname.isEmpty())
     1.9 +            ? ldapConnection.host : hostname;
    1.10          originalInputStream = ldapConnection.inStream;
    1.11          originalOutputStream = ldapConnection.outStream;
    1.12      }

mercurial