From cd866c0109bf21b4087d418a31ba9f338a3d739d Mon Sep 17 00:00:00 2001 From: Kaspar Schiess Date: Fri, 8 Oct 2010 16:41:02 +0200 Subject: [PATCH] + Patch from Sean Cashin that fixes filter behaviour Filters would not accept apostrophes, now they do. Thanks Sean Cashin (http://github.com/scashin133)! --- lib/net/ldap/filter.rb | 2 +- spec/unit/ldap/filter_spec.rb | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/lib/net/ldap/filter.rb b/lib/net/ldap/filter.rb index fd50cf0..8eec9f0 100644 --- a/lib/net/ldap/filter.rb +++ b/lib/net/ldap/filter.rb @@ -694,7 +694,7 @@ class Net::LDAP::Filter scanner.scan(/\s*/) if op = scanner.scan(/<=|>=|!=|:=|=/) scanner.scan(/\s*/) - if value = scanner.scan(/(?:[-\w*.+@=,#\$%&!\s]|\\[a-fA-F\d]{2})+/) + if value = scanner.scan(/(?:[-\w*.+@=,#\$%&!'\s]|\\[a-fA-F\d]{2})+/) # 20100313 AZ: Assumes that "(uid=george*)" is the same as # "(uid=george* )". The standard doesn't specify, but I can find # no examples that suggest otherwise. diff --git a/spec/unit/ldap/filter_spec.rb b/spec/unit/ldap/filter_spec.rb index 9585ff0..fac0c28 100644 --- a/spec/unit/ldap/filter_spec.rb +++ b/spec/unit/ldap/filter_spec.rb @@ -44,5 +44,10 @@ describe Net::LDAP::Filter do end end end + describe "<- .construct" do + it "should accept apostrophes in filters (regression)" do + Net::LDAP::Filter.construct("uid=O'Keefe").to_rfc2254.should == "(uid=O'Keefe)" + end + end end \ No newline at end of file