Hi Everyone,

I am trying to query an AD Domain Controller for some information, and i'd
like to do this without having to install the win32 and AD libraries for
Python.

I am using the following code to obtain a list of users inside a group
(test). This works well, but i'd like to be able to add groups that contain
users into the "test" group, and return them too. If I do this, the code
below returns nothing at all - not even the names of the groups in the test
group. Can anyone advise me how to do this?

--

import ldap
ldap.set_option(ldap.OPT_REFERRALS, 0)

l = ldap.initialize("ldap://10.3.x.x";)
l.simple_bind_s('[EMAIL PROTECTED]', 'xxx')

baseDN = "OU=Location, DC=xxx, DC=local"
searchScope = ldap.SCOPE_SUBTREE
retrieveAttributes = ['sn'] # Surename
searchFilter = "(memberOf=CN=test,OU=Machines,OU=Linux
Auth,DC=xxx,DC=local)"

try:
  ldap_result_id = l.search(baseDN, searchScope, searchFilter,
retrieveAttributes)
  result_set = []
  while 1:
    result_type, result_data = l.result(ldap_result_id, 0)
    if (result_data == []):
      break
    else:
      if result_type == ldap.RES_SEARCH_ENTRY:
        print result_set
except ldap.LDAPError, e:
        print e

--

Any help gratefully received.

Many thanks for your time!

Alex
-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Python-LDAP-dev mailing list
Python-LDAP-dev@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/python-ldap-dev

Reply via email to