]> git.sur5r.net Git - openldap/commitdiff
ITS#7014 TLS: don't check hostname if reqcert is 'allow'
authorJan Vcelak <jvcelak@redhat.com>
Tue, 9 Aug 2011 13:21:34 +0000 (15:21 +0200)
committerHoward Chu <hyc@openldap.org>
Wed, 24 Aug 2011 22:27:29 +0000 (15:27 -0700)
If server certificate hostname does not match the server hostname,
connection is closed even if client has set TLS_REQCERT to 'allow'. This
is wrong - the documentation says, that bad certificates are being
ignored when TLS_REQCERT is set to 'allow'.

libraries/libldap/tls2.c

index f38db2755d9c0320afc0533815d489ced806a469..3f05c1e127b9e3d910aeac3e68c81592aff20aec 100644 (file)
@@ -838,7 +838,8 @@ ldap_int_tls_start ( LDAP *ld, LDAPConn *conn, LDAPURLDesc *srv )
        /* 
         * compare host with name(s) in certificate
         */
-       if (ld->ld_options.ldo_tls_require_cert != LDAP_OPT_X_TLS_NEVER) {
+       if (ld->ld_options.ldo_tls_require_cert != LDAP_OPT_X_TLS_NEVER &&
+           ld->ld_options.ldo_tls_require_cert != LDAP_OPT_X_TLS_ALLOW) {
                ld->ld_errno = ldap_pvt_tls_check_hostname( ld, ssl, host );
                if (ld->ld_errno != LDAP_SUCCESS) {
                        return ld->ld_errno;