Diff

plugins/mod_dialback.lua @ 3651:337391d34b70

s2s: SASL EXTERNAL
author Paul Aurich <paul@darkrain42.org>
date Sun, 21 Nov 2010 21:10:43 -0800
parent 3534:c68590b13a6d
child 4238:05f991b4a90e
line wrap: on
line diff
--- a/plugins/mod_dialback.lua	Sun Nov 21 21:02:31 2010 -0800
+++ b/plugins/mod_dialback.lua	Sun Nov 21 21:10:43 2010 -0800
@@ -132,9 +132,19 @@
 	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");
+		s2s_initiate_dialback(origin);
+		return true;
+	end
+end, 100);
+
 module:hook_stanza(xmlns_stream, "features", function (origin, stanza)
-	s2s_initiate_dialback(origin);
-	return true;
+	if not origin.external_auth or origin.external_auth == "failed" then
+		s2s_initiate_dialback(origin);
+		return true;
+	end
 end, 100);
 
 -- Offer dialback to incoming hosts