Comparison

mod_audit_auth/mod_audit_auth.lua @ 5735:b357ff3d0c8a

mod_audit_auth: Include hostpart with audit events mod_audit seems to expect this to be JIDs, not bare usernames.
author Kim Alvefur <zash@zash.se>
date Mon, 13 Nov 2023 17:14:09 +0100
parent 4933:08dea42a302a
child 5771:dfbced5e54b9
comparison
equal deleted inserted replaced
5734:c782f220b3ee 5735:b357ff3d0c8a
1 local jid = require"util.jid";
2
1 module:depends("audit"); 3 module:depends("audit");
2 -- luacheck: read globals module.audit 4 -- luacheck: read globals module.audit
3 5
4 module:hook("authentication-failure", function(event) 6 module:hook("authentication-failure", function(event)
5 local session = event.session; 7 local session = event.session;
6 module:audit(session.sasl_handler.username, "authentication-failure", { 8 module:audit(jid.join(session.sasl_handler.username, module.host), "authentication-failure", {
7 session = session, 9 session = session,
8 }); 10 });
9 end) 11 end)
10 12
11 module:hook("authentication-success", function(event) 13 module:hook("authentication-success", function(event)
12 local session = event.session; 14 local session = event.session;
13 module:audit(session.sasl_handler.username, "authentication-success", { 15 module:audit(jid.join(session.sasl_handler.username, module.host), "authentication-success", {
14 session = session, 16 session = session,
15 }); 17 });
16 end) 18 end)