diff options
author | Kim Alvefur <zash@zash.se> | 2017-03-02 15:17:32 +0100 |
---|---|---|
committer | Kim Alvefur <zash@zash.se> | 2017-03-02 15:17:32 +0100 |
commit | 77b7ae7fe3154ce4bad3db4b23ac656c3d5dfce0 (patch) | |
tree | 272e5e095530a4dad8949b8ccae57fa0568aedff | |
parent | dfed4cae0481ba2bbd5babc22e702e55181a85b7 (diff) | |
download | prosody-77b7ae7fe3154ce4bad3db4b23ac656c3d5dfce0.tar.gz prosody-77b7ae7fe3154ce4bad3db4b23ac656c3d5dfce0.zip |
mod_saslauth: Log SASL failure reason
-rw-r--r-- | plugins/mod_saslauth.lua | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/plugins/mod_saslauth.lua b/plugins/mod_saslauth.lua index c5d3dc91..d374633e 100644 --- a/plugins/mod_saslauth.lua +++ b/plugins/mod_saslauth.lua @@ -96,8 +96,19 @@ end) module:hook_stanza(xmlns_sasl, "failure", function (session, stanza) if session.type ~= "s2sout_unauthed" or session.external_auth ~= "attempting" then return; end - module:log("info", "SASL EXTERNAL with %s failed", session.to_host) - -- TODO: Log the failure reason + local text = stanza:get_child_text("text"); + local condition = "unknown-condition"; + for child in stanza:childtags() do + if child.name ~= "text" then + condition = child.name; + break; + end + end + if text and condition then + condition = connection .. ": " .. text; + end + module:log("info", "SASL EXTERNAL with %s failed: %s", session.to_host, condition); + session.external_auth = "failed" end, 500) |