X-Git-Url: https://git.enpas.org/?a=blobdiff_plain;f=plugins%2Fmod_s2s%2Fmod_s2s.lua;h=1ce63a8bd81de7842a02105158a4f793e9ca5821;hb=f437ae2c0cf8bdaf57ce21ebc906f5e05fb8c2b3;hp=0a2b5bb773bd08cad82ad808c58ce3f5d2af938a;hpb=e1174c8a1637659f3447e4fa091cc1619637c8da;p=prosody.git diff --git a/plugins/mod_s2s/mod_s2s.lua b/plugins/mod_s2s/mod_s2s.lua index 0a2b5bb7..1ce63a8b 100644 --- a/plugins/mod_s2s/mod_s2s.lua +++ b/plugins/mod_s2s/mod_s2s.lua @@ -37,6 +37,8 @@ local secure_domains, insecure_domains = module:get_option_set("s2s_secure_domains", {})._items, module:get_option_set("s2s_insecure_domains", {})._items; local require_encryption = module:get_option_boolean("s2s_require_encryption", false); +local measure_connections = module:measure("connections", "counter"); + local sessions = module:shared("sessions"); local log = module._log; @@ -47,7 +49,7 @@ local bouncy_stanzas = { message = true, presence = true, iq = true }; local function bounce_sendq(session, reason) local sendq = session.sendq; if not sendq then return; end - session.log("info", "sending error replies for "..#sendq.." queued stanzas because of failed outgoing connection to "..tostring(session.to_host)); + session.log("info", "Sending error replies for "..#sendq.." queued stanzas because of failed outgoing connection to "..tostring(session.to_host)); local dummy = { type = "s2sin"; send = function(s) @@ -153,6 +155,11 @@ function module.add_host(module) -- Stream is authenticated and we are seem to be done with feature negotiation, -- so the stream is ready for stanzas. RFC 6120 Section 4.3 mark_connected(session); + return true; + elseif not session.dialback_verifying then + session.log("warn", "No SASL EXTERNAL offer and Dialback doesn't seem to be enabled, giving up"); + session:close(); + return false; end end, -1); end @@ -494,6 +501,12 @@ function session_stream_attrs(session, from, to, attr) if not from or (hosts[from] and hosts[from].modules.dialback) then attr["xmlns:db"] = 'jabber:server:dialback'; end + if not from then + attr.from = ''; + end + if not to then + attr.to = ''; + end end -- Session initialization logic shared by incoming and outgoing @@ -563,6 +576,7 @@ local function initialize_session(session) end function listener.onconnect(conn) + measure_connections(1); conn:setoption("keepalive", opt_keepalives); local session = sessions[conn]; if not session then -- New incoming connection @@ -594,6 +608,7 @@ function listener.onstatus(conn, status) end function listener.ondisconnect(conn, err) + measure_connections(-1); local session = sessions[conn]; if session then sessions[conn] = nil;