# HG changeset patch # User Matthew Wild # Date 1679045076 0 # Node ID 8e6a7a5e70b32511e924066277919d435a067bb9 # Parent 1eaec52ff71a520ef5065a9311596015ae86cf14 sasl: Expose what mechanisms were offered on authentication-failure diff -r 1eaec52ff71a -r 8e6a7a5e70b3 plugins/sasl.lua --- 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