Make strict and non-strict protocol version checking to work more like expected
authorPerttu Ahola <celeron55@gmail.com>
Mon, 26 Nov 2012 22:26:19 +0000 (00:26 +0200)
committerPerttu Ahola <celeron55@gmail.com>
Thu, 29 Nov 2012 20:08:25 +0000 (22:08 +0200)
minetest.conf.example
src/defaultsettings.cpp
src/server.cpp

index aebab825c71a4e3212f5d0cac648efa4ae223391..64cb877270a2dbbc15cb60247a80487890553469 100644 (file)
 #motd = Welcome to this awesome Minetest server!
 # Maximum number of players connected simultaneously
 #max_users = 100
-# Set to false to allow old clients to connect
-#strict_protocol_version_checking = true
+# Set to true to disallow old clients from connecting
+#strict_protocol_version_checking = false
 # Set to true to enable creative mode (unlimited inventory)
 #creative_mode = false
 # Enable players getting damage and dying
index e9c2ba3b8ce2ee780d99cefa07401fc4edf1bfcf..8ce9cb1fb35c5e66a3b9a085c723c6502b6e544d 100644 (file)
@@ -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");
index 41765ed19059bf1b664a82c4fd6117c3b88d0a4c..684e3bb087d619d4ac22128d2b44b407b49d0ebf 100644 (file)
@@ -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!");
                }
 
                /*