From: Perttu Ahola Date: Mon, 26 Nov 2012 22:26:19 +0000 (+0200) Subject: Make strict and non-strict protocol version checking to work more like expected X-Git-Tag: 0.4.4~39 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=96a286dcf501e1a749767e20327613c02bb1ff63;p=oweals%2Fminetest.git Make strict and non-strict protocol version checking to work more like expected --- diff --git a/minetest.conf.example b/minetest.conf.example index aebab825c..64cb87727 100644 --- a/minetest.conf.example +++ b/minetest.conf.example @@ -139,8 +139,8 @@ #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 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 "<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 "<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!"); } /*