Browse Source

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)
PHP-4.0.5
Stig Venaas 26 years ago
parent
commit
094d01148a
  1. 16
      ext/ldap/ldap.c

16
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 {

Loading…
Cancel
Save