mod_saslauth: Set a nicer bounce error explaining SASL EXTERNAL failures
authorKim Alvefur <zash@zash.se>
Sat, 07 Dec 2019 22:55:51 +0100
changeset 10492 03ff1e614b4d
parent 10491 02ccf2fbf000
child 10493 fabe50ea39f2
mod_saslauth: Set a nicer bounce error explaining SASL EXTERNAL failures Better than the previous string concatenation of SASL failure condition and optional text sent by the remote server. Would be nice to have a text per condition, other than the probably most common 'not-authorized'.
plugins/mod_saslauth.lua
--- a/plugins/mod_saslauth.lua	Sat Dec 07 22:51:43 2019 +0100
+++ b/plugins/mod_saslauth.lua	Sat Dec 07 22:55:51 2019 +0100
@@ -120,7 +120,10 @@
 
 module:hook_tag(xmlns_sasl, "failure", function (session, stanza) -- luacheck: ignore 212/stanza
 	session.log("debug", "No fallback from SASL EXTERNAL failure, giving up");
-	session:close(nil, session.external_auth_failure_reason);
+	session:close(nil, session.external_auth_failure_reason, errors.new({
+				type = "wait", condition = "remote-server-timeout",
+				text = "Could not authenticate to remote server",
+		}, { session = session, sasl_failure = session.external_auth_failure_reason, }));
 	return true;
 end, 90)