# HG changeset patch # User Kim Alvefur # Date 1411494389 -7200 # Node ID 7653bbd5247e3aba8c4982b34bbf68d132f5b194 # Parent e5945fb5b71f5c1e5dfac898aaaf2851716713eb mod_saslauth: Fix encoding of missing vs empty SASL reply messages diff -r e5945fb5b71f -r 7653bbd5247e plugins/mod_saslauth.lua --- 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