Update LDAPClient.cpp

use escapeForFilter when assigning value to const final_search_filter
This commit is contained in:
IlyaTsoi 2022-01-13 21:33:04 +03:00 committed by GitHub
parent b3c4073aae
commit dea356e3db
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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<char *>(search_params.attribute.c_str()), nullptr };