Disallow the name 'singleplayer' in a multiplayer server

This commit is contained in:
PilzAdam 2013-07-12 00:53:30 +02:00
parent 6027c8d259
commit 320a00e7c6

@ -1922,6 +1922,15 @@ void Server::ProcessData(u8 *data, u32 datasize, u16 peer_id)
return;
}
if(!isSingleplayer() && strcasecmp(playername, "singleplayer") == 0)
{
actionstream<<"Server: Player with an invalid name "
<<"tried to connect from "<<addr_s<<std::endl;
SendAccessDenied(m_con, peer_id,
L"Name is not allowed");
return;
}
infostream<<"Server: New connection: \""<<playername<<"\" from "
<<m_con.GetPeerAddress(peer_id).serializeString()<<std::endl;