From a4bf8d12b05a6e9810e3b440b590daa9666beac3 Mon Sep 17 00:00:00 2001 From: Brian Weaver Date: Wed, 10 Jul 2019 14:21:40 -0400 Subject: [PATCH 1/3] Update the Filter Parser for Sec 2.4 RFC 4514 --- lib/net/ldap/filter.rb | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/lib/net/ldap/filter.rb b/lib/net/ldap/filter.rb index 6f064488..38bfebea 100644 --- a/lib/net/ldap/filter.rb +++ b/lib/net/ldap/filter.rb @@ -646,7 +646,7 @@ def match(entry) ## # Converts escaped characters (e.g., "\\28") to unescaped characters # @note slawson20170317: Don't attempt to unescape 16 byte binary data which we assume are objectGUIDs - # The binary form of 5936AE79-664F-44EA-BCCB-5C39399514C6 triggers a BINARY -> UTF-8 conversion error + # The binary form of 5936AE79-664F-44EA-BCCB-5C39399514C6 triggers a BINARY -> UTF-8 conversion error def unescape(right) right = right.to_s if right.length == 16 && right.encoding == Encoding::BINARY @@ -759,10 +759,15 @@ 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]|\x5C(?:[\x20-\x23]|[\x2B\x2C]|[\x3B-\x3E]|\x5C)|\\[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. + # + # 20190710 CmdrClueless + # RFC-4514, Section 2.4 adds to the scanner regex above + # \x5C(?:[\x20-\x23]|[\x2B\x2C]|[\x3B-\x3E]|\x5C) + # This is commonly done by ActiveDirectory, with a DN such as CN=#Supers,CN=Users,DC=test,DC=com value.strip! case op when "=" From 019f2aa3d8dc9c866eebb4f03faaa4fd8faf08b2 Mon Sep 17 00:00:00 2001 From: Brian Weaver Date: Wed, 10 Jul 2019 16:39:32 -0400 Subject: [PATCH 2/3] Change the version to reflect that it's not stock --- lib/net/ldap/version.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/net/ldap/version.rb b/lib/net/ldap/version.rb index 0a57d621..784dfea6 100644 --- a/lib/net/ldap/version.rb +++ b/lib/net/ldap/version.rb @@ -1,5 +1,5 @@ module Net class LDAP - VERSION = "0.16.1" + VERSION = "0.16.1-sunbirddcim.1" end end From 49445746af5e05afcd364e935881e3b126bf0517 Mon Sep 17 00:00:00 2001 From: Brian Weaver Date: Wed, 10 Jul 2019 16:48:39 -0400 Subject: [PATCH 3/3] Revert "Change the version to reflect that it's not stock" This reverts commit 019f2aa3d8dc9c866eebb4f03faaa4fd8faf08b2. --- lib/net/ldap/version.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/net/ldap/version.rb b/lib/net/ldap/version.rb index 784dfea6..0a57d621 100644 --- a/lib/net/ldap/version.rb +++ b/lib/net/ldap/version.rb @@ -1,5 +1,5 @@ module Net class LDAP - VERSION = "0.16.1-sunbirddcim.1" + VERSION = "0.16.1" end end