mirror of
https://github.com/valitydev/salt.git
synced 2024-11-07 08:58:59 +00:00
Merge pull request #23477 from galet/ldap-filter-escaping
LDAP auth: Escape filter value for group membership search
This commit is contained in:
commit
e0b2a73eb4
@ -269,8 +269,9 @@ def groups(username, **kwargs):
|
||||
log.error('Could not get distinguished name for user {0}'.format(username))
|
||||
return group_list
|
||||
# LDAP results are always tuples. First entry in the tuple is the DN
|
||||
dn = user_dn_results[0][0]
|
||||
dn = ldap.filter.escape_filter_chars(user_dn_results[0][0])
|
||||
ldap_search_string = '(&(member={0})(objectClass={1}))'.format(dn, _config('groupclass'))
|
||||
log.debug('Running LDAP group membership search: {0}'.format(ldap_search_string))
|
||||
try:
|
||||
search_results = bind.search_s(_config('basedn'),
|
||||
ldap.SCOPE_SUBTREE,
|
||||
|
Loading…
Reference in New Issue
Block a user