summaryrefslogtreecommitdiff
path: root/src/server.cpp
diff options
context:
space:
mode:
authorPerttu Ahola <celeron55@gmail.com>2011-07-30 20:02:17 +0300
committerPerttu Ahola <celeron55@gmail.com>2011-07-30 20:02:17 +0300
commit24a662705cb73f8a5630114654c38a0e1328b9ec (patch)
tree9c29eebe1551467c5234c247f040caa7f410f102 /src/server.cpp
parentcdadbdbd17d624dd45cca67f41309cbe776dc348 (diff)
downloadminetest-24a662705cb73f8a5630114654c38a0e1328b9ec.tar.gz
minetest-24a662705cb73f8a5630114654c38a0e1328b9ec.tar.bz2
minetest-24a662705cb73f8a5630114654c38a0e1328b9ec.zip
Added network protocol version number in protocol
Diffstat (limited to 'src/server.cpp')
-rw-r--r--src/server.cpp19
1 files changed, 18 insertions, 1 deletions
diff --git a/src/server.cpp b/src/server.cpp
index 96e64b314..ca166eaef 100644
--- a/src/server.cpp
+++ b/src/server.cpp
@@ -1966,6 +1966,23 @@ void Server::ProcessData(u8 *data, u32 datasize, u16 peer_id)
derr_server<<DTIME<<"Server: Cannot negotiate "
"serialization version with peer "
<<peer_id<<std::endl;
+ SendAccessDenied(m_con, peer_id,
+ L"Your client is too old (map format)");
+ return;
+ }
+
+ /*
+ Check network protocol version
+ */
+ u16 net_proto_version = 0;
+ if(datasize >= 2+1+PLAYERNAME_SIZE+PASSWORD_SIZE+2)
+ {
+ net_proto_version = readU16(&data[2+1+PLAYERNAME_SIZE+PASSWORD_SIZE]);
+ }
+ if(net_proto_version == 0)
+ {
+ SendAccessDenied(m_con, peer_id,
+ L"Your client is too old (network protocol)");
return;
}
@@ -1999,7 +2016,7 @@ void Server::ProcessData(u8 *data, u32 datasize, u16 peer_id)
// Get password
char password[PASSWORD_SIZE];
- if(datasize == 2+1+PLAYERNAME_SIZE)
+ if(datasize >= 2+1+PLAYERNAME_SIZE)
{
// old version - assume blank password
password[0] = 0;