From dbb28ef3422bf2442e15d75fd52180cfb9b40102 Mon Sep 17 00:00:00 2001 From: Stijn Buys Date: Sat, 8 Nov 2008 12:58:05 +0000 Subject: adds rcon, rconpassword and sv_password --- src/core/netserver.cc | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) (limited to 'src/core/netserver.cc') diff --git a/src/core/netserver.cc b/src/core/netserver.cc index cdcdad7..c6214c9 100644 --- a/src/core/netserver.cc +++ b/src/core/netserver.cc @@ -613,6 +613,33 @@ void NetServer::parse_incoming_message(NetClient *client, const std::string & me return; } + if (command == "rcon") { + if ((message.size() > command.size()+1) && Cvar::sv_password->str().size()) { + if ((Cvar::sv_password->str().compare(client->player()->rconpassword()) == 0)) { + con_print << "^B" << client->player()->name() << "^F rcon: " << message.substr(command.size()+1) << std::endl; + + core::CommandBuffer::exec(); + core::console()->set_rcon(true); + + core::cmd() << message.substr(command.size()+1) << "\n"; + core::CommandBuffer::exec(); + + while(console()->rconbuf().size()) { + server()->send(client->player(), (*console()->rconbuf().begin())); + core::console()->rconbuf().pop_front(); + } + + // disable rcon buffering + console()->set_rcon(false); + + } else { + server()->send(client->player(), "rcon access denied"); + con_print << "^B" << client->player()->name() << "^W rcon access denied" << std::endl; + } + } + return; + + } // cup - client update entity if (command == "cup") { //con_debug << message << "\n"; -- cgit v1.2.3