From bb8b4e081d33f4f1aca6ba23a78842e1fc9cd721 Mon Sep 17 00:00:00 2001 From: Stijn Buys Date: Tue, 22 Jul 2008 17:20:37 +0000 Subject: verify owner on entity client updates --- src/core/netserver.cc | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) (limited to 'src/core') diff --git a/src/core/netserver.cc b/src/core/netserver.cc index ac24f33..065d695 100644 --- a/src/core/netserver.cc +++ b/src/core/netserver.cc @@ -556,12 +556,23 @@ void NetServer::parse_incoming_message(NetClient *client, const std::string & me Entity *entity = Entity::find(id); if (!entity) { con_warn << client->host() << ":" << client->port() << " update for unknown entity " << id << "\n"; - - } else { - entity->entity_dirty = true; - entity->recieve_client_update(msgstream); + return; + } + + if (entity->type() == Entity::Controlable) { + con_warn << client->host() << ":" << client->port() << " update for non-controlable entity " << id << "\n"; + return; } - + + EntityControlable *entitycontrolable = (EntityControlable *)entity; + + if (entitycontrolable->owner() != client->player()) { + con_warn << client->host() << ":" << client->port() << " update for not-owned entity " << id << "\n"; + return; + } + + entitycontrolable->entity_dirty = true; + entitycontrolable->recieve_client_update(msgstream); } return; } -- cgit v1.2.3