Installing the latest version of Python-LDAP 2.3.x doesn't work. It requires OpenLDAP >= 2.3. Installing an old version of Python-LDAP using Python 2.5 against the OpenLDAP ~= 2.1 libraries available in Etch gave me no end of segfaults and weird issues and going back to Python 2.4 wasn't an option.
OpenLDAP 2.3 has been backported by the Debian security team, thankfully. Problem: they didn't create a development package. Solution: I grabbed the source package and fiddled with Python LDAP's setup.cfg. Put the source package somewhere and apply the Debian patch manually. Change the
[_ldap] section of Python-LDAP's setup.cfg to something like:
[_ldap] extra_objects = /usr/lib/libldap_r-2.3.so.0 /usr/lib/liblber-2.3.so.0 extra_compile_args = libs = sasl2 ssl crypto library_dirs = /usr/lib include_dirs = /root/openldap-2.3.30/include /usr/include/sasl
easy_install the directory and you're done! Not very Debian, but it works.