aboutsummaryrefslogtreecommitdiffstats
path: root/plugins/mod_saslauth.lua
diff options
context:
space:
mode:
authorKim Alvefur <zash@zash.se>2014-09-23 19:46:29 +0200
committerKim Alvefur <zash@zash.se>2014-09-23 19:46:29 +0200
commit3e8095f15030fc121154423f65d5c7cdd5e049fd (patch)
tree80bedfdd7666359f32970756d2f8e3ea2ce81ab8 /plugins/mod_saslauth.lua
parentc95613de573aea6cb4e6393a78b983be647b043a (diff)
downloadprosody-3e8095f15030fc121154423f65d5c7cdd5e049fd.tar.gz
prosody-3e8095f15030fc121154423f65d5c7cdd5e049fd.zip
mod_saslauth: Fix encoding of missing vs empty SASL reply messages
Diffstat (limited to 'plugins/mod_saslauth.lua')
-rw-r--r--plugins/mod_saslauth.lua14
1 files changed, 7 insertions, 7 deletions
diff --git a/plugins/mod_saslauth.lua b/plugins/mod_saslauth.lua
index 15b0c178..9e63b4c7 100644
--- a/plugins/mod_saslauth.lua
+++ b/plugins/mod_saslauth.lua
@@ -26,15 +26,15 @@ local xmlns_bind ='urn:ietf:params:xml:ns:xmpp-bind';
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