From dea356e3dba68d89e71fba971d8e82f3eaa62552 Mon Sep 17 00:00:00 2001 From: IlyaTsoi <45252974+IlyaTsoi@users.noreply.github.com> Date: Thu, 13 Jan 2022 21:33:04 +0300 Subject: [PATCH] Update LDAPClient.cpp use escapeForFilter when assigning value to const final_search_filter --- src/Access/LDAPClient.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/Access/LDAPClient.cpp b/src/Access/LDAPClient.cpp index 6950253f0bd..d6aa1e76ddc 100644 --- a/src/Access/LDAPClient.cpp +++ b/src/Access/LDAPClient.cpp @@ -352,7 +352,7 @@ void LDAPClient::openConnection() if (user_dn_search_results.size() > 1) throw Exception("Failed to detect user DN: more than one entry in the search results", ErrorCodes::LDAP_ERROR); - final_user_dn = escapeForFilter(*user_dn_search_results.begin()); + final_user_dn = *user_dn_search_results.begin(); } break; @@ -399,10 +399,10 @@ LDAPClient::SearchResults LDAPClient::search(const SearchParams & search_params) }); const auto final_search_filter = replacePlaceholders(search_params.search_filter, { - {"{user_name}", final_user_name}, - {"{bind_dn}", final_bind_dn}, - {"{user_dn}", final_user_dn}, - {"{base_dn}", final_base_dn} + {"{user_name}", escapeForFilter(final_user_name)}, + {"{bind_dn}", escapeForFilter(final_bind_dn)}, + {"{user_dn}", escapeForFilter(final_user_dn)}, + {"{base_dn}", escapeForFilter(final_base_dn)} }); char * attrs[] = { const_cast(search_params.attribute.c_str()), nullptr };