diff options
-rw-r--r-- | ext/ldap/ldap.c | 16 |
1 files changed, 15 insertions, 1 deletions
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 { |