I want to connect to a ldap server with python-ldap using a specific baseDN.
import ldap
baseDN="ou=unit,o=org.c=xx" # doesn't work
#baseDN="" # works
host="ldaps://test.org.xx:636"
userDN="cn=proxyhlrb,ou=services,o=org,c=xx"
passwd="secret"
server=ldap.initialize(host+"/"+baseDN)
server.bind_s(userDN,passwd,ldap.AUTH_SIMPLE)
What is wrong here? According to the documentation the argument of ldap.initialize must be a valid LDAP URL according to RFC4516 and therefore using a host+baseDN should work. Is there another开发者_如何转开发 way to specify a baseDN in python-ldap?
I think this resource would be interesting for you. It nicely explains how to combine LDAP with Python.
http://www.packtpub.com/article/python-ldap-applications-ldap-opearations
Edit: is the port you are using correct? In PHP, developers mainly use port 389 for LDAP connects, bindings and queries.
精彩评论