mirror of
https://salsa.debian.org/freeipa-team/freeipa.git
synced 2025-01-28 09:06:44 -06:00
ldap: fix handling of binary data in search filters
This fixes a UnicodeDecodeError when passing non-UTF-8 binary data to LDAPClient.make_filter() and friends. https://fedorahosted.org/freeipa/ticket/5381 Reviewed-By: David Kupka <dkupka@redhat.com> Reviewed-By: Pavel Vomacka <pvomacka@redhat.com>
This commit is contained in:
parent
3edf13cd8a
commit
b484667d15
@ -1211,7 +1211,12 @@ class LDAPClient(object):
|
||||
]
|
||||
return self.combine_filters(flts, rules)
|
||||
elif value is not None:
|
||||
value = ldap.filter.escape_filter_chars(value_to_utf8(value))
|
||||
if isinstance(value, bytes):
|
||||
if six.PY3:
|
||||
value = value.decode('raw_unicode_escape')
|
||||
else:
|
||||
value = value_to_utf8(value)
|
||||
value = ldap.filter.escape_filter_chars(value)
|
||||
if not exact:
|
||||
template = '%s'
|
||||
if leading_wildcard:
|
||||
|
Loading…
Reference in New Issue
Block a user