OpenLDAP 2.0 and PHP, things need be done

From: Date: Fri, 25 Aug 2000 14:03:50 +0000
Subject: OpenLDAP 2.0 and PHP, things need be done
Groups: php.dev 
Request: Send a blank email to php-dev+get-30644@lists.php.net to get a copy of this message
I just tried to use PHP with OpenLDAP 2.0 gamma. 2.0 will be released RSN so we should make sure 4.0.3 will work with it. Actually we should perhaps do it for 4.0.2 since 4.0.3 will be out after the official release of gamma. The problem I've found so far is error reporting. Here is some typical code from ldap.c: #if !HAVE_NSLDAP #if LDAP_API_VERSION > 2000 /* New versions of OpenLDAP do it this way */ php_error(E_WARNING,"LDAP: Unable to bind to server: %s",ldap_err2string(ldap_get_lderrno(ldap,NULL,NULL))); #else php_error(E_WARNING,"LDAP: Unable to bind to server: %s",ldap_err2string(ldap->ld_errno)); #endif #endif ldap_get_lderrno seems not to exist any longer, and is neither in the spec. From the spec, it seems to me that in order to get the errno we need to do something like: /* New versions of OpenLDAP do it this way */ LDAPMessage *result; int err; char *matcheddn = NULL; char *text = NULL; char **refs = NULL; LDAPControl **ctrls = NULL; ldap_parse_result(ldap, result, &err, &matcheddn, &text, &refs, &ctrls, 1); to get the error into err. Anyone know an easier way? BTW, the old code for OpenLDAP works for NSLDAP I think, anyone know for sure? We should have some error handling for NSLDAP too, right? Do we dare try to fix any of this for 4.0.2? I can try to come up with a patch today if we dare. I can test that it works with OpenLDAP, what bothers me a bit is that the new code might break some other SDKs that I can't test. Stig

« previous php.dev (#30644) next »