Stripped LDAPObject.c

Michael Ströder michael at
Sat Dec 22 15:01:38 CET 2001

David Leonard wrote:
> i note you left in simple_bind_s() probably because from my reading of
> the openldap source code, it shows that some complicated things happen at
> the end of it that don't happen in simple_bind() ... i had a quick
> skim and couldn't see the others doing much more ...

I glanced over ldap_simple_bind_s() of
openldap-HEAD/ldap/libraries/libldap/sbind.c. It just looks like a
simple wrapper around ldap_sasl_bind_s() (see below). Hmm, we could
do the same in ldapobject.c once ldap_sasl_bind() is wrapped.

I'm also very much in favour of looking into how to use OpenLDAP 2's
libldap_r to check if we could build a thread-safe python-ldap C
wrapper. A global thread lock is sometimes annoying (e.g. if takes very long). Anyone willing to do
this? Another advantage of a very short LDAPObject.c is that these
kind of jobs get easier.

Ciao, Michael.

-------------------------------- snip
ldap_simple_bind_s( LDAP *ld, LDAP_CONST char *dn, LDAP_CONST char
*passwd )
	struct berval cred;

	Debug( LDAP_DEBUG_TRACE, "ldap_simple_bind_s\n", 0, 0, 0 );

	if ( passwd != NULL ) {
		cred.bv_val = (char *) passwd;
		cred.bv_len = strlen( passwd );
	} else {
		cred.bv_val = "";
		cred.bv_len = 0;

	return ldap_sasl_bind_s( ld, dn, LDAP_SASL_SIMPLE, &cred,
-------------------------------- snip

More information about the python-ldap mailing list