changeset 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
parents 90bde50b3915
children 92f3b4d81b52
files mod_auth_ldap/mod_auth_ldap.lua
diffstat 1 files changed, 1 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/mod_auth_ldap/mod_auth_ldap.lua	Wed Apr 02 13:30:53 2014 +0200
+++ b/mod_auth_ldap/mod_auth_ldap.lua	Wed Apr 02 13:32:00 2014 +0200
@@ -12,7 +12,7 @@
 local ldap_scope = module:get_option_string("ldap_scope", "onelevel");
 local ldap_filter = module:get_option_string("ldap_filter", "(uid=$user)"):gsub("%%s", "$user", 1);
 local ldap_base = assert(module:get_option_string("ldap_base"), "ldap_base is a required option for ldap");
-local ldap_mode = module:get_option_string("ldap_mode", "getpasswd");
+local ldap_mode = module:get_option_string("ldap_mode", ldap_rootdn == "" and "bind" or "getpasswd");
 local host = ldap_filter_escape(module:get_option_string("realm", module.host));
 
 -- Initiate connection