ldapsearch vs. python-ldap

Michael Ströder michael at stroeder.com
Sat Apr 11 14:31:02 CEST 2009


You might also have hit the problem with automatic referral chasing
within libldap as anonymous.

Try this to switch that off:

l = ldap.initialize('ldap://<host>:389')
l.set_option(ldap.OPT_REFERRALS,0)

> try:
> 	#l.simple_bind_s('first.last at example.com', getpass.getpass())
> l.simple_bind_s('<place>\<shortname>', getpass.getpass())			# Works
> 
> except Exception, e:

You should rather catch ldap.LDAPError here.

Ciao, Michael.



More information about the python-ldap mailing list