From 5a693791f610375f90aa874e4eabfaaf59790a2d Mon Sep 17 00:00:00 2001 From: DarthArgus Date: Sun, 1 Jan 2017 17:22:10 +0000 Subject: [PATCH] add seemingly redundant check to allow godmode properly --- .../serverGame/src/shared/core/Client.cpp | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/engine/server/library/serverGame/src/shared/core/Client.cpp b/engine/server/library/serverGame/src/shared/core/Client.cpp index 011891c2..12d2b1d0 100755 --- a/engine/server/library/serverGame/src/shared/core/Client.cpp +++ b/engine/server/library/serverGame/src/shared/core/Client.cpp @@ -244,8 +244,8 @@ Client::Client(ConnectionServerConnection & connection, const NetworkId & charac connectToEmitter(connection, "ConnectionServerConnectionDestroyed"); // Check god permissions - if ( ConfigServerGame::getAdminGodToAll() - || ( (!ConfigServerGame::getUseSecureLoginForGodAccess() || m_isSecure) + if (ConfigServerGame::getAdminGodToAll() + || ((!ConfigServerGame::getUseSecureLoginForGodAccess() || m_isSecure) && AdminAccountManager::isAdminAccount(Unicode::toLower(accountName), m_godLevel) && (!ConfigServerGame::getUseIPForGodAccess() || AdminAccountManager::isInternalIp(ipAddr)))) { @@ -2229,6 +2229,18 @@ bool Client::setGodMode(bool value) { bool wasInGodMode = m_godMode; m_godMode = value; + + // Check god permissions + // the check above seems not to work + if (ConfigServerGame::getAdminGodToAll() + || ((!ConfigServerGame::getUseSecureLoginForGodAccess() || m_isSecure) + && AdminAccountManager::isAdminAccount(Unicode::toLower(m_accountName), m_godLevel) + && (!ConfigServerGame::getUseIPForGodAccess() || AdminAccountManager::isInternalIp(m_ipAddress)))) + { + m_godValidated = true; + if (ConfigServerGame::getAdminGodToAll()) + m_godLevel = ConfigServerGame::getAdminGodToAllGodLevel(); + } if (value && !m_godValidated) {