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('[EMAIL PROTECTED]', 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[i])

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?
--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to