aboutsummaryrefslogtreecommitdiffstats
path: root/plugins/mod_saslauth.lua
diff options
context:
space:
mode:
authorKim Alvefur <zash@zash.se>2019-12-07 22:51:43 +0100
committerKim Alvefur <zash@zash.se>2019-12-07 22:51:43 +0100
commit0ec577b5dfed46586ff329e531bcc18a4cd5ec00 (patch)
tree8460feac7502e23b1c722a8989194af52dcc2bdb /plugins/mod_saslauth.lua
parent01aea4e5d2256d359690431214e54e4bdf1e2672 (diff)
downloadprosody-0ec577b5dfed46586ff329e531bcc18a4cd5ec00.tar.gz
prosody-0ec577b5dfed46586ff329e531bcc18a4cd5ec00.zip
mod_saslauth: Collect SASL EXTERNAL failures into an util.error object
Will be easier than that concatenated string to extract info out of for use elsewhere.
Diffstat (limited to 'plugins/mod_saslauth.lua')
-rw-r--r--plugins/mod_saslauth.lua17
1 files changed, 12 insertions, 5 deletions
diff --git a/plugins/mod_saslauth.lua b/plugins/mod_saslauth.lua
index 30d74b9e..b5604883 100644
--- a/plugins/mod_saslauth.lua
+++ b/plugins/mod_saslauth.lua
@@ -13,6 +13,7 @@ local sm_bind_resource = require "core.sessionmanager".bind_resource;
local sm_make_authenticated = require "core.sessionmanager".make_authenticated;
local base64 = require "util.encodings".base64;
local set = require "util.set";
+local errors = require "util.error";
local usermanager_get_sasl_handler = require "core.usermanager".get_sasl_handler;
@@ -102,13 +103,19 @@ module:hook_tag(xmlns_sasl, "failure", function (session, stanza)
break;
end
end
- if text and condition then
- condition = condition .. ": " .. text;
- end
- module:log("info", "SASL EXTERNAL with %s failed: %s", session.to_host, condition);
+ local err = errors.new({
+ -- TODO type = what?
+ text = text,
+ condition = condition,
+ }, {
+ session = session,
+ stanza = stanza,
+ });
+
+ module:log("info", "SASL EXTERNAL with %s failed: %s", session.to_host, err);
session.external_auth = "failed"
- session.external_auth_failure_reason = condition;
+ session.external_auth_failure_reason = err;
end, 500)
module:hook_tag(xmlns_sasl, "failure", function (session, stanza) -- luacheck: ignore 212/stanza