diff mod_sasl2_sm/mod_sasl2_sm.lua @ 5037:8a8100fff580

mod_sasl2_bind2, mod_sasl2_sm: Move sasl2_sm_success to session ...to allow referencing it across multiple different events.
author Matthew Wild <mwild1@gmail.com>
date Sun, 04 Sep 2022 09:51:36 +0100
parents baebe7452903
children c0d243b27e64
line wrap: on
line diff
--- a/mod_sasl2_sm/mod_sasl2_sm.lua	Sat Sep 03 18:20:07 2022 +0100
+++ b/mod_sasl2_sm/mod_sasl2_sm.lua	Sun Sep 04 09:51:36 2022 +0100
@@ -39,7 +39,7 @@
 			:add_error(err);
 	else
 		event.session = resumed.session; -- Update to resumed session
-		event.sasl2_sm_success = resumed; -- To be called after sending final SASL response
+		event.session.sasl2_sm_success = resumed; -- To be called after sending final SASL response
 		sm_result = st.stanza("resumed", { xmlns = xmlns_sm,
 			h = ("%d"):format(event.session.handled_stanza_count);
 			previd = resumed.id; });
@@ -66,7 +66,7 @@
 		sm_result = st.stanza("failed", { xmlns = xmlns_sm })
 			:add_error(err);
 	else
-		event.sasl2_sm_success = enabled; -- To be called after sending final SASL response
+		event.session.sasl2_sm_success = enabled; -- To be called after sending final SASL response
 		sm_result = st.stanza("enabled", {
 			xmlns = xmlns_sm;
 			id = enabled.id;
@@ -81,7 +81,7 @@
 
 module:hook("sasl2/c2s/success", function (event)
 	-- The authenticate response has already been sent at this point
-	local success = event.sasl2_sm_success;
+	local success = event.session.sasl2_sm_success;
 	if success then
 		success.finish(); -- Finish enable/resume and sync stanzas
 	end