X-Git-Url: https://git.stg.codes/stg.git/blobdiff_plain/a89444b19b0ceb41db8db6cfa4e6fa77e26d7759..4f1aca7dfb6adf867713ad48e14ad79080e13cfa:/projects/stargazer/plugins/configuration/sgconfig/parser.cpp diff --git a/projects/stargazer/plugins/configuration/sgconfig/parser.cpp b/projects/stargazer/plugins/configuration/sgconfig/parser.cpp index 1f7757d2..8e11a157 100644 --- a/projects/stargazer/plugins/configuration/sgconfig/parser.cpp +++ b/projects/stargazer/plugins/configuration/sgconfig/parser.cpp @@ -1025,9 +1025,23 @@ if (check && alwaysOnline && !onlyOneIP) { printfd(__FILE__, "Requested change leads to a forbidden state: AlwaysOnline with multiple IP's\n"); GetStgLogger()("%s Requested change leads to a forbidden state: AlwaysOnline with multiple IP's", currAdmin->GetLogStr().c_str()); + res = -1; return -1; } +for (size_t i = 0; i < ucr->ips.const_data().Count(); ++i) + { + CONST_USER_PTR user; + uint32_t ip = ucr->ips.const_data().operator[](i).ip; + if (users->IsIPInUse(ip, login, &user)) + { + printfd(__FILE__, "Trying to assign an IP %s to '%s' that is already in use by '%s'\n", inet_ntostring(ip).c_str(), login.c_str(), user->GetLogin().c_str()); + GetStgLogger()("%s trying to assign an IP %s to '%s' that is currently in use by '%s'", currAdmin->GetLogStr().c_str(), inet_ntostring(ip).c_str(), login.c_str(), user->GetLogin().c_str()); + res = -1; + return -1; + } + } + if (!ucr->ips.res_empty()) if (!u->GetProperty().ips.Set(ucr->ips.const_data(), currAdmin, login, store)) res = -1;