plugins/mod_saslauth.lua
changeset 6430 7653bbd5247e
parent 6428 436a670a0189
child 6490 edc63dc72566
--- a/plugins/mod_saslauth.lua	Tue Sep 23 19:41:10 2014 +0200
+++ b/plugins/mod_saslauth.lua	Tue Sep 23 19:46:29 2014 +0200
@@ -26,15 +26,15 @@
 
 local function build_reply(status, ret, err_msg)
 	local reply = st.stanza(status, {xmlns = xmlns_sasl});
-	if status == "challenge" then
-		--log("debug", "CHALLENGE: %s", ret or "");
-		reply:text(base64.encode(ret or ""));
-	elseif status == "failure" then
+	if status == "failure" then
 		reply:tag(ret):up();
 		if err_msg then reply:tag("text"):text(err_msg); end
-	elseif status == "success" then
-		--log("debug", "SUCCESS: %s", ret or "");
-		reply:text(base64.encode(ret or ""));
+	elseif status == "challenge" or status == "success" then
+		if ret == "" then
+			reply:text("=")
+		elseif ret then
+			reply:text(base64.encode(ret));
+		end
 	else
 		module:log("error", "Unknown sasl status: %s", status);
 	end