Software /
code /
prosody
Changeset
8518:0de0018bdf91
Merge 0.10->trunk
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Sun, 04 Feb 2018 01:40:11 +0100 |
parents | 8507:71ef6d509105 (current diff) 8517:980d2daf3ed4 (diff) |
children | 8519:e7808f8d7d11 |
files | plugins/mod_component.lua plugins/mod_dialback.lua |
diffstat | 3 files changed, 18 insertions(+), 4 deletions(-) [+] |
line wrap: on
line diff
--- 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
--- 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...");
--- 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