Unescape escaped filter characters in #to_ber #55
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
When searching for attribute values that contain asterisks or backslashes, the search results are empty when they should not be.
For example I have an Active Directory group with
cnvalue ofspecial*group. A search with filterNet::LDAP::Filter.begins(:cn, "special*g")should find this group, but doesn't.I compared Wireshark captures of this query with one using the
ldapsearchcommand line tool. The bytes sent on the wire byldapsearch ... '(cn=special\2Ag*)', have a single0x2abyte (the hex value of the asterisk character) betweenspecialandg, whereas the net-ldap gem sends three bytes, one for\, one for2, and one forA.This pull request uses the
unescapemethod to make the net-ldap gem behave likeldapsearch, and causes my search to return the expected results. However, I wonder if the net-ldap gem doesn't already work this way to prevent existing client code from breaking due to unexpected unescaping. If so, what workaround would solve my problem?When the
unescapemethod was introduced, the#to_bermethod was updated to useunescapein some places. This pull request updates#to_berto useunescapea few more times. I'm curious if there is a reason the previous commit decided not to useunescapewhere this pull request adds it.