Dear all,
My stand alone script to query ldap server working fine, please find my
script below, but similar code of backends.py not working can anybody help
me whats going wrong in backends.py
import ldap
import sys
LDAP_ANAN_BIND_UID = 'CN=ldapquery,OU=Service Accounts,OU=Exception
Accounts,DC=na,DC=xxxxxxware,DC=com'
LDAP_ANON_BIND_PASSWD = '#########'
BASE_DN = 'DC=xxxxxxware,DC=com'
count = 0
try:
ldapo = ldap.initialize('ldap://nascmdc01.na.xxxxxxware.com:3268')
ldapo.set_option(ldap.OPT_REFERRALS, 0)
ldapo.set_option(ldap.OPT_PROTOCOL_VERSION, 3)
ldapo.simple_bind_s(LDAP_ANAN_BIND_UID, LDAP_ANON_BIND_PASSWD)
Filter = '(&(objectClass=*)(sAMAccountName=jackj))'
Attrs=['displayName']
r = ldapo.search(BASE_DN, ldap.SCOPE_SUBTREE, Filter, Attrs)
if not r:
print "User does not exist"
r = ldapo.search_s(BASE_DN, ldap.SCOPE_SUBTREE, Filter)
if len(password) == 0:
print "Empty password for user"
ldapo.bind_s(r[0][0], password)
user_info=r[0][0]
result_set = []
for entry in r:
value = entry[1]
for a in Attrs:
out = "%s: %s" % (a, value[a])
print out
result_set.append(out)
print result_set
except ldap.LDAPError, error_message:
print error_message
Code in backends.py
r = ldapo.search_s(BASE_DN, ldap.SCOPE_SUBTREE, Filter) ---->>>>
returns empty.
Thanks,
Jack
--
Want to help the Review Board project? Donate today at
http://www.reviewboard.org/donate/
Happy user? Let us know at http://www.reviewboard.org/users/
-~----------~----~----~----~------~----~------~--~---
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/reviewboard?hl=en