diff options
| -rw-r--r-- | mod_auth_custom/mod_auth_custom.lua | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/mod_auth_custom/mod_auth_custom.lua b/mod_auth_custom/mod_auth_custom.lua index 811aa57..67049af 100644 --- a/mod_auth_custom/mod_auth_custom.lua +++ b/mod_auth_custom/mod_auth_custom.lua | |||
| @@ -18,9 +18,15 @@ end | |||
| 18 | function test_password(username, password) | 18 | function test_password(username, password) |
| 19 | local h, err = pam.start("xmpp", username, { | 19 | local h, err = pam.start("xmpp", username, { |
| 20 | function (t) | 20 | function (t) |
| 21 | if #t == 1 and t[1][1] == pam.PAM_PROMPT_ECHO_OFF then | 21 | local responses = {} |
| 22 | return { { password, 0} }; | 22 | for i,m in ipairs(t) do |
| 23 | if m[1] == pam.PAM_PROMPT_ECHO_OFF then | ||
| 24 | responses[i] = {password, 0}; | ||
| 25 | elseif m[1] == pam.PAM_PROMPT_ECHO_ON then | ||
| 26 | responses[i] = {username, 0}; | ||
| 27 | end | ||
| 23 | end | 28 | end |
| 29 | return responses | ||
| 24 | end | 30 | end |
| 25 | }); | 31 | }); |
| 26 | if h and h:authenticate() and h:endx(pam.PAM_SUCCESS) then | 32 | if h and h:authenticate() and h:endx(pam.PAM_SUCCESS) then |
