Changeset

7940:e520dc0c3af4

Merge 0.9->0.10
author Kim Alvefur <zash@zash.se>
date Thu, 02 Mar 2017 15:21:07 +0100
parents 7938:3629f03817f8 (current diff) 7939:6940d6db970b (diff)
children 7941:8067828e7e40
files plugins/mod_saslauth.lua
diffstat 1 files changed, 13 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/plugins/mod_saslauth.lua	Thu Mar 02 03:03:25 2017 +0100
+++ b/plugins/mod_saslauth.lua	Thu Mar 02 15:21:07 2017 +0100
@@ -96,8 +96,19 @@
 module:hook_stanza(xmlns_sasl, "failure", function (session, stanza)
 	if session.type ~= "s2sout_unauthed" or session.external_auth ~= "attempting" then return; end
 
-	module:log("info", "SASL EXTERNAL with %s failed", session.to_host)
-	-- TODO: Log the failure reason
+	local text = stanza:get_child_text("text");
+	local condition = "unknown-condition";
+	for child in stanza:childtags() do
+		if child.name ~= "text" then
+			condition = child.name;
+			break;
+		end
+	end
+	if text and condition then
+		condition = connection .. ": " .. text;
+	end
+	module:log("info", "SASL EXTERNAL with %s failed: %s", session.to_host, condition);
+
 	session.external_auth = "failed"
 	session:close();
 	return true;