Software /
code /
prosody-modules
Comparison
mod_auth_ldap/mod_auth_ldap.lua @ 927:a9dfa7232d88
Merge
author | Matthew Wild <mwild1@gmail.com> |
---|---|
date | Tue, 12 Mar 2013 12:10:25 +0000 |
parent | 902:490cb9161c81 |
child | 1162:8e3420d48508 |
comparison
equal
deleted
inserted
replaced
926:f88381a39c56 | 927:a9dfa7232d88 |
---|---|
1 | 1 |
2 local new_sasl = require "util.sasl".new; | 2 local new_sasl = require "util.sasl".new; |
3 local nodeprep = require "util.encodings".stringprep.nodeprep; | |
4 local log = require "util.logger".init("auth_ldap"); | 3 local log = require "util.logger".init("auth_ldap"); |
5 | 4 |
6 local ldap_server = module:get_option("ldap_server") or "localhost"; | 5 local ldap_server = module:get_option("ldap_server") or "localhost"; |
7 local ldap_rootdn = module:get_option("ldap_rootdn") or ""; | 6 local ldap_rootdn = module:get_option("ldap_rootdn") or ""; |
8 local ldap_password = module:get_option("ldap_password") or ""; | 7 local ldap_password = module:get_option("ldap_password") or ""; |
40 function provider.create_user(username, password) return nil, "Account creation/modification not available with LDAP."; end | 39 function provider.create_user(username, password) return nil, "Account creation/modification not available with LDAP."; end |
41 | 40 |
42 function provider.get_sasl_handler() | 41 function provider.get_sasl_handler() |
43 local testpass_authentication_profile = { | 42 local testpass_authentication_profile = { |
44 plain_test = function(sasl, username, password, realm) | 43 plain_test = function(sasl, username, password, realm) |
45 local prepped_username = nodeprep(username); | 44 return provider.test_password(username, password), true; |
46 if not prepped_username then | |
47 log("debug", "NODEprep failed on username: %s", username); | |
48 return "", nil; | |
49 end | |
50 return provider.test_password(prepped_username, password), true; | |
51 end | 45 end |
52 }; | 46 }; |
53 return new_sasl(module.host, testpass_authentication_profile); | 47 return new_sasl(module.host, testpass_authentication_profile); |
54 end | 48 end |
55 | 49 |