diff options
-rw-r--r-- | mod_auth_custom/mod_auth_custom.lua | 14 |
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) | |||
16 | end | 16 | end |
17 | 17 | ||
18 | function test_password(username, password) | 18 | function 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 | }); |