summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--mod_auth_custom/mod_auth_custom.lua38
1 files changed, 19 insertions, 19 deletions
diff --git a/mod_auth_custom/mod_auth_custom.lua b/mod_auth_custom/mod_auth_custom.lua
index 9b4872e..811aa57 100644
--- a/mod_auth_custom/mod_auth_custom.lua
+++ b/mod_auth_custom/mod_auth_custom.lua
@@ -16,25 +16,25 @@ function user_exists(username)
16end 16end
17 17
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 if #t == 1 and t[1][1] == pam.PAM_PROMPT_ECHO_OFF then
22 return { { password, 0} }; 22 return { { password, 0} };
23 end 23 end
24 end 24 end
25 }); 25 });
26 if h and h:authenticate() and h:endx(pam.PAM_SUCCESS) then 26 if h and h:authenticate() and h:endx(pam.PAM_SUCCESS) then
27 return true, true; 27 return true, true;
28 end 28 end
29 return nil, true; 29 return nil, true;
30end
31
32function get_sasl_handler()
33 return new_sasl(module.host, {
34 plain_test = function(sasl, ...)
35 return test_password(...)
36 end
37 });
38end 30end
39 31
32function get_sasl_handler()
33 return new_sasl(module.host, {
34 plain_test = function(sasl, ...)
35 return test_password(...)
36 end
37 });
38end
39
40module:provides"auth"; 40module:provides"auth";