From 822b70f6c18167903f9fb927e0f7d469d09bfc25 Mon Sep 17 00:00:00 2001 From: jwedoff Date: Thu, 7 Nov 2024 11:55:24 -0500 Subject: [PATCH] fix filter to parse various valid query character values properly --- lib/net/ldap/filter.rb | 2 +- lib/net/ldap/version.rb | 2 +- net-ldap.gemspec | 5 +++-- test/test_filter_parser.rb | 24 ++++++++++++++++++++++++ 4 files changed, 29 insertions(+), 4 deletions(-) diff --git a/lib/net/ldap/filter.rb b/lib/net/ldap/filter.rb index dc0d0ab3..e34221a9 100644 --- a/lib/net/ldap/filter.rb +++ b/lib/net/ldap/filter.rb @@ -759,7 +759,7 @@ def parse_filter_branch(scanner) scanner.scan(/\s*/) if op = scanner.scan(/<=|>=|!=|:=|=/) scanner.scan(/\s*/) - if value = scanner.scan(/(?:[-\[\]{}\w*.+\/:@=,#\$%&!'^~\s\xC3\x80-\xCA\xAF]|[^\x00-\x7F]|\\[a-fA-F\d]{2})+/u) + if value = scanner.scan(/(?:[-\[\]{}\w*.+\/:@=,#$%&!'^~;<>?"`|\s\xC3\x80-\xCA\xAF]|[^\x00-\x7F]|\\[a-fA-F\d]{2})+/u) # 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/lib/net/ldap/version.rb b/lib/net/ldap/version.rb index db251bda..3688d849 100644 --- a/lib/net/ldap/version.rb +++ b/lib/net/ldap/version.rb @@ -1,5 +1,5 @@ module Net class LDAP - VERSION = "0.19.0.1.akajw" + VERSION = "0.19.0.2.akajw" end end diff --git a/net-ldap.gemspec b/net-ldap.gemspec index a5e53b88..c21dd7cc 100644 --- a/net-ldap.gemspec +++ b/net-ldap.gemspec @@ -28,10 +28,11 @@ the most recent LDAP RFCs (4510-4519, plutions of 4520-4532).} s.require_paths = ["lib"] s.required_ruby_version = ">= 2.0.0" s.summary = %q{Net::LDAP for Ruby (also called net-ldap) implements client access for the Lightweight Directory Access Protocol (LDAP), an IETF standard protocol for accessing distributed directory services} - + s.metadata["allowed_push_host"] = "https://geminabox.gcds.akamai.com" + s.add_development_dependency("flexmock", "~> 1.3") s.add_development_dependency("rake", "~> 12.3.3") s.add_development_dependency("rubocop", "~> 1.48") s.add_development_dependency("test-unit", "~> 3.3") - s.add_development_dependency("byebug", "~> 9.0.6") unless RUBY_PLATFORM == "java" + s.add_development_dependency("byebug", "~> 11.1.3") unless RUBY_PLATFORM == "java" end diff --git a/test/test_filter_parser.rb b/test/test_filter_parser.rb index 960ff1ad..8119b09b 100644 --- a/test/test_filter_parser.rb +++ b/test/test_filter_parser.rb @@ -26,4 +26,28 @@ def test_colons def test_attr_tag assert_kind_of Net::LDAP::Filter, Net::LDAP::Filter::FilterParser.parse("(mail;primary=jane@example.org)") end + + def test_semicolon_value + assert_kind_of Net::LDAP::Filter, Net::LDAP::Filter::FilterParser.parse("(mail;primary=jane@example.org;bar)") + end + + def test_gele_value + assert_kind_of Net::LDAP::Filter, Net::LDAP::Filter::FilterParser.parse("(mail;primary=jane@example.org)") + end + + def test_question_value + assert_kind_of Net::LDAP::Filter, Net::LDAP::Filter::FilterParser.parse("(mail;primary=jane@example.org?bar)") + end + + def test_backtick_value + assert_kind_of Net::LDAP::Filter, Net::LDAP::Filter::FilterParser.parse("(mail;primary=jane@example.org`bar)") + end + + def test_pipe_value + assert_kind_of Net::LDAP::Filter, Net::LDAP::Filter::FilterParser.parse("(mail;primary=jane@example.org|bar)") + end + + def test_dollar_value + assert_kind_of Net::LDAP::Filter, Net::LDAP::Filter::FilterParser.parse("(mail;primary=jane@example.org$bar)") + end end