Commit 2439ff99 authored by Bradley Nicholes's avatar Bradley Nicholes
Browse files

Make sure that the LDAPVerifyServerCert patch is compatibile with apr-util...

Make sure that the LDAPVerifyServerCert patch is compatibile with apr-util 1.1.x.  Once apr-util 1.2 is released, the ifdef's need to be removed and apr_ldap_set_option() will handle the SDK differences.

git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@169834 13f79535-47bb-0310-9956-ffa450edef68
parent 0c399fb8
Loading
Loading
Loading
Loading
+23 −0
Original line number Diff line number Diff line
@@ -330,8 +330,31 @@ static int uldap_connection_open(request_rec *r,
        /* always default to LDAP V3 */
        ldap_set_option(ldc->ldap, LDAP_OPT_PROTOCOL_VERSION, &version);

/*XXX All of the #ifdef's need to be removed once apr-util 1.2 is released */
#ifdef APR_LDAP_OPT_VERIFY_CERT
        apr_ldap_set_option(ldc->pool, ldc->ldap, 
                            APR_LDAP_OPT_VERIFY_CERT, &(st->verify_svr_cert), &(result));
#else
#if defined(LDAPSSL_VERIFY_SERVER)
        if (st->verify_svr_cert) {
            result->rc = ldapssl_set_verify_mode(LDAPSSL_VERIFY_SERVER);
        }
        else {
            result->rc = ldapssl_set_verify_mode(LDAPSSL_VERIFY_NONE);
        }
#elif defined(LDAP_OPT_X_TLS_REQUIRE_CERT)
		/* This is not a per-connection setting so just pass NULL for the
		   Ldap connection handle */
        if (st->verify_svr_cert) {
			int i = LDAP_OPT_X_TLS_DEMAND;
			result->rc = ldap_set_option(NULL, LDAP_OPT_X_TLS_REQUIRE_CERT, &i);
        }
        else {
			int i = LDAP_OPT_X_TLS_NEVER;
			result->rc = ldap_set_option(NULL, LDAP_OPT_X_TLS_REQUIRE_CERT, &i);
        }
#endif
#endif

#ifdef LDAP_OPT_NETWORK_TIMEOUT
        if (st->connectionTimeout > 0) {