Re: cvs: php4 /ext/ldap ldap.c
| From: | Stig Venaas | Date: | Wed, 26 Jun 2002 07:55:46 +0000 |
| Subject: | Re: cvs: php4 /ext/ldap ldap.c | ||
| References: | 1 | Groups: | php.cvs |
| Request: | Send a blank email to php-cvs+get-12537@lists.php.net to get a copy of this message | ||
Thanks for doing this. I've spotted at least one problem though.
On Wed, Jun 26, 2002 at 06:49:25AM -0000, Derick Rethans wrote:
> - if (ldap_bind_s(ld->link, ldap_bind_rdn, ldap_bind_pw, LDAP_AUTH_SIMPLE) != LDAP_SUCCESS)
> {
> - php_error(E_WARNING, "LDAP: Unable to bind to server: %s",
> ldap_err2string(_get_lderrno(ld->link)));
> + if ((rc = ldap_bind_s(ld->link, ldap_bind_rdn, ldap_bind_pw, LDAP_AUTH_SIMPLE)) !=
> LDAP_SUCCESS) {
> + php_error(E_WARNING, "%s(): Unable to bind to server: %s",
> get_active_function_name(TSRMLS_C), ldap_err2string(rc));
> RETURN_FALSE;
> } else {
> RETURN_TRUE;
This doesn't work. ldap_bind_s() returns -1 on error, not the error code.
So you need to use _get_lderrno() to get the error code. The LDAP API
isn't consistent in this respect. If you have done the same other places,
please check the spec first. I suggest you look at
draft-ietf-ldapext-ldap-c-api-05.txt. Look for it in the OpenLDAP 2.x
tarball (or you could get it from ftp.venaas.no/pub/internet-drafts)
or some other places.
Stig