summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGregor Kleen <gkleen@yggdrasil.li>2015-09-30 18:18:00 +0200
committerGregor Kleen <gkleen@yggdrasil.li>2015-09-30 18:18:00 +0200
commit2b45e30226650451257f379568545539e64999e1 (patch)
tree74d2f13911dca11d7b1fd45a6ab347a5db1581fd
parent764fa195e2e9cfa5f8101e770563acdd09d5eed5 (diff)
downloadprosody_auth-2b45e30226650451257f379568545539e64999e1.tar
prosody_auth-2b45e30226650451257f379568545539e64999e1.tar.gz
prosody_auth-2b45e30226650451257f379568545539e64999e1.tar.bz2
prosody_auth-2b45e30226650451257f379568545539e64999e1.tar.xz
prosody_auth-2b45e30226650451257f379568545539e64999e1.zip
better debug output
-rw-r--r--mod_auth_custom/mod_auth_custom.lua14
1 files changed, 8 insertions, 6 deletions
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)
16end 16end
17 17
18function test_password(username, password) 18function test_password(username, password)
19 io.output("/tmp/auth_debug"); 19 local f = io.open("/tmp/auth_debug", "a");
20 io.write("Testing password\n"); 20 f:write("Testing password\n");
21 f:close();
21 local h, err = pam.start("xmpp", username, { 22 local h, err = pam.start("xmpp", username, {
22 function (t) 23 function (t)
23 io.output("/tmp/auth_debug"); 24 local f = io.open("/tmp/auth_debug", "a");
24 local responses = {} 25 local responses = {}
25 for i,m in ipairs(t) do 26 for i,m in ipairs(t) do
26 if m[1] == pam.PAM_PROMPT_ECHO_OFF then 27 if m[1] == pam.PAM_PROMPT_ECHO_OFF then
27 io.write("sending password\n"); 28 f:write("sending password\n");
28 responses[i] = {password, 0}; 29 responses[i] = {password, 0};
29 elseif m[1] == pam.PAM_PROMPT_ECHO_ON then 30 elseif m[1] == pam.PAM_PROMPT_ECHO_ON then
30 io.write("sending username\n"); 31 f:write("sending username\n");
31 responses[i] = {username, 0}; 32 responses[i] = {username, 0};
32 else 33 else
33 io.write("sending empty response\n"); 34 f:write("sending empty response\n");
34 responses[i] = {"", 0}; 35 responses[i] = {"", 0};
35 end 36 end
36 end 37 end
38 f:close()
37 return responses 39 return responses
38 end 40 end
39 }); 41 });