From 0d91c5eda992a3656c8a4f927f5ba1fa8c4c8653 Mon Sep 17 00:00:00 2001 From: foobar Date: Wed, 19 Jan 2005 00:27:42 +0000 Subject: [PATCH] MFH: Force ldapv3 for ldap_start_tls() --- ext/ldap/ldap.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/ext/ldap/ldap.c b/ext/ldap/ldap.c index 464baaa248..23d5a27320 100644 --- a/ext/ldap/ldap.c +++ b/ext/ldap/ldap.c @@ -2017,7 +2017,7 @@ PHP_FUNCTION(ldap_start_tls) { zval **link; ldap_linkdata *ld; - int rc; + int rc, protocol = LDAP_VERSION3; if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &link) == FAILURE) { WRONG_PARAM_COUNT; @@ -2025,7 +2025,9 @@ PHP_FUNCTION(ldap_start_tls) ZEND_FETCH_RESOURCE(ld, ldap_linkdata *, link, -1, "ldap link", le_link); - if ((rc = ldap_start_tls_s(ld->link, NULL, NULL)) != LDAP_SUCCESS) { + if (((rc = ldap_set_option(ld->link, LDAP_OPT_PROTOCOL_VERSION, &protocol)) != LDAP_SUCCESS) || + ((rc = ldap_start_tls_s(ld->link, NULL, NULL)) != LDAP_SUCCESS) + ) { php_error_docref(NULL TSRMLS_CC, E_WARNING,"Unable to start TLS: %s", ldap_err2string(rc)); RETURN_FALSE; } else { -- 2.40.0