You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am performing a fairly straightforward search for f"(cn={name})", where name is John (Jim) Doe.
When I make the request as follows, it works:
ldapsearch ... -s sub "cn=Joe \\\28Jim\\\29 Doe"
Using ngrep, I can see that it sends the following (which is the correct LDAP encoding of parentheses):
...........�...cn..Joe \28Jim\29 Doe0.
However, when I use the .search(..., f"(cn={name})") query, it actually fails with the error message ldap3.core.exceptions.LDAPInvalidFilterError: malformed filter.
If I use name = escape_filter_chars(name), the LDAP server returns the following error:
I am performing a fairly straightforward search for
f"(cn={name})"
, wherename
isJohn (Jim) Doe
.When I make the request as follows, it works:
Using
ngrep
, I can see that it sends the following (which is the correct LDAP encoding of parentheses):However, when I use the
.search(..., f"(cn={name})")
query, it actually fails with the error messageldap3.core.exceptions.LDAPInvalidFilterError: malformed filter
.If I use
name = escape_filter_chars(name)
, the LDAP server returns the following error:Using
ngrep
, I can see that the query is as follows (which is not correctly encoded for LDAP).If I use the ridiculous
name = escape_filter_chars(escape_filter_chars(name))
, then it finally works:It seems that the escaped data is being unescaped at some point before it is sent.
The text was updated successfully, but these errors were encountered: