Changeset

13386:33e5edbd6a4a

mod_saslauth: Fire event per SASL step This matches the behaviour of the newer mod_sasl2 implementation. It allows plugins to observe (and potentially, with caution, modify) the SASL exchange.
author Matthew Wild <mwild1@gmail.com>
date Tue, 05 Dec 2023 11:39:11 +0000
parents 13385:72d7830505f0
children 13387:e5ddae99faa8
files plugins/mod_saslauth.lua
diffstat 1 files changed, 5 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/plugins/mod_saslauth.lua	Sat Dec 02 21:45:38 2023 +0100
+++ b/plugins/mod_saslauth.lua	Tue Dec 05 11:39:11 2023 +0000
@@ -87,9 +87,12 @@
 			return true;
 		end
 	end
-	local status, ret, err_msg = session.sasl_handler:process(text);
+	local sasl_handler = session.sasl_handler;
+	local status, ret, err_msg = sasl_handler:process(text);
 	status, ret, err_msg = handle_status(session, status, ret, err_msg);
-	local s = build_reply(status, ret, err_msg);
+	local event = { session = session, message = ret, error_text = err_msg };
+	module:fire_event("sasl/"..session.base_type.."/"..status, event);
+	local s = build_reply(status, event.message, event.error_text);
 	session.send(s);
 	return true;
 end