Mercurial > prosody-modules
comparison mod_sasl2/mod_sasl2.lua @ 6121:045abdc53ba4
mod_sasl2: Reset SASL handler after failed authentication
mod_saslauth already does this, and we should be too. It allows re-attempting
authentication after failure.
| author | Matthew Wild <mwild1@gmail.com> |
|---|---|
| date | Thu, 16 Jan 2025 15:44:24 +0000 |
| parents | ce755c661036 |
| children | aaf92bf929e5 |
comparison
equal
deleted
inserted
replaced
| 6120:c90aab23fb9b | 6121:045abdc53ba4 |
|---|---|
| 123 end | 123 end |
| 124 | 124 |
| 125 module:hook("sasl2/c2s/failure", function (event) | 125 module:hook("sasl2/c2s/failure", function (event) |
| 126 module:fire_event("authentication-failure", event); | 126 module:fire_event("authentication-failure", event); |
| 127 local session, condition, text = event.session, event.message, event.error_text; | 127 local session, condition, text = event.session, event.message, event.error_text; |
| 128 | |
| 129 session.sasl_handler = session.sasl_handler:clean_clone(); | |
| 130 | |
| 128 local failure = st.stanza("failure", { xmlns = xmlns_sasl2 }) | 131 local failure = st.stanza("failure", { xmlns = xmlns_sasl2 }) |
| 129 :tag(condition, { xmlns = "urn:ietf:params:xml:ns:xmpp-sasl" }):up(); | 132 :tag(condition, { xmlns = "urn:ietf:params:xml:ns:xmpp-sasl" }):up(); |
| 130 if text then | 133 if text then |
| 131 failure:text_tag("text", text); | 134 failure:text_tag("text", text); |
| 132 end | 135 end |
