devpi / devpi-ldap

Plugin for devpi-server which provides LDAP authentication.
36 stars 20 forks source link

Support user_search on LADP servers which do not include an explicit dn in returned attributes. #18

Closed kainz closed 9 years ago

kainz commented 9 years ago

Implement a fallback in user_search which will use a toplevel response attribute instead of object attributes if you are searching on 'dn' or 'distinguishedName' and those do not appear within a returned ldap object.

This happens in our site using redhat directory service, and may be useful for others.

fschulze commented 9 years ago

It seems this addresses the same issue as #5, right? Could you try to add a test?

kainz commented 9 years ago

@fschulze Yep, this does address #5.

I've attached a test for you, but it doesn't really test the code at that spot in devpi_ldap/main.py, because your mocking design mocks out actually running the _search(), so that piece of code doesn't really have any test coverage, anyway.