Skip to content

Conversation

@lmctv
Copy link

@lmctv lmctv commented Jan 20, 2013

This is the first part of the changes I've tried to send yesterday.

I've undone the part which seemed more controversial even to myself,
in the hope these changes could get in with less friction...

This request is meant to replace both

#3
#4

Thank you,

     lorenzo

@anilj: with this pull request,the base dn in itself is templated; I'm not really sure about
adding the means to enable passing an arbitrary dictionary into Connector.authenticate() and
Connector.user_groups(). Some more details on your use-case?

lmctv added 6 commits January 21, 2013 14:07
To avoid useless activation of the context managers both in
Connector.ldap_login_query() and Connector.user_groups()
to correctly check exception from the first search too.
by setting a sizelimit on authentication searches.
The API has been preserved by refactoring the caching
and connection searching into a new _LDAPQuery.execute_cache
method that gets called in turn by _LDAPQuery.execute
by refactoring the _LDAPQuery class:

  - slightly refactor _LDAPQuery.execute by splitting it into
    a new method _LDAPQuery.execute_cache, which does the real work
    of searching and caching, and a replacement _LDAPQuery.execute
    which will skip the call to execute_cache when filter_tmpl
    is empty.

  - directly call _LDAPQuery.execute_cache after entering the
    user-bind self.manager.connection() context manager
This will avoid trivial DOS and ldap.FILTER_ERROR exceptions on
attempted logins by users sporting "funny" login names, like 'user*name'
or 'user(middle)name'.

This is a forward port of f3057446181106
to silence merge conflicts.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant