Software /
code /
prosody
Comparison
plugins/mod_saslauth.lua @ 7939:6940d6db970b
mod_saslauth: Log SASL failure reason
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Thu, 02 Mar 2017 15:17:32 +0100 |
parent | 6033:0d6f23049e95 |
child | 7940:e520dc0c3af4 |
child | 8222:67a9d2de2300 |
comparison
equal
deleted
inserted
replaced
7916:72b6d5ab4137 | 7939:6940d6db970b |
---|---|
94 end) | 94 end) |
95 | 95 |
96 module:hook_stanza(xmlns_sasl, "failure", function (session, stanza) | 96 module:hook_stanza(xmlns_sasl, "failure", function (session, stanza) |
97 if session.type ~= "s2sout_unauthed" or session.external_auth ~= "attempting" then return; end | 97 if session.type ~= "s2sout_unauthed" or session.external_auth ~= "attempting" then return; end |
98 | 98 |
99 module:log("info", "SASL EXTERNAL with %s failed", session.to_host) | 99 local text = stanza:get_child_text("text"); |
100 -- TODO: Log the failure reason | 100 local condition = "unknown-condition"; |
101 for child in stanza:childtags() do | |
102 if child.name ~= "text" then | |
103 condition = child.name; | |
104 break; | |
105 end | |
106 end | |
107 if text and condition then | |
108 condition = connection .. ": " .. text; | |
109 end | |
110 module:log("info", "SASL EXTERNAL with %s failed: %s", session.to_host, condition); | |
111 | |
101 session.external_auth = "failed" | 112 session.external_auth = "failed" |
102 end, 500) | 113 end, 500) |
103 | 114 |
104 module:hook_stanza(xmlns_sasl, "failure", function (session, stanza) | 115 module:hook_stanza(xmlns_sasl, "failure", function (session, stanza) |
105 -- TODO: Dialback wasn't loaded. Do something useful. | 116 -- TODO: Dialback wasn't loaded. Do something useful. |