From 3f9ee1c444ef8e1e695e5f3f9633f2f5a4761419 Mon Sep 17 00:00:00 2001 From: WolverinDEV Date: Wed, 11 Mar 2020 10:33:39 +0100 Subject: [PATCH] Fixed the query account password change parameter --- server/main.cpp | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/server/main.cpp b/server/main.cpp index 75fb9ce..df3fef7 100644 --- a/server/main.cpp +++ b/server/main.cpp @@ -371,18 +371,13 @@ int main(int argc, char** argv) { auto password = arguments.cmdOptionExists("-q") ? arguments.get_option("-q") : arguments.get_option("--set_query_password"); if(!password.empty()) { logMessageFmt(true, LOG_GENERAL, "Updating server admin query password to \"{}\"", password); - auto accounts = serverInstance->getQueryServer()->find_query_accounts_by_unique_id(serverInstance->getInitialServerAdmin()->getUid()); - bool found = false; - for(const auto& account : accounts) { - if(account->bound_server != 0) continue; + auto account = serverInstance->getQueryServer()->find_query_account_by_name("serveradmin"); + if(!account) { + logErrorFmt(true, LOG_GENERAL, "Failed to update server admin query password! Login does not exists!"); + } else { if(!serverInstance->getQueryServer()->change_query_password(account, password)) { logErrorFmt(true, LOG_GENERAL, "Failed to update server admin query password! (Internal error)"); } - found = true; - break; - } - if(!found) { - logErrorFmt(true, LOG_GENERAL, "Failed to update server admin query password! Login does not exists!"); } } }