Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- LDAP_URL = "ldap://ldap-server.my-company.com"
- USER = "ldap-user"
- PASSWORD = "ldap-password"
- conn = ldap.initialize(LDAP_URL)
- conn.simple_bind_s(USER, PASSWORD)
- # the base_dn where you want to start the search, play with different params here
- base_dn = "OU=Users,DC=corp,DC=<your-company>,DC=com"
- # search for the user with this attribute. Do a search for some user with this and then
- # looking at the output, you can add a more complex search with all the other
- # attributes that you see there.
- search_dn = "(sAMAccountName=user-id)"
- conn.search_s(base_dn, ldap.SCOPE_SUBTREE, search_dn)
Add Comment
Please, Sign In to add comment