aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPilzAdam <pilzadam@minetest.net>2013-07-12 00:53:30 +0200
committerPilzAdam <pilzadam@minetest.net>2013-07-12 02:15:09 +0200
commit320a00e7c65c43c2aa64d1da6e855428101c4aa6 (patch)
treeab1aa6d6f871dd91205401e6e13840efe7d55916
parent6027c8d25920fea23a306dba02162174721250e0 (diff)
downloadminetest-320a00e7c65c43c2aa64d1da6e855428101c4aa6.tar.gz
minetest-320a00e7c65c43c2aa64d1da6e855428101c4aa6.tar.bz2
minetest-320a00e7c65c43c2aa64d1da6e855428101c4aa6.zip
Disallow the name 'singleplayer' in a multiplayer server
-rw-r--r--src/server.cpp9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/server.cpp b/src/server.cpp
index 1618a0915..60bf422f7 100644
--- a/src/server.cpp
+++ b/src/server.cpp
@@ -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;