Changeset

8509:e1d274001855

Backed out changeset 89c42aff8510: The problem in ejabberd has reportedly been resolved and this change causes more problems than it solves (fixes #1006)
author Kim Alvefur <zash@zash.se>
date Sun, 04 Feb 2018 01:13:27 +0100
parents 8508:47115b0ca133
children 8510:149e98f88680
files plugins/mod_dialback.lua plugins/mod_saslauth.lua
diffstat 2 files changed, 12 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/plugins/mod_dialback.lua	Sat Jan 06 08:54:15 2018 +0100
+++ b/plugins/mod_dialback.lua	Sun Feb 04 01:13:27 2018 +0100
@@ -189,6 +189,14 @@
 	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...");
--- a/plugins/mod_saslauth.lua	Sat Jan 06 08:54:15 2018 +0100
+++ b/plugins/mod_saslauth.lua	Sun Feb 04 01:13:27 2018 +0100
@@ -110,10 +110,12 @@
 	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