comparison mod_auth_ldap/mod_auth_ldap.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
parents 881ec9919144
children 8e3420d48508
comparison
equal deleted inserted replaced
901:e3ad5f3aa6d4 902:490cb9161c81
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