From b4a8cd17027091f92e8971bc1443b228fb7f5433 Mon Sep 17 00:00:00 2001 From: Gregor Kleen Date: Wed, 30 Sep 2015 17:30:32 +0200 Subject: support multiple messages --- mod_auth_custom/mod_auth_custom.lua | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 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 811aa57..67049af 100644 --- a/mod_auth_custom/mod_auth_custom.lua +++ b/mod_auth_custom/mod_auth_custom.lua @@ -18,9 +18,15 @@ end function test_password(username, password) local h, err = pam.start("xmpp", username, { function (t) - if #t == 1 and t[1][1] == pam.PAM_PROMPT_ECHO_OFF then - return { { password, 0} }; + local responses = {} + for i,m in ipairs(t) do + if m[1] == pam.PAM_PROMPT_ECHO_OFF then + responses[i] = {password, 0}; + elseif m[1] == pam.PAM_PROMPT_ECHO_ON then + responses[i] = {username, 0}; + end end + return responses end }); if h and h:authenticate() and h:endx(pam.PAM_SUCCESS) then -- cgit v1.2.3