From af30183124d40a969040d7de4b3a487feec466e4 Mon Sep 17 00:00:00 2001 From: est31 Date: Mon, 14 Mar 2016 10:18:29 +0100 Subject: Add option to not send pre v25 init packet The legacy init packet (pre v25) sends information about the client's password that a server could use to log in to other servers if the username and password are the same. All the other benefits of SRP of protocol v25 are missed if the legacy init packet is still sent during connection creation. This patch adds an option to not send the v25 init packet. Not sending the v25 packet means breaking compat with pre v25 servers, but as the option is not enabled by default, no servers are affected unless the user explicitly flips the switch. More than 90% of the servers on the serverlist support post v25 protocols. The patch also fixes a bug with greying out of non compliant servers being done wrongly, the min and max params were mixed. --- builtin/mainmenu/common.lua | 11 ++++++++--- builtin/mainmenu/tab_multiplayer.lua | 4 ++++ 2 files changed, 12 insertions(+), 3 deletions(-) (limited to 'builtin/mainmenu') diff --git a/builtin/mainmenu/common.lua b/builtin/mainmenu/common.lua index f40c787a2..b9a010e61 100644 --- a/builtin/mainmenu/common.lua +++ b/builtin/mainmenu/common.lua @@ -22,9 +22,14 @@ menudata = {} -------------------------------------------------------------------------------- -- Local cached values -------------------------------------------------------------------------------- -local min_supp_proto = core.get_min_supp_proto() -local max_supp_proto = core.get_max_supp_proto() +local min_supp_proto +local max_supp_proto +function common_update_cached_supp_proto() + min_supp_proto = core.get_min_supp_proto() + max_supp_proto = core.get_max_supp_proto() +end +common_update_cached_supp_proto() -------------------------------------------------------------------------------- -- Menu helper functions -------------------------------------------------------------------------------- @@ -105,7 +110,7 @@ function render_favorite(spec,render_details) end local details = "" - local grey_out = not is_server_protocol_compat(spec.proto_max, spec.proto_min) + local grey_out = not is_server_protocol_compat(spec.proto_min, spec.proto_max) if spec.clients ~= nil and spec.clients_max ~= nil then local clients_color = '' diff --git a/builtin/mainmenu/tab_multiplayer.lua b/builtin/mainmenu/tab_multiplayer.lua index 570259718..2072f8c38 100644 --- a/builtin/mainmenu/tab_multiplayer.lua +++ b/builtin/mainmenu/tab_multiplayer.lua @@ -17,6 +17,10 @@ -------------------------------------------------------------------------------- local function get_formspec(tabview, name, tabdata) + -- Update the cached supported proto info, + -- it may have changed after a change by the settings menu. + common_update_cached_supp_proto() + local render_details = core.is_yes(core.setting_getbool("public_serverlist")) local retval = -- cgit v1.2.3