fix(Listener): skip auth when requirepass is empty on http (#1985)

* Fix a small bug on http when username was required even if requirepass was empty
This commit is contained in:
Kostas Kyrimis 2023-10-03 19:56:19 +03:00 committed by GitHub
parent e15900fd94
commit 8b7a43d214
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 18 additions and 1 deletions

View file

@ -2075,7 +2075,9 @@ GlobalState Service::GetGlobalState() const {
void Service::ConfigureHttpHandlers(util::HttpListenerBase* base, bool is_privileged) {
// We skip authentication on privileged listener if the flag admin_nopass is set
const bool should_skip_auth = is_privileged && !RequirePrivilegedAuth();
// We also skip authentication if requirepass is empty
const bool should_skip_auth =
(is_privileged && !RequirePrivilegedAuth()) || GetPassword().empty();
if (!should_skip_auth) {
base->SetAuthFunctor([pass = GetPassword()](std::string_view path, std::string_view username,
std::string_view password) {