Software / code / prosody
Comparison
prosodyctl @ 8923:ddd98e262519
prosodyctl: Only check for s2s if mod_s2s is enabled (fixes #1031)
| author | Emmanuel Gil Peyrot <linkmauve@linkmauve.fr> |
|---|---|
| date | Sat, 23 Jun 2018 16:15:36 +0200 |
| parent | 8917:d4c98115e00c |
| child | 8924:8fe98e365ab8 |
comparison
equal
deleted
inserted
replaced
| 8922:47d318eeff8d | 8923:ddd98e262519 |
|---|---|
| 1026 | 1026 |
| 1027 for jid, host_options in enabled_hosts() do | 1027 for jid, host_options in enabled_hosts() do |
| 1028 local all_targets_ok, some_targets_ok = true, false; | 1028 local all_targets_ok, some_targets_ok = true, false; |
| 1029 local node, host = jid_split(jid); | 1029 local node, host = jid_split(jid); |
| 1030 | 1030 |
| 1031 local modules, component_module = modulemanager.get_modules_for_host(host); | |
| 1032 if component_module then | |
| 1033 modules:add(component_module); | |
| 1034 end | |
| 1035 | |
| 1031 local is_component = not not host_options.component_module; | 1036 local is_component = not not host_options.component_module; |
| 1032 print("Checking DNS for "..(is_component and "component" or "host").." "..jid.."..."); | 1037 print("Checking DNS for "..(is_component and "component" or "host").." "..jid.."..."); |
| 1033 if node then | 1038 if node then |
| 1034 print("Only the domain part ("..host..") is used in DNS.") | 1039 print("Only the domain part ("..host..") is used in DNS.") |
| 1035 end | 1040 end |
| 1050 else | 1055 else |
| 1051 target_hosts:add(host); | 1056 target_hosts:add(host); |
| 1052 end | 1057 end |
| 1053 end | 1058 end |
| 1054 end | 1059 end |
| 1055 do | 1060 if modules:contains("s2s") then |
| 1056 local res = dns.lookup("_xmpp-server._tcp."..idna.to_ascii(host)..".", "SRV"); | 1061 local res = dns.lookup("_xmpp-server._tcp."..idna.to_ascii(host)..".", "SRV"); |
| 1057 if res then | 1062 if res then |
| 1058 for _, record in ipairs(res) do | 1063 for _, record in ipairs(res) do |
| 1059 target_hosts:add(record.srv.target); | 1064 target_hosts:add(record.srv.target); |
| 1060 if not s2s_ports:contains(record.srv.port) then | 1065 if not s2s_ports:contains(record.srv.port) then |
| 1075 end | 1080 end |
| 1076 | 1081 |
| 1077 if target_hosts:contains("localhost") then | 1082 if target_hosts:contains("localhost") then |
| 1078 print(" Target 'localhost' cannot be accessed from other servers"); | 1083 print(" Target 'localhost' cannot be accessed from other servers"); |
| 1079 target_hosts:remove("localhost"); | 1084 target_hosts:remove("localhost"); |
| 1080 end | |
| 1081 | |
| 1082 local modules, component_module = modulemanager.get_modules_for_host(host); | |
| 1083 | |
| 1084 if component_module then | |
| 1085 modules:add(component_module); | |
| 1086 end | 1085 end |
| 1087 | 1086 |
| 1088 if modules:contains("proxy65") then | 1087 if modules:contains("proxy65") then |
| 1089 local proxy65_target = configmanager.get(host, "proxy65_address") or host; | 1088 local proxy65_target = configmanager.get(host, "proxy65_address") or host; |
| 1090 local A, AAAA = dns.lookup(idna.to_ascii(proxy65_target), "A"), dns.lookup(idna.to_ascii(proxy65_target), "AAAA"); | 1089 local A, AAAA = dns.lookup(idna.to_ascii(proxy65_target), "A"), dns.lookup(idna.to_ascii(proxy65_target), "AAAA"); |