1
0
Fork 0
mirror of https://github.com/luanti-org/luanti.git synced 2025-08-01 17:38:41 +00:00

Client: disable pre v25 init sending by default

Disable the ability to connect to old servers by default to
improve password security.

If people still want to connect to old (0.4.12 and earlier)
servers, they can flip the send_pre_v25_init setting.

Add the ability to detect if we've tried to connect
to a server which only supports the pre v25 init protocol,
and show an apropriate error message. Most times the error
will already be catched at the serverlist level, the
detection mechanism only acts as last resort, because the
"Connection timed out" error message that would be shown
otherwise would be very confusing.

Automatic "fixing" of this condition is not desired,
as it would allow for downgrade attacks.

As already 161 of the 167 servers on the serverlist
support the new srp based auth protocol (> 96%),
the breakage should be minimal.

Follow up of commit

af30183124 "Add option to not send pre v25 init packet"

Also change the pessimistic assumption of masterlist
server versions to optimistic, in order to avoid buggy
behaviour (favourites not in the serverlist would be
denied to connect to, etc).
This commit is contained in:
est31 2016-08-22 04:27:44 +02:00
parent 0b0075e6ad
commit d767f025cb
6 changed files with 34 additions and 8 deletions

View file

@ -248,14 +248,18 @@ end
--------------------------------------------------------------------------------
function is_server_protocol_compat(server_proto_min, server_proto_max)
return min_supp_proto <= (server_proto_max or 24) and max_supp_proto >= (server_proto_min or 13)
if (not server_proto_min) or (not server_proto_max) then
-- There is no info. Assume the best and act as if we would be compatible.
return true
end
return min_supp_proto <= server_proto_max and max_supp_proto >= server_proto_min
end
--------------------------------------------------------------------------------
function is_server_protocol_compat_or_error(server_proto_min, server_proto_max)
if not is_server_protocol_compat(server_proto_min, server_proto_max) then
local server_prot_ver_info, client_prot_ver_info
local s_p_min = server_proto_min or 13
local s_p_max = server_proto_max or 24
local s_p_min = server_proto_min
local s_p_max = server_proto_max
if s_p_min ~= s_p_max then
server_prot_ver_info = fgettext_ne("Server supports protocol versions between $1 and $2. ",