Update src/Access/LDAPClient.cpp

Co-authored-by: Denis Glazachev <traceon@users.noreply.github.com>
This commit is contained in:
Vitaly Baranov 2022-01-14 19:17:14 +07:00 committed by GitHub
parent 7084099958
commit f818baf8f3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -306,10 +306,15 @@ bool LDAPClient::openConnection()
cred.bv_val = const_cast<char *>(params.password.c_str());
cred.bv_len = params.password.size();
int rc = ldap_sasl_bind_s(handle, final_bind_dn.c_str(), LDAP_SASL_SIMPLE, &cred, nullptr, nullptr, nullptr);
{
const auto rc = ldap_sasl_bind_s(handle, final_bind_dn.c_str(), LDAP_SASL_SIMPLE, &cred, nullptr, nullptr, nullptr);
// Handle invalid credentials gracefully.
if (rc == LDAP_INVALID_CREDENTIALS)
return false;
diag(rc);
}
// Once bound, run the user DN search query and update the default value, if asked.
if (params.user_dn_detection)