diff options
author | Stijn Buys <ingar@osirion.org> | 2008-07-22 17:20:37 +0000 |
---|---|---|
committer | Stijn Buys <ingar@osirion.org> | 2008-07-22 17:20:37 +0000 |
commit | bb8b4e081d33f4f1aca6ba23a78842e1fc9cd721 (patch) | |
tree | 8c0f370516368aee17636369f3decadf940b08d6 /src/core | |
parent | 59ea9fffec01a6cc3fbf147aa311bfaa9abaa933 (diff) |
verify owner on entity client updates
Diffstat (limited to 'src/core')
-rw-r--r-- | src/core/netserver.cc | 21 |
1 files changed, 16 insertions, 5 deletions
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; } |