summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGregor Kleen <gkleen@yggdrasil.li>2015-09-30 17:30:32 +0200
committerGregor Kleen <gkleen@yggdrasil.li>2015-09-30 17:30:32 +0200
commitb4a8cd17027091f92e8971bc1443b228fb7f5433 (patch)
tree98204805908da504294b396094df810b9404d8a7
parentb001e7ecf6c0dd204a059afcd25a6a15b7eb52f7 (diff)
downloadprosody_auth-b4a8cd17027091f92e8971bc1443b228fb7f5433.tar
prosody_auth-b4a8cd17027091f92e8971bc1443b228fb7f5433.tar.gz
prosody_auth-b4a8cd17027091f92e8971bc1443b228fb7f5433.tar.bz2
prosody_auth-b4a8cd17027091f92e8971bc1443b228fb7f5433.tar.xz
prosody_auth-b4a8cd17027091f92e8971bc1443b228fb7f5433.zip
support multiple messages
-rw-r--r--mod_auth_custom/mod_auth_custom.lua10
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
18function test_password(username, password) 18function 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