Software /
code /
prosody
Changeset
10487:02ccf2fbf000
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.
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Sat, 07 Dec 2019 22:51:43 +0100 (2019-12-07) |
parents | 10486:479e96e554c8 |
children | 10488:03ff1e614b4d |
files | plugins/mod_saslauth.lua |
diffstat | 1 files changed, 12 insertions(+), 5 deletions(-) [+] |
line wrap: on
line diff
--- a/plugins/mod_saslauth.lua Sat Dec 07 19:05:10 2019 +0100 +++ b/plugins/mod_saslauth.lua Sat Dec 07 22:51:43 2019 +0100 @@ -13,6 +13,7 @@ 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 @@ 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