Skip to content
Snippets Groups Projects
Unverified Commit 18d2f68c authored by Ryan Senior's avatar Ryan Senior Committed by GitHub
Browse files

Merge pull request #7819 from wwwiiilll/fix-ldap-escape

Add missing LDAP special chars to escape function
parents 18a51f09 51bb5826
No related branches found
No related tags found
No related merge requests found
......@@ -98,7 +98,7 @@
(defn- escape-value
"Escapes a value for use in an LDAP filter expression."
[value]
(str/replace value #"[\*\(\)\\\\0]" (comp (partial format "\\%02X") int first)))
(str/replace value #"(?:^\s|\s$|[,\\\#\+<>;\"=\*\(\)\\0])" (comp (partial format "\\%02X") int first)))
(defn- get-connection
"Connects to LDAP with the currently set settings and returns the connection."
......
......@@ -15,8 +15,12 @@
;; See test_resources/ldap.ldif for fixtures
(expect
"\\2AJohn \\28Dude\\29 Doe\\5C"
(#'ldap/escape-value "*John (Dude) Doe\\"))
"\\20\\2AJohn \\28Dude\\29 Doe\\5C"
(#'ldap/escape-value " *John (Dude) Doe\\"))
(expect
"John\\2BSmith@metabase.com"
(#'ldap/escape-value "John+Smith@metabase.com"))
;; The connection test should pass with valid settings
(expect-with-ldap-server
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment