H
hotani
I am attempting to pull info from an LDAP server (Active Directory),
but cannot specify an OU. In other words, I need to search users in
all OU's, not a specific one.
Here is what works:
con = ldap.initialize("ldap://server.local")
con.simple_bind_s('user@domain', pass)
result = con.search_ext_s(
'OU=some office, DC=server, DC=local',
ldap.SCOPE_SUBTREE,
"sAMAccountName=username", ['mail']
)[0][1]
for i in result:
print "%s = %s" (i, result)
But i really need it to not require an OU. When I remove that part, it
breaks. Or it just won't find the user. Is there a proper syntax for
this that I'm missing? Maybe a different search function?
but cannot specify an OU. In other words, I need to search users in
all OU's, not a specific one.
Here is what works:
con = ldap.initialize("ldap://server.local")
con.simple_bind_s('user@domain', pass)
result = con.search_ext_s(
'OU=some office, DC=server, DC=local',
ldap.SCOPE_SUBTREE,
"sAMAccountName=username", ['mail']
)[0][1]
for i in result:
print "%s = %s" (i, result)
But i really need it to not require an OU. When I remove that part, it
breaks. Or it just won't find the user. Is there a proper syntax for
this that I'm missing? Maybe a different search function?