Skip to content

Commit

Permalink
Disallow the name 'singleplayer' in a multiplayer server
Browse files Browse the repository at this point in the history
  • Loading branch information
PilzAdam committed Jul 12, 2013
1 parent 6027c8d commit 320a00e
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/server.cpp
Expand Up @@ -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;

Expand Down

0 comments on commit 320a00e

Please sign in to comment.