Mercurial > prosody-modules
comparison mod_auth_ldap/mod_auth_ldap.lua @ 342:8e9e5c7d97ff
mod_auth_*: Get rid of undocumented and broken 'sasl_realm' config option.
| author | Waqas Hussain <waqas20@gmail.com> |
|---|---|
| date | Wed, 23 Feb 2011 01:36:46 +0500 |
| parents | 4c3abf1a9b5a |
| children | 881ec9919144 |
comparison
equal
deleted
inserted
replaced
| 341:f801ce6826d5 | 342:8e9e5c7d97ff |
|---|---|
| 38 function provider.get_password(username) return nil, "Passwords unavailable for LDAP."; end | 38 function provider.get_password(username) return nil, "Passwords unavailable for LDAP."; end |
| 39 function provider.set_password(username, password) return nil, "Passwords unavailable for LDAP."; end | 39 function provider.set_password(username, password) return nil, "Passwords unavailable for LDAP."; end |
| 40 function provider.create_user(username, password) return nil, "Account creation/modification not available with LDAP."; end | 40 function provider.create_user(username, password) return nil, "Account creation/modification not available with LDAP."; end |
| 41 | 41 |
| 42 function provider.get_sasl_handler() | 42 function provider.get_sasl_handler() |
| 43 local realm = module:get_option("sasl_realm") or module.host; | |
| 44 local testpass_authentication_profile = { | 43 local testpass_authentication_profile = { |
| 45 plain_test = function(sasl, username, password, realm) | 44 plain_test = function(sasl, username, password, realm) |
| 46 local prepped_username = nodeprep(username); | 45 local prepped_username = nodeprep(username); |
| 47 if not prepped_username then | 46 if not prepped_username then |
| 48 log("debug", "NODEprep failed on username: %s", username); | 47 log("debug", "NODEprep failed on username: %s", username); |
| 49 return "", nil; | 48 return "", nil; |
| 50 end | 49 end |
| 51 return provider.test_password(prepped_username, password), true; | 50 return provider.test_password(prepped_username, password), true; |
| 52 end | 51 end |
| 53 }; | 52 }; |
| 54 return new_sasl(realm, testpass_authentication_profile); | 53 return new_sasl(module.host, testpass_authentication_profile); |
| 55 end | 54 end |
| 56 | 55 |
| 57 module:add_item("auth-provider", provider); | 56 module:add_item("auth-provider", provider); |
