Skip to content
Snippets Groups Projects
Commit 51bb5826 authored by William Turner's avatar William Turner
Browse files

Add missing LDAP special chars to escape function

parent b476e013
Branches
Tags
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.
Please register or to comment