Add new CommandFlags value: CMD_SERVER_NS
This commit is contained in:
@@ -495,6 +495,7 @@ enum CommandFlags {
|
|||||||
CMD_STR_CTRL = 0x200, ///< the command's string may contain control strings
|
CMD_STR_CTRL = 0x200, ///< the command's string may contain control strings
|
||||||
CMD_NO_EST = 0x400, ///< the command is never estimated.
|
CMD_NO_EST = 0x400, ///< the command is never estimated.
|
||||||
CMD_PROCEX = 0x800, ///< the command proc function has extended parameters
|
CMD_PROCEX = 0x800, ///< the command proc function has extended parameters
|
||||||
|
CMD_SERVER_NS = 0x1000, ///< the command can only be initiated by the server (this is not executed in spectator mode)
|
||||||
};
|
};
|
||||||
DECLARE_ENUM_AS_BIT_SET(CommandFlags)
|
DECLARE_ENUM_AS_BIT_SET(CommandFlags)
|
||||||
|
|
||||||
|
@@ -1157,7 +1157,7 @@ NetworkRecvStatus ServerNetworkGameSocketHandler::Receive_CLIENT_COMMAND(Packet
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if ((GetCommandFlags(cp.cmd) & CMD_SERVER) && ci->client_id != CLIENT_ID_SERVER && !this->settings_authed) {
|
if ((GetCommandFlags(cp.cmd) & (CMD_SERVER | CMD_SERVER_NS)) && ci->client_id != CLIENT_ID_SERVER && !this->settings_authed) {
|
||||||
IConsolePrintF(CC_ERROR, "WARNING: server only command from: client %d (IP: %s), kicking...", ci->client_id, this->GetClientIP());
|
IConsolePrintF(CC_ERROR, "WARNING: server only command from: client %d (IP: %s), kicking...", ci->client_id, this->GetClientIP());
|
||||||
return this->SendError(NETWORK_ERROR_KICKED);
|
return this->SendError(NETWORK_ERROR_KICKED);
|
||||||
}
|
}
|
||||||
@@ -1173,7 +1173,7 @@ NetworkRecvStatus ServerNetworkGameSocketHandler::Receive_CLIENT_COMMAND(Packet
|
|||||||
* something pretty naughty (or a bug), and will be kicked
|
* something pretty naughty (or a bug), and will be kicked
|
||||||
*/
|
*/
|
||||||
if (!(cp.cmd == CMD_COMPANY_CTRL && cp.p1 == 0 && ci->client_playas == COMPANY_NEW_COMPANY) && ci->client_playas != cp.company &&
|
if (!(cp.cmd == CMD_COMPANY_CTRL && cp.p1 == 0 && ci->client_playas == COMPANY_NEW_COMPANY) && ci->client_playas != cp.company &&
|
||||||
!((GetCommandFlags(cp.cmd) & CMD_SERVER) && this->settings_authed)) {
|
!((GetCommandFlags(cp.cmd) & (CMD_SERVER | CMD_SERVER_NS)) && this->settings_authed)) {
|
||||||
IConsolePrintF(CC_ERROR, "WARNING: client %d (IP: %s) tried to execute a command as company %d, kicking...",
|
IConsolePrintF(CC_ERROR, "WARNING: client %d (IP: %s) tried to execute a command as company %d, kicking...",
|
||||||
ci->client_playas + 1, this->GetClientIP(), cp.company + 1);
|
ci->client_playas + 1, this->GetClientIP(), cp.company + 1);
|
||||||
return this->SendError(NETWORK_ERROR_COMPANY_MISMATCH);
|
return this->SendError(NETWORK_ERROR_COMPANY_MISMATCH);
|
||||||
|
Reference in New Issue
Block a user