plugins/sasl.lua

changeset 467
8e6a7a5e70b3
parent 456
6a65142052c8
child 490
6b2f31da9610
--- a/plugins/sasl.lua	Fri Mar 17 09:23:56 2023 +0000
+++ b/plugins/sasl.lua	Fri Mar 17 09:24:36 2023 +0000
@@ -11,10 +11,12 @@
 
 		local mechanisms = {};
 		local preference = {};
+		local offered = {};
 
 		for mech in sasl_mechanisms:childtags("mechanism") do
 			mech = mech:get_text();
 			stream:debug("Server offers %s", mech);
+			offered[mech] = true;
 			if not mechanisms[mech] then
 				local name = mech:match("[^-]+");
 				local ok, impl = pcall(require, "util.sasl."..name:lower());
@@ -32,7 +34,7 @@
 			table.insert(supported, mech);
 		end
 		if not supported[1] then
-			stream:event("authentication-failure", { condition = "no-supported-sasl-mechanisms", mechanisms = mechanisms });
+			stream:event("authentication-failure", { condition = "no-supported-sasl-mechanisms", mechanisms = offered });
 			stream:close();
 			return;
 		end

mercurial