Skip to content

Commit cd866c0

Browse files
committed
+ Patch from Sean Cashin that fixes filter behaviour
Filters would not accept apostrophes, now they do. Thanks Sean Cashin (http://github.com/scashin133)!
1 parent 7143490 commit cd866c0

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

lib/net/ldap/filter.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -694,7 +694,7 @@ def parse_filter_branch(scanner)
694694
scanner.scan(/\s*/)
695695
if op = scanner.scan(/<=|>=|!=|:=|=/)
696696
scanner.scan(/\s*/)
697-
if value = scanner.scan(/(?:[-\w*.+@=,#\$%&!\s]|\\[a-fA-F\d]{2})+/)
697+
if value = scanner.scan(/(?:[-\w*.+@=,#\$%&!'\s]|\\[a-fA-F\d]{2})+/)
698698
# 20100313 AZ: Assumes that "(uid=george*)" is the same as
699699
# "(uid=george* )". The standard doesn't specify, but I can find
700700
# no examples that suggest otherwise.

spec/unit/ldap/filter_spec.rb

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,5 +44,10 @@
4444
end
4545
end
4646
end
47+
describe "<- .construct" do
48+
it "should accept apostrophes in filters (regression)" do
49+
Net::LDAP::Filter.construct("uid=O'Keefe").to_rfc2254.should == "(uid=O'Keefe)"
50+
end
51+
end
4752

4853
end

0 commit comments

Comments
 (0)