plugins/mod_saslauth.lua

changeset 293
b446de4e258e
parent 292
33175ad2f682
child 294
5d861d6e5bbd
child 295
bb078eb1f1de
equal deleted inserted replaced
292:33175ad2f682 293:b446de4e258e
18 local new_sasl = require "util.sasl".new; 18 local new_sasl = require "util.sasl".new;
19 19
20 local function build_reply(status, ret, err_msg) 20 local function build_reply(status, ret, err_msg)
21 local reply = st.stanza(status, {xmlns = xmlns_sasl}); 21 local reply = st.stanza(status, {xmlns = xmlns_sasl});
22 if status == "challenge" then 22 if status == "challenge" then
23 reply:text(ret or ""); 23 reply:text(base64.encode(ret or ""));
24 elseif status == "failure" then 24 elseif status == "failure" then
25 reply:tag(ret):up(); 25 reply:tag(ret):up();
26 if err_msg then reply:tag("text"); end 26 if err_msg then reply:tag("text"):text(err_msg); end
27 elseif status == "success" then 27 elseif status == "success" then
28 reply:text(ret or ""); 28 reply:text(base64.encode(ret or ""));
29 else 29 else
30 error("Unknown sasl status: "..status); 30 error("Unknown sasl status: "..status);
31 end 31 end
32 return reply; 32 return reply;
33 end 33 end

mercurial