comparison mod_auth_ldap/mod_auth_ldap.lua @ 1479:9a0a0cfd3710

mod_auth_ldap: Change default for ldap_mode to "bind", everyone seems to be using that
author Kim Alvefur <zash@zash.se>
date Tue, 05 Aug 2014 15:23:35 +0200
parents 099583539e2c
children 5f139770061e
comparison
equal deleted inserted replaced
1478:099583539e2c 1479:9a0a0cfd3710
10 local ldap_password = module:get_option_string("ldap_password", ""); 10 local ldap_password = module:get_option_string("ldap_password", "");
11 local ldap_tls = module:get_option_boolean("ldap_tls"); 11 local ldap_tls = module:get_option_boolean("ldap_tls");
12 local ldap_scope = module:get_option_string("ldap_scope", "onelevel"); 12 local ldap_scope = module:get_option_string("ldap_scope", "onelevel");
13 local ldap_filter = module:get_option_string("ldap_filter", "(uid=$user)"):gsub("%%s", "$user", 1); 13 local ldap_filter = module:get_option_string("ldap_filter", "(uid=$user)"):gsub("%%s", "$user", 1);
14 local ldap_base = assert(module:get_option_string("ldap_base"), "ldap_base is a required option for ldap"); 14 local ldap_base = assert(module:get_option_string("ldap_base"), "ldap_base is a required option for ldap");
15 local ldap_mode = module:get_option_string("ldap_mode", ldap_rootdn == "" and "bind" or "getpasswd"); 15 local ldap_mode = module:get_option_string("ldap_mode", "bind");
16 local host = ldap_filter_escape(module:get_option_string("realm", module.host)); 16 local host = ldap_filter_escape(module:get_option_string("realm", module.host));
17 17
18 -- Initiate connection 18 -- Initiate connection
19 local ld = assert(lualdap.open_simple(ldap_server, ldap_rootdn, ldap_password, ldap_tls)); 19 local ld = assert(lualdap.open_simple(ldap_server, ldap_rootdn, ldap_password, ldap_tls));
20 module.unload = function() ld:close(); end 20 module.unload = function() ld:close(); end