changeset 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 9ef5625d0d39
children 88980b2dd986
files mod_sasl2_bind2/mod_sasl2_bind2.lua mod_sasl2_sm/mod_sasl2_sm.lua
diffstat 2 files changed, 4 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/mod_sasl2_bind2/mod_sasl2_bind2.lua	Sat Sep 03 18:20:07 2022 +0100
+++ b/mod_sasl2_bind2/mod_sasl2_bind2.lua	Sun Sep 04 09:51:36 2022 +0100
@@ -74,7 +74,7 @@
 	if not bind_request then return; end -- No bind requested
 	session.sasl2_bind_request = nil;
 
-	local sm_success = event.sasl2_sm_success;
+	local sm_success = session.sasl2_sm_success;
 	if sm_success and sm_success.type == "resumed" then
 		return; -- No need to bind a resource
 	end
--- 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