Comparison

plugins/mod_saslauth.lua @ 11512:a2ba6c0ac8ec 0.11

mod_saslauth: Improve code style This many returns deserve their own line. `session["sasl_handler"]` style isn't used anywhere else.
author Kim Alvefur <zash@zash.se>
date Thu, 18 Mar 2021 16:17:45 +0100
parent 11508:f1abc34414bc
child 11513:549c80feede6
comparison
equal deleted inserted replaced
11511:cab64a0aad49 11512:a2ba6c0ac8ec
42 end 42 end
43 return reply; 43 return reply;
44 end 44 end
45 45
46 local function handle_status(session, status, ret, err_msg) 46 local function handle_status(session, status, ret, err_msg)
47 if session["sasl_handler"] == nil then return "failure", "connection-timeout", "Connection gone"; end 47 if not session.sasl_handler then
48 return "failure", "connection-timeout", "Connection gone";
49 end
48 if status == "failure" then 50 if status == "failure" then
49 module:fire_event("authentication-failure", { session = session, condition = ret, text = err_msg }); 51 module:fire_event("authentication-failure", { session = session, condition = ret, text = err_msg });
50 session.sasl_handler = session.sasl_handler:clean_clone(); 52 session.sasl_handler = session.sasl_handler:clean_clone();
51 elseif status == "success" then 53 elseif status == "success" then
52 local ok, err = sm_make_authenticated(session, session.sasl_handler.username); 54 local ok, err = sm_make_authenticated(session, session.sasl_handler.username);