Changeset

467:8e6a7a5e70b3

sasl: Expose what mechanisms were offered on authentication-failure
author Matthew Wild <mwild1@gmail.com>
date Fri, 17 Mar 2023 09:24:36 +0000
parents 466:1eaec52ff71a
children 468:fae5ae0ddb84
files plugins/sasl.lua
diffstat 1 files changed, 3 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- 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