From 6f60a98b166796f0be7515ec8636027972e34f92 Mon Sep 17 00:00:00 2001 From: Kim Alvefur Date: Sun, 4 Jul 2021 02:33:15 +0200 Subject: util.prosodyctl.check: Normalize away trailing dot in some messages too --- util/prosodyctl/check.lua | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) (limited to 'util/prosodyctl/check.lua') diff --git a/util/prosodyctl/check.lua b/util/prosodyctl/check.lua index 1ed3c37c..1795b01d 100644 --- a/util/prosodyctl/check.lua +++ b/util/prosodyctl/check.lua @@ -365,6 +365,10 @@ local function check(arg) local v6_supported = not not socket.tcp6; + local function trim_dns_name(n) + return (n:gsub("%.$", "")); + end + for jid, host_options in enabled_hosts() do local all_targets_ok, some_targets_ok = true, false; local node, host = jid_split(jid); @@ -388,9 +392,10 @@ local function check(arg) print(" 'xmpp-client' service disabled by pointing to '.'"); -- FIXME Explain better what this is break; end - target_hosts:add(record.srv.target); + local target = trim_dns_name(record.srv.target); + target_hosts:add(target); if not c2s_ports:contains(record.srv.port) then - print(" SRV target "..record.srv.target.." contains unknown client port: "..record.srv.port); + print(" SRV target "..target.." contains unknown client port: "..record.srv.port); end end else @@ -410,9 +415,10 @@ local function check(arg) print(" 'xmpps-client' service disabled by pointing to '.'"); -- FIXME Explain better what this is break; end - target_hosts:add(record.srv.target); + local target = trim_dns_name(record.srv.target); + target_hosts:add(target); if not c2s_tls_ports:contains(record.srv.port) then - print(" SRV target "..record.srv.target.." contains unknown Direct TLS client port: "..record.srv.port); + print(" SRV target "..target.." contains unknown Direct TLS client port: "..record.srv.port); end end else @@ -428,9 +434,10 @@ local function check(arg) print(" 'xmpp-server' service disabled by pointing to '.'"); -- FIXME Explain better what this is break; end - target_hosts:add(record.srv.target); + local target = trim_dns_name(record.srv.target); + target_hosts:add(target); if not s2s_ports:contains(record.srv.port) then - print(" SRV target "..record.srv.target.." contains unknown server port: "..record.srv.port); + print(" SRV target "..target.." contains unknown server port: "..record.srv.port); end end else @@ -446,8 +453,6 @@ local function check(arg) target_hosts:add(host); end - target_hosts = target_hosts / function(target) return target:gsub("%.$", ""); end - if target_hosts:contains("localhost") then print(" Target 'localhost' cannot be accessed from other servers"); target_hosts:remove("localhost"); -- cgit v1.2.3