Software /
code /
prosody
Comparison
plugins/mod_saslauth.lua @ 11526:15a3db955ad3
s2s et al.: Add counters for connection state transitions
author | Jonas Schäfer <jonas@wielicki.name> |
---|---|
date | Wed, 21 Apr 2021 17:11:58 +0200 |
parent | 11514:11186af62c87 |
child | 12330:38b5b05407be |
comparison
equal
deleted
inserted
replaced
11525:5f99fcc43938 | 11526:15a3db955ad3 |
---|---|
89 module:log("debug", "SASL EXTERNAL with %s succeeded", session.to_host); | 89 module:log("debug", "SASL EXTERNAL with %s succeeded", session.to_host); |
90 session.external_auth = "succeeded" | 90 session.external_auth = "succeeded" |
91 session:reset_stream(); | 91 session:reset_stream(); |
92 session:open_stream(session.from_host, session.to_host); | 92 session:open_stream(session.from_host, session.to_host); |
93 | 93 |
94 module:fire_event("s2s-authenticated", { session = session, host = session.to_host }); | 94 module:fire_event("s2s-authenticated", { session = session, host = session.to_host, mechanism = "EXTERNAL" }); |
95 return true; | 95 return true; |
96 end) | 96 end) |
97 | 97 |
98 module:hook_tag(xmlns_sasl, "failure", function (session, stanza) | 98 module:hook_tag(xmlns_sasl, "failure", function (session, stanza) |
99 if session.type ~= "s2sout_unauthed" or session.external_auth ~= "attempting" then return; end | 99 if session.type ~= "s2sout_unauthed" or session.external_auth ~= "attempting" then return; end |
190 | 190 |
191 -- Success! | 191 -- Success! |
192 session.external_auth = "succeeded"; | 192 session.external_auth = "succeeded"; |
193 session.sends2s(build_reply("success")); | 193 session.sends2s(build_reply("success")); |
194 module:log("info", "Accepting SASL EXTERNAL identity from %s", session.from_host); | 194 module:log("info", "Accepting SASL EXTERNAL identity from %s", session.from_host); |
195 module:fire_event("s2s-authenticated", { session = session, host = session.from_host }); | 195 module:fire_event("s2s-authenticated", { session = session, host = session.from_host, mechanism = mechanism }); |
196 session:reset_stream(); | 196 session:reset_stream(); |
197 return true; | 197 return true; |
198 end | 198 end |
199 | 199 |
200 module:hook("stanza/urn:ietf:params:xml:ns:xmpp-sasl:auth", function(event) | 200 module:hook("stanza/urn:ietf:params:xml:ns:xmpp-sasl:auth", function(event) |