diff --git a/lib/net/ldap/filter.rb b/lib/net/ldap/filter.rb index b323762..fc4b090 100644 --- a/lib/net/ldap/filter.rb +++ b/lib/net/ldap/filter.rb @@ -208,12 +208,12 @@ class Filter end [@left.to_s.to_ber, seq.to_ber].to_ber_contextspecific 4 else #equality - [@left.to_s.to_ber, @right.to_ber].to_ber_contextspecific 3 + [@left.to_s.to_ber, unescape(@right).to_ber].to_ber_contextspecific 3 end when :ge - [@left.to_s.to_ber, @right.to_ber].to_ber_contextspecific 5 + [@left.to_s.to_ber, unescape(@right).to_ber].to_ber_contextspecific 5 when :le - [@left.to_s.to_ber, @right.to_ber].to_ber_contextspecific 6 + [@left.to_s.to_ber, unescape(@right).to_ber].to_ber_contextspecific 6 when :and ary = [@left.coalesce(:and), @right.coalesce(:and)].flatten ary.map {|a| a.to_ber}.to_ber_contextspecific( 0 ) @@ -229,6 +229,12 @@ class Filter end end + def unescape(right) + right.gsub(/\\([a-fA-F\d]{2,2})/) do + [$1.hex].pack("U") + end + end + # Converts an LDAP search filter in BER format to an Net::LDAP::Filter # object. The incoming BER object most likely came to us by parsing an