Comparison

plugins/mod_saslauth.lua @ 13386:33e5edbd6a4a

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.
author Matthew Wild <mwild1@gmail.com>
date Tue, 05 Dec 2023 11:39:11 +0000
parent 13381:b7dc45d704fa
child 13480:3027c2634a44
comparison
equal deleted inserted replaced
13385:72d7830505f0 13386:33e5edbd6a4a
85 session.sasl_handler = nil; 85 session.sasl_handler = nil;
86 session.send(build_reply("failure", "incorrect-encoding")); 86 session.send(build_reply("failure", "incorrect-encoding"));
87 return true; 87 return true;
88 end 88 end
89 end 89 end
90 local status, ret, err_msg = session.sasl_handler:process(text); 90 local sasl_handler = session.sasl_handler;
91 local status, ret, err_msg = sasl_handler:process(text);
91 status, ret, err_msg = handle_status(session, status, ret, err_msg); 92 status, ret, err_msg = handle_status(session, status, ret, err_msg);
92 local s = build_reply(status, ret, err_msg); 93 local event = { session = session, message = ret, error_text = err_msg };
94 module:fire_event("sasl/"..session.base_type.."/"..status, event);
95 local s = build_reply(status, event.message, event.error_text);
93 session.send(s); 96 session.send(s);
94 return true; 97 return true;
95 end 98 end
96 99
97 module:hook_tag(xmlns_sasl, "success", function (session) 100 module:hook_tag(xmlns_sasl, "success", function (session)