#59 LDAPObject.search_ext_s may return (None, ...) instead of DN

closed
None
5
2012-05-12
2012-04-19
No

The following code:

import ldap
conn = ldap.initialize(settings.AD_LDAP_URL)
# Disable referrals for AD: http://www.python-ldap.org/faq.shtml
conn.set_option(ldap.OPT_REFERRALS, 0)
binddn = "%s@%s" % (username, settings.AD_NT4_DOMAIN)
conn.simple_bind_s(binddn, password)
from django.conf import settings
results = conn.search_ext_s(settings.AD_SEARCH_DN, ldap.SCOPE_SUBTREE,
"objectClass=user", settings.AD_SEARCH_FIELDS)
conn.unbind_s()
print ("%s" % str(results[244]))

outputs:

(None, ['ldap://ForestDnsZones.ata.local/DC=ForestDnsZones,DC=ata,DC=local'])

I'm guessing this is a referral that wasn't chased because I turned off OPT_REFERRALS? If so, maybe this could be documented in the FAQ? If not, what is it?

Discussion

  • Michael Ströder

    It's a search continuation generated by a referral and it works as designed => no bug => closed

    Please ask usage questions on the python-ldap@python.org mailing list.

     
  • Michael Ströder

    • assigned_to: nobody --> stroeder
    • status: open --> closed
     

Log in to post a comment.