Applied patch from Kouhei Sutou

This commit is contained in:
blackhedd 2007-08-11 01:26:06 +00:00
parent e429d7034b
commit 089abcceb2

View file

@ -208,12 +208,12 @@ class Filter
end end
[@left.to_s.to_ber, seq.to_ber].to_ber_contextspecific 4 [@left.to_s.to_ber, seq.to_ber].to_ber_contextspecific 4
else #equality 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 end
when :ge 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 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 when :and
ary = [@left.coalesce(:and), @right.coalesce(:and)].flatten ary = [@left.coalesce(:and), @right.coalesce(:and)].flatten
ary.map {|a| a.to_ber}.to_ber_contextspecific( 0 ) ary.map {|a| a.to_ber}.to_ber_contextspecific( 0 )
@ -229,6 +229,12 @@ class Filter
end end
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 # 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 # object. The incoming BER object most likely came to us by parsing an