Software /
code /
prosody-modules
Comparison
mod_auth_ldap/mod_auth_ldap.lua @ 1376:f4de4a35778d
mod_auth_ldap: Default to 'bind' mode if rootdn is left empty
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Wed, 02 Apr 2014 13:32:00 +0200 |
parent | 1375:90bde50b3915 |
child | 1478:099583539e2c |
comparison
equal
deleted
inserted
replaced
1375:90bde50b3915 | 1376:f4de4a35778d |
---|---|
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", "getpasswd"); | 15 local ldap_mode = module:get_option_string("ldap_mode", ldap_rootdn == "" and "bind" or "getpasswd"); |
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 |