Re: cvs: php4 /ext/ldap ldap.c
| From: | derick@php.net | Date: | Wed, 26 Jun 2002 10:13:50 +0000 |
| Subject: | Re: cvs: php4 /ext/ldap ldap.c | ||
| References: | 1 2 3 | Groups: | php.cvs |
| Request: | Send a blank email to php-cvs+get-12546@lists.php.net to get a copy of this message | ||
On Wed, 26 Jun 2002 derick@php.net wrote:
> On Wed, 26 Jun 2002, Stig Venaas wrote:
>
> > 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.
This should work, all *_s functions (in this patch) return the LDAP error
code, from RFC 1328 (http://asg.web.cmu.edu/rfc/rfc1823.html):
ldap_add_s() is synchronous, returning the LDAP error code indicating the
outcome of the operation.
ldap_add() is asynchronous, returning the message id of the operation it
initiates, or -1 in case of trouble.
And from the url you specified:
All synchronous rou-
tines return an indication of the outcome of the operation (e.g, the
constant LDAP_SUCCESS or some other result code).
So, I think it's all ok :)
Derick
---------------------------------------------------------------------------
Did I help you? http://www.derickrethans.nl/link.php?url=giftlist
Frequent ranting: http://www.derickrethans.nl/
---------------------------------------------------------------------------
PHP: Scripting the Web - derick@php.net
All your branches are belong to me!
SRM: Script Running Machine - www.vl-srm.net
---------------------------------------------------------------------------