Software /
code /
prosody
Changeset
6427:7653bbd5247e
mod_saslauth: Fix encoding of missing vs empty SASL reply messages
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Tue, 23 Sep 2014 19:46:29 +0200 |
parents | 6426:e5945fb5b71f |
children | 6428:3ee09bfe16e1 6433:b93402cec1c4 |
files | plugins/mod_saslauth.lua |
diffstat | 1 files changed, 7 insertions(+), 7 deletions(-) [+] |
line wrap: on
line diff
--- 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