Software /
code /
prosody-modules
Comparison
mod_sasl2/mod_sasl2.lua @ 5049:e89aad13a52a
mod_sasl2: Further break up success handling, into pre/post stream:features
This allows us to enable mod_smacks after sending success, but before sending
stream:features. Previously, the features were being calculated before SM was
finalized on the session.
We can't finalize SM before sending <success> because it may generate stanzas.
author | Matthew Wild <mwild1@gmail.com> |
---|---|
date | Thu, 22 Sep 2022 18:25:44 +0100 |
parent | 5048:3697d19d5fd9 |
child | 5063:53145c6b6b0b |
comparison
equal
deleted
inserted
replaced
5048:3697d19d5fd9 | 5049:e89aad13a52a |
---|---|
156 | 156 |
157 module:hook("sasl2/c2s/success", function (event) | 157 module:hook("sasl2/c2s/success", function (event) |
158 local session = event.session | 158 local session = event.session |
159 event.success:text_tag("authorization-identifier", jid_join(session.username, session.host, session.resource)); | 159 event.success:text_tag("authorization-identifier", jid_join(session.username, session.host, session.resource)); |
160 session.send(event.success); | 160 session.send(event.success); |
161 end, -1000); | |
162 | |
163 module:hook("sasl2/c2s/success", function (event) | |
164 local session = event.session; | |
161 local features = st.stanza("stream:features"); | 165 local features = st.stanza("stream:features"); |
162 module:fire_event("stream-features", { origin = session, features = features }); | 166 module:fire_event("stream-features", { origin = session, features = features }); |
163 session.send(features); | 167 session.send(features); |
164 end, -1000); | 168 end, -1500); |
165 | 169 |
166 -- The gap here is to allow modules to do stuff to the stream after the stanza | 170 -- The gap here is to allow modules to do stuff to the stream after the stanza |
167 -- is sent, but before we proceed with anything else. This is expected to be | 171 -- is sent, but before we proceed with anything else. This is expected to be |
168 -- a common pattern with SASL2, which allows atomic negotiation of a bunch of | 172 -- a common pattern with SASL2, which allows atomic negotiation of a bunch of |
169 -- stream features. | 173 -- stream features. |