diff options
-rw-r--r-- | plugins/mod_dialback.lua | 8 | ||||
-rw-r--r-- | plugins/mod_saslauth.lua | 6 |
2 files changed, 12 insertions, 2 deletions
diff --git a/plugins/mod_dialback.lua b/plugins/mod_dialback.lua index dcbf9448..cc1615cf 100644 --- a/plugins/mod_dialback.lua +++ b/plugins/mod_dialback.lua @@ -189,6 +189,14 @@ module:hook("stanza/jabber:server:dialback:result", function(event) end end); +module:hook_stanza("urn:ietf:params:xml:ns:xmpp-sasl", "failure", function (origin, 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_stanza(xmlns_stream, "features", function (origin, stanza) if not origin.external_auth or origin.external_auth == "failed" then module:log("debug", "Initiating dialback..."); diff --git a/plugins/mod_saslauth.lua b/plugins/mod_saslauth.lua index b5ec4057..55b93cda 100644 --- a/plugins/mod_saslauth.lua +++ b/plugins/mod_saslauth.lua @@ -110,10 +110,12 @@ module:hook_tag(xmlns_sasl, "failure", function (session, stanza) module:log("info", "SASL EXTERNAL with %s failed: %s", session.to_host, condition); session.external_auth = "failed" - session:close(); - return true; end, 500) +module:hook_stanza(xmlns_sasl, "failure", function (session, stanza) + -- TODO: Dialback wasn't loaded. Do something useful. +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 |