# HG changeset patch # User Kim Alvefur # Date 1517704811 -3600 # Node ID 0de0018bdf91defb3fcfb578f9da5ce26017d052 # Parent 71ef6d509105b80807f4f454ebabe605aafbf992# Parent 980d2daf3ed48292cabfa6fad5bd430eb224a1d6 Merge 0.10->trunk diff -r 71ef6d509105 -r 0de0018bdf91 plugins/mod_component.lua --- a/plugins/mod_component.lua Sat Feb 03 17:36:55 2018 +0100 +++ b/plugins/mod_component.lua Sun Feb 04 01:40:11 2018 +0100 @@ -120,7 +120,8 @@ local name = module:get_option_string("name"); if name then event.origin.send(st.reply(stanza):tag("query", { xmlns = "http://jabber.org/protocol/disco#info" }) - :tag("identity", { category = "component", type = "generic", name = module:get_option_string("name", "Prosody") })) + :tag("identity", { category = "component", type = "generic", name = module:get_option_string("name", "Prosody") })):up() + :tag("feature", { var = "http://jabber.org/protocol/disco#info" }):up() return true; end end diff -r 71ef6d509105 -r 0de0018bdf91 plugins/mod_dialback.lua --- a/plugins/mod_dialback.lua Sat Feb 03 17:36:55 2018 +0100 +++ b/plugins/mod_dialback.lua Sun Feb 04 01:40:11 2018 +0100 @@ -153,7 +153,7 @@ valid = "invalid"; end if dialback_verifying.destroyed then - log("warn", "Incoming s2s session %s was closed in the meantime, so we can't notify it of the db result", + log("warn", "Incoming s2s session %s was closed in the meantime, so we can't notify it of the dialback result", tostring(dialback_verifying):match("%w+$")); else dialback_verifying.sends2s( @@ -190,6 +190,14 @@ end end); +module:hook_tag("urn:ietf:params:xml:ns:xmpp-sasl", "failure", function (origin, stanza) -- luacheck: ignore 212/stanza + if origin.external_auth == "failed" then + module:log("debug", "SASL EXTERNAL failed, falling back to dialback"); + initiate_dialback(origin); + return true; + end +end, 100); + module:hook_tag(xmlns_stream, "features", function (origin, stanza) -- luacheck: ignore 212/stanza if not origin.external_auth or origin.external_auth == "failed" then module:log("debug", "Initiating dialback..."); diff -r 71ef6d509105 -r 0de0018bdf91 plugins/mod_saslauth.lua --- a/plugins/mod_saslauth.lua Sat Feb 03 17:36:55 2018 +0100 +++ b/plugins/mod_saslauth.lua Sun Feb 04 01:40:11 2018 +0100 @@ -110,9 +110,14 @@ module:log("info", "SASL EXTERNAL with %s failed: %s", session.to_host, condition); session.external_auth = "failed" - session:close(); + session.external_auth_failure_reason = condition; +end, 500) + +module:hook_tag(xmlns_sasl, "failure", function (session, stanza) -- luacheck: ignore 212/stanza + session.log("debug", "No fallback from SASL EXTERNAL failure, giving up"); + session:close(nil, session.external_auth_failure_reason); return true; -end, 500) +end, 90) module:hook_tag("http://etherx.jabber.org/streams", "features", function (session, stanza) if session.type ~= "s2sout_unauthed" or not session.secure then return; end