]> granicus.if.org Git - php/commitdiff
MFH: Force ldapv3 for ldap_start_tls()
authorfoobar <sniper@php.net>
Wed, 19 Jan 2005 00:27:42 +0000 (00:27 +0000)
committerfoobar <sniper@php.net>
Wed, 19 Jan 2005 00:27:42 +0000 (00:27 +0000)
ext/ldap/ldap.c

index 464baaa248c22601cced894946ad24af5d768924..23d5a27320b955774f1acd7a22d201418bf5b255 100644 (file)
@@ -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 {