Software /
code /
prosody
Comparison
plugins/mod_saslauth.lua @ 8511:dd7b8888636e
mod_saslauth: Pass SASL EXTERNAL failure reason on to be used in error bounces
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Sun, 04 Feb 2018 01:01:50 +0100 |
parent | 8510:149e98f88680 |
child | 8512:e924a99fd435 |
comparison
equal
deleted
inserted
replaced
8510:149e98f88680 | 8511:dd7b8888636e |
---|---|
108 condition = condition .. ": " .. text; | 108 condition = condition .. ": " .. text; |
109 end | 109 end |
110 module:log("info", "SASL EXTERNAL with %s failed: %s", session.to_host, condition); | 110 module:log("info", "SASL EXTERNAL with %s failed: %s", session.to_host, condition); |
111 | 111 |
112 session.external_auth = "failed" | 112 session.external_auth = "failed" |
113 session.external_auth_failure_reason = condition; | |
113 end, 500) | 114 end, 500) |
114 | 115 |
115 module:hook_stanza(xmlns_sasl, "failure", function (session, stanza) | 116 module:hook_stanza(xmlns_sasl, "failure", function (session, stanza) |
116 session.log("debug", "No fallback from SASL EXTERNAL failure, giving up"); | 117 session.log("debug", "No fallback from SASL EXTERNAL failure, giving up"); |
117 session:close(); | 118 session:close(nil, session.external_auth_failure_reason); |
118 return true; | 119 return true; |
119 end, 90) | 120 end, 90) |
120 | 121 |
121 module:hook_tag("http://etherx.jabber.org/streams", "features", function (session, stanza) | 122 module:hook_tag("http://etherx.jabber.org/streams", "features", function (session, stanza) |
122 if session.type ~= "s2sout_unauthed" or not session.secure then return; end | 123 if session.type ~= "s2sout_unauthed" or not session.secure then return; end |