Comparison

util/prosodyctl/check.lua @ 10932:ea4a7619058f

util.prosodyctl.check: Fix traceback by handling SRV '.' target to The IDNA to-ASCII operation returns nil in this case, which causes an error in net.dns
author Kim Alvefur <zash@zash.se>
date Sun, 14 Jun 2020 12:57:50 +0200
parent 10871:e5dee71d0ebb
child 10971:3cdb4a7cb406
comparison
equal deleted inserted replaced
10931:558f0555ba02 10932:ea4a7619058f
297 local target_hosts = set.new(); 297 local target_hosts = set.new();
298 if modules:contains("c2s") then 298 if modules:contains("c2s") then
299 local res = dns.lookup("_xmpp-client._tcp."..idna.to_ascii(host)..".", "SRV"); 299 local res = dns.lookup("_xmpp-client._tcp."..idna.to_ascii(host)..".", "SRV");
300 if res then 300 if res then
301 for _, record in ipairs(res) do 301 for _, record in ipairs(res) do
302 if record.srv.target == "." then -- TODO is this an error if mod_c2s is enabled?
303 print(" 'xmpp-client' service disabled by pointing to '.'"); -- FIXME Explain better what this is
304 break;
305 end
302 target_hosts:add(record.srv.target); 306 target_hosts:add(record.srv.target);
303 if not c2s_ports:contains(record.srv.port) then 307 if not c2s_ports:contains(record.srv.port) then
304 print(" SRV target "..record.srv.target.." contains unknown client port: "..record.srv.port); 308 print(" SRV target "..record.srv.target.." contains unknown client port: "..record.srv.port);
305 end 309 end
306 end 310 end
315 end 319 end
316 if modules:contains("s2s") then 320 if modules:contains("s2s") then
317 local res = dns.lookup("_xmpp-server._tcp."..idna.to_ascii(host)..".", "SRV"); 321 local res = dns.lookup("_xmpp-server._tcp."..idna.to_ascii(host)..".", "SRV");
318 if res then 322 if res then
319 for _, record in ipairs(res) do 323 for _, record in ipairs(res) do
324 if record.srv.target == "." then -- TODO Is this an error if mod_s2s is enabled?
325 print(" 'xmpp-server' service disabled by pointing to '.'"); -- FIXME Explain better what this is
326 break;
327 end
320 target_hosts:add(record.srv.target); 328 target_hosts:add(record.srv.target);
321 if not s2s_ports:contains(record.srv.port) then 329 if not s2s_ports:contains(record.srv.port) then
322 print(" SRV target "..record.srv.target.." contains unknown server port: "..record.srv.port); 330 print(" SRV target "..record.srv.target.." contains unknown server port: "..record.srv.port);
323 end 331 end
324 end 332 end