Software / code / prosody
Comparison
plugins/mod_saslauth.lua @ 11508:f1abc34414bc 0.11
mod_saslauth: Don't throw errors in async code when connections are gone
Fixes #1515
| author | tmolitor <thilo@eightysoft.de> |
|---|---|
| date | Thu, 18 Mar 2021 14:30:47 +0100 |
| parent | 11213:992c4498a1e3 |
| child | 11512:a2ba6c0ac8ec |
comparison
equal
deleted
inserted
replaced
| 11507:133e8ed291fe | 11508:f1abc34414bc |
|---|---|
| 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 status == "failure" then | 48 if status == "failure" then |
| 48 module:fire_event("authentication-failure", { session = session, condition = ret, text = err_msg }); | 49 module:fire_event("authentication-failure", { session = session, condition = ret, text = err_msg }); |
| 49 session.sasl_handler = session.sasl_handler:clean_clone(); | 50 session.sasl_handler = session.sasl_handler:clean_clone(); |
| 50 elseif status == "success" then | 51 elseif status == "success" then |
| 51 local ok, err = sm_make_authenticated(session, session.sasl_handler.username); | 52 local ok, err = sm_make_authenticated(session, session.sasl_handler.username); |