Software /
code /
prosody-modules
Comparison
mod_auth_ldap2/mod_auth_ldap2.lua @ 902:490cb9161c81
mod_auth_{external,internal_yubikey,ldap,ldap2,sql}: No need to nodeprep in SASL handler.
author | Waqas Hussain <waqas20@gmail.com> |
---|---|
date | Sat, 26 Jan 2013 04:34:05 +0500 |
parent | 862:675945ea2ed6 |
child | 3869:f2b29183ef08 |
comparison
equal
deleted
inserted
replaced
901:e3ad5f3aa6d4 | 902:490cb9161c81 |
---|---|
11 -- http://code.google.com/p/prosody-modules/source/browse/mod_auth_ldap/mod_auth_ldap.lua | 11 -- http://code.google.com/p/prosody-modules/source/browse/mod_auth_ldap/mod_auth_ldap.lua |
12 -- adapted to use common LDAP store | 12 -- adapted to use common LDAP store |
13 | 13 |
14 local ldap = module:require 'ldap'; | 14 local ldap = module:require 'ldap'; |
15 local new_sasl = require 'util.sasl'.new; | 15 local new_sasl = require 'util.sasl'.new; |
16 local nodeprep = require 'util.encodings'.stringprep.nodeprep; | |
17 local jsplit = require 'util.jid'.split; | 16 local jsplit = require 'util.jid'.split; |
18 | 17 |
19 if not ldap then | 18 if not ldap then |
20 return; | 19 return; |
21 end | 20 end |
50 end | 49 end |
51 | 50 |
52 function provider.get_sasl_handler() | 51 function provider.get_sasl_handler() |
53 local testpass_authentication_profile = { | 52 local testpass_authentication_profile = { |
54 plain_test = function(sasl, username, password, realm) | 53 plain_test = function(sasl, username, password, realm) |
55 local prepped_username = nodeprep(username); | 54 return provider.test_password(username, password), true; |
56 if not prepped_username then | |
57 module:log("debug", "NODEprep failed on username: %s", username); | |
58 return "", nil; | |
59 end | |
60 return provider.test_password(prepped_username, password), true; | |
61 end, | 55 end, |
62 mechanisms = { PLAIN = true }, | 56 mechanisms = { PLAIN = true }, |
63 }; | 57 }; |
64 return new_sasl(module.host, testpass_authentication_profile); | 58 return new_sasl(module.host, testpass_authentication_profile); |
65 end | 59 end |