Changeset

11514:11186af62c87

Merge 0.11->trunk
author Kim Alvefur <zash@zash.se>
date Sat, 10 Apr 2021 16:45:44 +0200
parents 11506:9a3ebdd65f9c (current diff) 11513:549c80feede6 (diff)
children 11515:10d13e0554f9
files plugins/mod_c2s.lua plugins/mod_saslauth.lua
diffstat 2 files changed, 15 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/plugins/mod_c2s.lua	Tue Apr 06 23:23:28 2021 +0200
+++ b/plugins/mod_c2s.lua	Sat Apr 10 16:45:44 2021 +0200
@@ -210,12 +210,12 @@
 				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 @@
 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)
--- a/plugins/mod_saslauth.lua	Tue Apr 06 23:23:28 2021 +0200
+++ b/plugins/mod_saslauth.lua	Sat Apr 10 16:45:44 2021 +0200
@@ -45,6 +45,9 @@
 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();