From 089abcceb24cb9315e9edcdfbff397add7062f7b Mon Sep 17 00:00:00 2001 From: blackhedd Date: Sat, 11 Aug 2007 01:26:06 +0000 Subject: [PATCH] Applied patch from Kouhei Sutou --- lib/net/ldap/filter.rb | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) 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