changeset 13970:75a3ac3ad198

mod_c2s: Improve user-facing error reporting when unable to proceed "No stream features to proceed with" isn't easy to understand for users, with "stream features" being jargon and the whole thing being about the technical aspect of XMPP stream negotiation. The log messages aimed at admins are hopefully easier understood. These cases occur when either connection security (i.e. mod_tls or certificate settings) or authentication (mod_saslauth, auth provider) is misconfigured or not loaded.
author Kim Alvefur <zash@zash.se>
date Wed, 01 Oct 2025 17:25:15 +0200
parents 1b300c5a79d7
children 97d15552d364
files plugins/mod_c2s.lua
diffstat 1 files changed, 7 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/plugins/mod_c2s.lua	Tue Sep 30 18:20:17 2025 +0200
+++ b/plugins/mod_c2s.lua	Wed Oct 01 17:25:15 2025 +0200
@@ -149,15 +149,14 @@
 			limits:reset();
 		end
 		send(features);
+	elseif session.secure then
+		-- Here SASL should be offered, is mod_saslauth and mod_auth_* loaded and working correctly?
+		(session.log or log)("warn", "No stream features to offer on secure session. Check authentication settings.");
+		session:close{ condition = "undefined-condition", text = "No authentication method available" };
 	else
-		if session.secure then
-			-- Here SASL should be offered
-			(session.log or log)("warn", "No stream features to offer on secure session. Check authentication settings.");
-		else
-			-- Normally STARTTLS would be offered
-			(session.log or log)("warn", "No stream features to offer on insecure session. Check encryption and security settings.");
-		end
-		session:close{ condition = "undefined-condition", text = "No stream features to proceed with" };
+		-- Normally STARTTLS would be offered, is mod_tls loaded?
+		(session.log or log)("warn", "No stream features to offer on insecure session. Check encryption and security settings.");
+		session:close{ condition = "undefined-condition", text = "No connection encryptio available" };
 	end
 end