diff options
Diffstat (limited to 'mod_auth_custom')
| -rw-r--r-- | mod_auth_custom/mod_auth_custom.lua | 38 |
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) | |||
| 16 | end | 16 | end |
| 17 | 17 | ||
| 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 | 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; |
| 30 | end | ||
| 31 | |||
| 32 | function get_sasl_handler() | ||
| 33 | return new_sasl(module.host, { | ||
| 34 | plain_test = function(sasl, ...) | ||
| 35 | return test_password(...) | ||
| 36 | end | ||
| 37 | }); | ||
| 38 | end | 30 | end |
| 39 | 31 | ||
| 32 | function get_sasl_handler() | ||
| 33 | return new_sasl(module.host, { | ||
| 34 | plain_test = function(sasl, ...) | ||
| 35 | return test_password(...) | ||
| 36 | end | ||
| 37 | }); | ||
| 38 | end | ||
| 39 | |||
| 40 | module:provides"auth"; | 40 | module:provides"auth"; |
