Pull requests

#5 Merged
Repository
Deleted repository
Branch
mockldap (df2388b6a79b)
Repository
psagers/django-auth-ldap django-auth-ldap
Branch
default

Additions to MockLDAP

Author
  1. Theo Chatzimichos
Reviewers
Description

Add unbind function Extend _search_s to support all SCOPE levels and filterstrings in form of (attr=value)

Comments (5)

    1. Theo Chatzimichos author

      and thank you for the approval! I think the regexp is too restrictive, but it covers my case so far, I'll extend it in the future in case I need more functionality. One additional question, I saw that python-ldap returns an empty list in case there are no results found, while MockLDAP raises NO_SUCH_OBJECT excpetion. Is there any reason this is happening or is it a bug?

  1. Peter Sagerson repo owner

    They're not deliberately different. I must have observed python-ldap raising the exception in some circumstance and mimicked it. Perhaps the behavior varies depending on the type of query. Might be worth investigating.

    1. Theo Chatzimichos author

      I did some investigation today:

      search_s('ou=nonexistent,dc=example,dc=org', ldap.SCOPE_ONELEVEL) # returns ldap.NO_SUCH_OBJECT
      search_s('ou=users,dc=example,dc=org', ldap.SCOPE_ONELEVEL, '(mail=nonexistent@example.com)') # returns empty list
      search_s('ou=users,dc=example,dc=org', ldap.SCOPE_ONELEVEL, '(mail=existent@example.com)', ['nonexistent']) # returns empty list
      search_s('ou=users,dc=example,dc=org', ldap.SCOPE_ONELEVEL, '(mail=nonexistent@example.com)', ['existent']) # returns empty list
      search_s('ou=users,dc=example,dc=org', ldap.SCOPE_ONELEVEL, '(mail=nonexistent@example.com)', ['nonexistent']) # returns empty list