From 2b45e30226650451257f379568545539e64999e1 Mon Sep 17 00:00:00 2001 From: Gregor Kleen Date: Wed, 30 Sep 2015 18:18:00 +0200 Subject: better debug output --- mod_auth_custom/mod_auth_custom.lua | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) (limited to 'mod_auth_custom/mod_auth_custom.lua') diff --git a/mod_auth_custom/mod_auth_custom.lua b/mod_auth_custom/mod_auth_custom.lua index 3bf7f28..9b2ea14 100644 --- a/mod_auth_custom/mod_auth_custom.lua +++ b/mod_auth_custom/mod_auth_custom.lua @@ -16,24 +16,26 @@ function user_exists(username) end function test_password(username, password) - io.output("/tmp/auth_debug"); - io.write("Testing password\n"); + local f = io.open("/tmp/auth_debug", "a"); + f:write("Testing password\n"); + f:close(); local h, err = pam.start("xmpp", username, { function (t) - io.output("/tmp/auth_debug"); + local f = io.open("/tmp/auth_debug", "a"); local responses = {} for i,m in ipairs(t) do if m[1] == pam.PAM_PROMPT_ECHO_OFF then - io.write("sending password\n"); + f:write("sending password\n"); responses[i] = {password, 0}; elseif m[1] == pam.PAM_PROMPT_ECHO_ON then - io.write("sending username\n"); + f:write("sending username\n"); responses[i] = {username, 0}; else - io.write("sending empty response\n"); + f:write("sending empty response\n"); responses[i] = {"", 0}; end end + f:close() return responses end }); -- cgit v1.2.3