aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorPerttu Ahola <celeron55@gmail.com>2012-11-27 00:26:19 +0200
committerPerttu Ahola <celeron55@gmail.com>2012-11-29 22:08:25 +0200
commit96a286dcf501e1a749767e20327613c02bb1ff63 (patch)
tree6a0367b873ee749b31029f25f4e05ada7b316314 /src
parent420de7ad5e1bf2d8017705dcddcdcd03709d4410 (diff)
downloadminetest-96a286dcf501e1a749767e20327613c02bb1ff63.tar.gz
minetest-96a286dcf501e1a749767e20327613c02bb1ff63.tar.bz2
minetest-96a286dcf501e1a749767e20327613c02bb1ff63.zip
Make strict and non-strict protocol version checking to work more like expected
Diffstat (limited to 'src')
-rw-r--r--src/defaultsettings.cpp2
-rw-r--r--src/server.cpp32
2 files changed, 20 insertions, 14 deletions
diff --git a/src/defaultsettings.cpp b/src/defaultsettings.cpp
index e9c2ba3b8..8ce9cb1fb 100644
--- a/src/defaultsettings.cpp
+++ b/src/defaultsettings.cpp
@@ -111,7 +111,7 @@ void set_default_settings(Settings *settings)
settings->setDefault("default_game", "minetest");
settings->setDefault("motd", "");
settings->setDefault("max_users", "100");
- settings->setDefault("strict_protocol_version_checking", "true");
+ settings->setDefault("strict_protocol_version_checking", "false");
settings->setDefault("creative_mode", "false");
settings->setDefault("enable_damage", "true");
settings->setDefault("only_peaceful_mobs", "false");
diff --git a/src/server.cpp b/src/server.cpp
index 41765ed19..684e3bb08 100644
--- a/src/server.cpp
+++ b/src/server.cpp
@@ -2069,33 +2069,39 @@ void Server::ProcessData(u8 *data, u32 datasize, u16 peer_id)
getClient(peer_id)->net_proto_version = net_proto_version;
- if(net_proto_version == 0)
+ if(net_proto_version < SERVER_PROTOCOL_VERSION_MIN ||
+ net_proto_version > SERVER_PROTOCOL_VERSION_MAX)
{
- actionstream<<"Server: An old tried to connect from "<<addr_s
+ actionstream<<"Server: A mismatched client tried to connect from "<<addr_s
<<std::endl;
SendAccessDenied(m_con, peer_id, std::wstring(
L"Your client's version is not supported.\n"
L"Server version is ")
- + narrow_to_wide(VERSION_STRING) + L"."
+ + narrow_to_wide(VERSION_STRING) + L",\n"
+ + L"server's PROTOCOL_VERSION is "
+ + narrow_to_wide(itos(SERVER_PROTOCOL_VERSION_MIN))
+ + L"..."
+ + narrow_to_wide(itos(SERVER_PROTOCOL_VERSION_MAX))
+ + L", client's PROTOCOL_VERSION is "
+ + narrow_to_wide(itos(min_net_proto_version))
+ + L"..."
+ + narrow_to_wide(itos(max_net_proto_version))
);
return;
}
if(g_settings->getBool("strict_protocol_version_checking"))
{
- if(net_proto_version < SERVER_PROTOCOL_VERSION_MIN ||
- net_proto_version > SERVER_PROTOCOL_VERSION_MAX)
+ if(net_proto_version != LATEST_PROTOCOL_VERSION)
{
- actionstream<<"Server: A mismatched client tried to connect"
- <<" from "<<addr_s<<std::endl;
+ actionstream<<"Server: A mismatched (strict) client tried to "
+ <<"connect from "<<addr_s<<std::endl;
SendAccessDenied(m_con, peer_id, std::wstring(
L"Your client's version is not supported.\n"
L"Server version is ")
+ narrow_to_wide(VERSION_STRING) + L",\n"
- + L"server's PROTOCOL_VERSION is "
- + narrow_to_wide(itos(SERVER_PROTOCOL_VERSION_MIN))
- + L"..."
- + narrow_to_wide(itos(SERVER_PROTOCOL_VERSION_MAX))
+ + L"server's PROTOCOL_VERSION (strict) is "
+ + narrow_to_wide(itos(LATEST_PROTOCOL_VERSION))
+ L", client's PROTOCOL_VERSION is "
+ narrow_to_wide(itos(min_net_proto_version))
+ L"..."
@@ -2343,8 +2349,8 @@ void Server::ProcessData(u8 *data, u32 datasize, u16 peer_id)
// Warnings about protocol version can be issued here
if(getClient(peer_id)->net_proto_version < LATEST_PROTOCOL_VERSION)
{
- SendChatMessage(peer_id, L"# Server: WARNING: YOUR CLIENT IS OLD "
- L"AND MAY NOT FULLY WORK WITH THIS SERVER!");
+ SendChatMessage(peer_id, L"# Server: WARNING: YOUR CLIENT'S "
+ L"VERSION MAY NOT BE FULLY COMPATIBLE WITH THIS SERVER!");
}
/*