diff options
Diffstat (limited to 'plugins')
-rw-r--r-- | plugins/mod_auth_anonymous.lua | 2 | ||||
-rw-r--r-- | plugins/mod_dialback.lua | 28 | ||||
-rw-r--r-- | plugins/mod_s2s/mod_s2s.lua | 10 | ||||
-rw-r--r-- | plugins/mod_s2s/s2sout.lib.lua | 2 |
4 files changed, 19 insertions, 23 deletions
diff --git a/plugins/mod_auth_anonymous.lua b/plugins/mod_auth_anonymous.lua index 55398d8a..c080177d 100644 --- a/plugins/mod_auth_anonymous.lua +++ b/plugins/mod_auth_anonymous.lua @@ -51,7 +51,7 @@ local function dm_callback(username, host, datastore, data) return username, host, datastore, data; end -if module:get_option_boolean("disallow_s2s", true) then +if not module:get_option_boolean("allow_anonymous_s2s", false) then module:hook("route/remote", function (event) return false; -- Block outgoing s2s from anonymous users end, 300); diff --git a/plugins/mod_dialback.lua b/plugins/mod_dialback.lua index 4b19f2d9..c2392502 100644 --- a/plugins/mod_dialback.lua +++ b/plugins/mod_dialback.lua @@ -65,20 +65,22 @@ module:hook("stanza/jabber:server:dialback:result", function(event) -- he wants to be identified through dialback -- We need to check the key with the Authoritative server local attr = stanza.attr; - origin.hosts[attr.from] = { dialback_key = stanza[1] }; + local to, from = attr.to, attr.from; - if not hosts[attr.to] then + origin.hosts[from] = { dialback_key = stanza[1] }; + + if not hosts[to] then -- Not a host that we serve - origin.log("info", "%s tried to connect to %s, which we don't serve", attr.from, attr.to); + origin.log("info", "%s tried to connect to %s, which we don't serve", from, to); origin:close("host-unknown"); return true; end - dialback_requests[attr.from.."/"..origin.streamid] = origin; + dialback_requests[from.."/"..origin.streamid] = origin; - local compat_check; + -- COMPAT: ejabberd, gmail and perhaps others do not always set 'to' and 'from' + -- on streams. We fill in the session's to/from here instead. if not origin.from_host then - -- Just used for friendlier logging origin.from_host = nameprep(attr.from); if not origin.from_host then origin.log("debug", "We need to know where to connect but remote server blindly refuses to tell us and to comply to specs, closing connection."); @@ -86,23 +88,19 @@ module:hook("stanza/jabber:server:dialback:result", function(event) end end if not origin.to_host then - -- Just used for friendlier logging origin.to_host = nameprep(attr.to); - -- COMPAT: Fix server's chopness by not including to - compat_check = true; end if not origin.from_host and not origin.to_host then origin.log("debug", "Improper addressing supplied, no to or from?"); origin:close("improper-addressing"); end - -- COMPAT: reset session.send - if compat_check then - origin.send = function(stanza) hosts[attr.to].events.fire_event("route/remote", { from_host = origin.to_host, to_host = origin.from_host, stanza = stanza}); end - end - origin.log("debug", "asking %s if key %s belongs to them", attr.from, stanza[1]); - origin.send(st.stanza("db:verify", { from = attr.to, to = attr.from, id = origin.streamid }):text(stanza[1])); + origin.log("debug", "asking %s if key %s belongs to them", from, stanza[1]); + module:fire_event("route/remote", { + from_host = to, to_host = from; + stanza = st.stanza("db:verify", { from = to, to = from, id = origin.streamid }):text(stanza[1]); + }); return true; end end); diff --git a/plugins/mod_s2s/mod_s2s.lua b/plugins/mod_s2s/mod_s2s.lua index 3087ba24..e2a22738 100644 --- a/plugins/mod_s2s/mod_s2s.lua +++ b/plugins/mod_s2s/mod_s2s.lua @@ -125,6 +125,7 @@ end function module.add_host(module) if module:get_option_boolean("disallow_s2s", false) then + module:log("warn", "The 'disallow_s2s' config option is deprecated, please see http://prosody.im/doc/s2s#disabling"); return nil, "This host has disallow_s2s set"; end module:hook("route/remote", route_to_existing_session, 200); @@ -226,11 +227,11 @@ function stream_callbacks.streamopened(session, attr) text = "This host does not serve "..to }); return; - elseif hosts[to].disallow_s2s then + elseif not hosts[to].modules.s2s then -- Attempting to connect to a host that disallows s2s session:close({ condition = "policy-violation"; - text = "Server-to-server communication is not allowed to this host"; + text = "Server-to-server communication is disabled for this host"; }); return; end @@ -253,11 +254,6 @@ function stream_callbacks.streamopened(session, attr) log("debug", "Sending stream features: %s", tostring(features)); send(features); end - - local host_session = hosts[to]; - session.send = function(stanza) - host_session.events.fire_event("route/remote", { from_host = to, to_host = from, stanza = stanza}) - end; elseif session.direction == "outgoing" then -- If we are just using the connection for verifying dialback keys, we won't try and auth it if not attr.id then error("stream response did not give us a streamid!!!"); end diff --git a/plugins/mod_s2s/s2sout.lib.lua b/plugins/mod_s2s/s2sout.lib.lua index f3496597..2ddc9299 100644 --- a/plugins/mod_s2s/s2sout.lib.lua +++ b/plugins/mod_s2s/s2sout.lib.lua @@ -26,6 +26,8 @@ local log = module._log; local sources = {}; +local dns_timeout = module:get_option_number("dns_timeout", 15); +dns.settimeout(dns_timeout); local max_dns_depth = module:get_option_number("dns_max_depth", 3); local s2sout = {}; |