Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Applied patch from Kouhei Sutou

  • Loading branch information...
commit 089abcceb24cb9315e9edcdfbff397add7062f7b 1 parent e429d70
blackhedd authored
Showing with 9 additions and 3 deletions.
  1. +9 −3 lib/net/ldap/filter.rb
View
12 lib/net/ldap/filter.rb
@@ -208,12 +208,12 @@ def to_ber
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 @@ def to_ber
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
Please sign in to comment.
Something went wrong with that request. Please try again.