mod_saslauth: Allow plugins to override return SASL condition/text
authorMatthew Wild <mwild1@gmail.com>
Thu, 30 Nov 2023 11:22:40 +0000
changeset 13367 2738dda885bb
parent 13366 11e66ad894f0
child 13368 6f9b15757384
mod_saslauth: Allow plugins to override return SASL condition/text
plugins/mod_saslauth.lua
--- a/plugins/mod_saslauth.lua	Thu Nov 30 10:14:17 2023 +0000
+++ b/plugins/mod_saslauth.lua	Thu Nov 30 11:22:40 2023 +0000
@@ -56,8 +56,10 @@
 		return "failure", "temporary-auth-failure", "Connection gone";
 	end
 	if status == "failure" then
-		module:fire_event("authentication-failure", { session = session, condition = ret, text = err_msg });
+		local event = { session = session, condition = ret, text = err_msg };
+		module:fire_event("authentication-failure", event);
 		session.sasl_handler = session.sasl_handler:clean_clone();
+		ret, err_msg = event.condition, event.text;
 	elseif status == "success" then
 		local ok, err = sm_make_authenticated(session, session.sasl_handler.username, session.sasl_handler.role);
 		if ok then