API: Ensure that empty passwords w/ client_cn are properly checked

fixes #11482
This commit is contained in:
Michael Friedrich 2016-04-04 16:38:47 +02:00 committed by Gunnar Beutner
parent 909845c456
commit 5910f2e310

View File

@ -144,12 +144,16 @@ void HttpServerConnection::ProcessMessageAsync(HttpRequest& request)
ApiUser::Ptr user;
/* client_cn matched. */
if (m_ApiUser)
user = m_ApiUser;
else {
user = ApiUser::GetByName(username);
if (user && user->GetPassword() != password)
/* Deny authentication if 1) given password is empty 2) configured password does not match. */
if (password.IsEmpty())
user.reset();
else if (user && user->GetPassword() != password)
user.reset();
}