aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--plugins/mod_c2s.lua16
-rw-r--r--plugins/mod_saslauth.lua3
2 files changed, 15 insertions, 4 deletions
diff --git a/plugins/mod_c2s.lua b/plugins/mod_c2s.lua
index 878b853d..fc838c0d 100644
--- a/plugins/mod_c2s.lua
+++ b/plugins/mod_c2s.lua
@@ -210,12 +210,12 @@ local function session_close(session, reason)
if not session.destroyed then
session.log("warn", "Failed to receive a stream close response, closing connection anyway...");
sm_destroy_session(session, reason_text);
- conn:close();
+ if conn then conn:close(); end
end
end);
else
sm_destroy_session(session, reason_text);
- conn:close();
+ if conn then conn:close(); end
end
else
local reason_text = (reason and (reason.name or reason.text or reason.condition)) or reason;
@@ -246,11 +246,19 @@ module:hook_global("user-password-changed", function(event)
end, 200);
function runner_callbacks:ready()
- self.data.conn:resume();
+ if self.data.conn then
+ self.data.conn:resume();
+ else
+ (self.data.log or log)("debug", "Session has no connection to resume");
+ end
end
function runner_callbacks:waiting()
- self.data.conn:pause();
+ if self.data.conn then
+ self.data.conn:pause();
+ else
+ (self.data.log or log)("debug", "Session has no connection to pause while waiting");
+ end
end
function runner_callbacks:error(err)
diff --git a/plugins/mod_saslauth.lua b/plugins/mod_saslauth.lua
index 5a049e67..97186325 100644
--- a/plugins/mod_saslauth.lua
+++ b/plugins/mod_saslauth.lua
@@ -45,6 +45,9 @@ local function build_reply(status, ret, err_msg)
end
local function handle_status(session, status, ret, err_msg)
+ if not session.sasl_handler then
+ return "failure", "temporary-auth-failure", "Connection gone";
+ end
if status == "failure" then
module:fire_event("authentication-failure", { session = session, condition = ret, text = err_msg });
session.sasl_handler = session.sasl_handler:clean_clone();