Software /
code /
prosody
Comparison
plugins/mod_saslauth.lua @ 10488:03ff1e614b4d
mod_saslauth: Set a nicer bounce error explaining SASL EXTERNAL failures
Better than the previous string concatenation of SASL failure condition
and optional text sent by the remote server.
Would be nice to have a text per condition, other than the probably most
common 'not-authorized'.
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Sat, 07 Dec 2019 22:55:51 +0100 |
parent | 10487:02ccf2fbf000 |
child | 10643:417eadd0f567 |
comparison
equal
deleted
inserted
replaced
10487:02ccf2fbf000 | 10488:03ff1e614b4d |
---|---|
118 session.external_auth_failure_reason = err; | 118 session.external_auth_failure_reason = err; |
119 end, 500) | 119 end, 500) |
120 | 120 |
121 module:hook_tag(xmlns_sasl, "failure", function (session, stanza) -- luacheck: ignore 212/stanza | 121 module:hook_tag(xmlns_sasl, "failure", function (session, stanza) -- luacheck: ignore 212/stanza |
122 session.log("debug", "No fallback from SASL EXTERNAL failure, giving up"); | 122 session.log("debug", "No fallback from SASL EXTERNAL failure, giving up"); |
123 session:close(nil, session.external_auth_failure_reason); | 123 session:close(nil, session.external_auth_failure_reason, errors.new({ |
124 type = "wait", condition = "remote-server-timeout", | |
125 text = "Could not authenticate to remote server", | |
126 }, { session = session, sasl_failure = session.external_auth_failure_reason, })); | |
124 return true; | 127 return true; |
125 end, 90) | 128 end, 90) |
126 | 129 |
127 module:hook_tag("http://etherx.jabber.org/streams", "features", function (session, stanza) | 130 module:hook_tag("http://etherx.jabber.org/streams", "features", function (session, stanza) |
128 if session.type ~= "s2sout_unauthed" or not session.secure then return; end | 131 if session.type ~= "s2sout_unauthed" or not session.secure then return; end |