# HG changeset patch # User Matthew Wild # Date 1662281496 -3600 # Node ID 8a8100fff58091a7474850df863828f6c100e575 # Parent 9ef5625d0d39dd26fc87ed14289368aa4c9df2bc mod_sasl2_bind2, mod_sasl2_sm: Move sasl2_sm_success to session ...to allow referencing it across multiple different events. diff -r 9ef5625d0d39 -r 8a8100fff580 mod_sasl2_bind2/mod_sasl2_bind2.lua --- 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 diff -r 9ef5625d0d39 -r 8a8100fff580 mod_sasl2_sm/mod_sasl2_sm.lua --- 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