veryfy that synced user commands come from the correct client
Previously it was possible that (modified) clients send user commands like recruit or move while its not their turn. To prevent this, we now use the from_side check (that was previously only used for dependent commands) also for normal synced commands. The from_side check works like this: The sending clients adds a from_side= attribute to its commands which contains which side issued this command. The server veryfies that that client actually controls that side The recieveing clients veryfy that this is the side that can currently issue commands (the currently plaing side). For compability with older clients it currently just gives a ERR_REPLAY. Later it should be changed into a replay::process_error.
This commit is contained in:
parent
b160462fb2
commit
e2df198e55
1 changed files with 8 additions and 0 deletions
|
@ -237,6 +237,7 @@ void replay::add_synced_command(const std::string& name, const config& command)
|
|||
{
|
||||
config& cmd = add_command();
|
||||
cmd.add_child(name,command);
|
||||
cmd["from_side"] = resources::controller->current_side();
|
||||
LOG_REPLAY << "add_synced_command: \n" << cmd.debug() << "\n";
|
||||
}
|
||||
|
||||
|
@ -824,6 +825,13 @@ REPLAY_RETURN do_replay_handle(bool one_move)
|
|||
else
|
||||
{
|
||||
LOG_REPLAY << "found commandname " << commandname << "in replay";
|
||||
|
||||
if((*cfg)["from_side"].to_int(0) != resources::controller->current_side()) {
|
||||
ERR_REPLAY << "recieved a synced [command] from side " << (*cfg)["from_side"].to_int(0) << ". Expacted was a [command] from side " << resources::controller->current_side() << "\n";
|
||||
}
|
||||
else if((*cfg)["side_invalid"].to_bool(false)) {
|
||||
ERR_REPLAY << "recieved a synced [command] from side " << (*cfg)["from_side"].to_int(0) << ". Sended from wrong client.\n";
|
||||
}
|
||||
/*
|
||||
we need to use the undo stack during replays in order to make delayed shroud updated work.
|
||||
*/
|
||||
|
|
Loading…
Add table
Reference in a new issue