aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthew Wild <mwild1@gmail.com>2023-12-05 11:39:11 +0000
committerMatthew Wild <mwild1@gmail.com>2023-12-05 11:39:11 +0000
commitc35307551b603850281e3622c4e12fdf4d224895 (patch)
tree3598d3b2c814b73fa773e3d4f1423d39549b732f
parente03fe2ebe34a2a689637e91f9647d93ca8ba1ac9 (diff)
downloadprosody-c35307551b603850281e3622c4e12fdf4d224895.tar.gz
prosody-c35307551b603850281e3622c4e12fdf4d224895.zip
mod_saslauth: Fire event per SASL step
This matches the behaviour of the newer mod_sasl2 implementation. It allows plugins to observe (and potentially, with caution, modify) the SASL exchange.
-rw-r--r--plugins/mod_saslauth.lua7
1 files changed, 5 insertions, 2 deletions
diff --git a/plugins/mod_saslauth.lua b/plugins/mod_saslauth.lua
index 4cdbfe67..b219d711 100644
--- a/plugins/mod_saslauth.lua
+++ b/plugins/mod_saslauth.lua
@@ -87,9 +87,12 @@ local function sasl_process_cdata(session, stanza)
return true;
end
end
- local status, ret, err_msg = session.sasl_handler:process(text);
+ local sasl_handler = session.sasl_handler;
+ local status, ret, err_msg = sasl_handler:process(text);
status, ret, err_msg = handle_status(session, status, ret, err_msg);
- local s = build_reply(status, ret, err_msg);
+ local event = { session = session, message = ret, error_text = err_msg };
+ module:fire_event("sasl/"..session.base_type.."/"..status, event);
+ local s = build_reply(status, event.message, event.error_text);
session.send(s);
return true;
end