From 094d01148ab20f4063fb75fbbef51edd164ae1d7 Mon Sep 17 00:00:00 2001 From: Stig Venaas Date: Fri, 20 Oct 2000 20:22:59 +0000 Subject: [PATCH] Made ldap_connect() accept URL in host parameter when using OpenLDAP 2.x. @- Made ldap_connect() accept URL in host parameter when using OpenLDAP @ 2.x. To use SSL, use ldaps://host/ as URL. (Stig Venaas) --- ext/ldap/ldap.c | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/ext/ldap/ldap.c b/ext/ldap/ldap.c index a6ae69b14b..a74331d44d 100644 --- a/ext/ldap/ldap.c +++ b/ext/ldap/ldap.c @@ -357,7 +357,21 @@ PHP_FUNCTION(ldap_connect) RETURN_FALSE; } - ldap = ldap_open(host,port); +#ifdef LDAP_API_FEATURE_X_OPENLDAP + if (strchr(host, '/')) { + int rc; + + rc = ldap_initialize(&ldap, host); + if (rc != LDAP_SUCCESS) { + php_error(E_WARNING, "Could not create LDAP session handle (%d): %s\n", rc, ldap_err2string(rc)); + RETURN_FALSE; + } + } else +#endif + { + ldap = ldap_open(host,port); + } + if ( ldap == NULL ) { RETURN_FALSE; } else { -- 2.50.1