diff options
author | Jenkins <jenkins@review.openstack.org> | 2013-02-19 13:15:11 +0000 |
---|---|---|
committer | Gerrit Code Review <review@openstack.org> | 2013-02-19 13:15:11 +0000 |
commit | 9ec12e2e54e3cca84fda0fcc63a849eebcaafe96 (patch) | |
tree | 5d3b460e5939605014a5b9ebac8871901371efa4 /keystone/common | |
parent | b9d8a20fff3518d3027cb95d37c1b9a13a6dea32 (diff) | |
parent | 63f6e87c5e267a015f4d6054c0941c0efc8526f1 (diff) | |
download | keystone-9ec12e2e54e3cca84fda0fcc63a849eebcaafe96.tar.gz keystone-9ec12e2e54e3cca84fda0fcc63a849eebcaafe96.tar.xz keystone-9ec12e2e54e3cca84fda0fcc63a849eebcaafe96.zip |
Merge "make fakeldap._match_query work for an arbitrary number of groups"
Diffstat (limited to 'keystone/common')
-rw-r--r-- | keystone/common/ldap/fakeldap.py | 8 |
1 files changed, 2 insertions, 6 deletions
diff --git a/keystone/common/ldap/fakeldap.py b/keystone/common/ldap/fakeldap.py index 43490bef..f38ad43c 100644 --- a/keystone/common/ldap/fakeldap.py +++ b/keystone/common/ldap/fakeldap.py @@ -47,18 +47,14 @@ def _match_query(query, attrs): """Match an ldap query to an attribute dictionary. The characters &, |, and ! are supported in the query. No syntax checking - is performed, so malformed querys will not work correctly. + is performed, so malformed queries will not work correctly. """ # cut off the parentheses inner = query[1:-1] if inner.startswith(('&', '|')): # cut off the & or | groups = _paren_groups(inner[1:]) - try: - l, r = groups - return _match_query(l, attrs) and _match_query(r, attrs) - except ValueError: # just one group - return _match_query(groups[0], attrs) + return all(_match_query(group, attrs) for group in groups) if inner.startswith('!'): # cut off the ! and the nested parentheses return not _match_query(query[2:-1], attrs) |