Software /
code /
prosody
Diff
util/prosodyctl/check.lua @ 11655:bbf50525faa5
util.prosodyctl.check: Normalize away trailing dot in some messages too
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Sun, 04 Jul 2021 02:33:15 +0200 |
parent | 11654:52c7a0e74bb2 |
child | 11776:1132a1f1ca5a |
line wrap: on
line diff
--- a/util/prosodyctl/check.lua Sun Jul 04 01:33:53 2021 +0200 +++ b/util/prosodyctl/check.lua Sun Jul 04 02:33:15 2021 +0200 @@ -365,6 +365,10 @@ 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 @@ 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 @@ 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 @@ 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 @@ 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");