diff mod_lib_ldap/ldap.lib.lua @ 877:cd2262969d2e

Make sure we use the user filter for bind
author Rob Hoelz <rob@hoelz.ro>
date Mon, 10 Dec 2012 22:35:17 +0100
parents e4a03e58f896
children 66b3085ecc49
line wrap: on
line diff
--- a/mod_lib_ldap/ldap.lib.lua	Mon Dec 10 22:35:00 2012 +0100
+++ b/mod_lib_ldap/ldap.lib.lua	Mon Dec 10 22:35:17 2012 +0100
@@ -177,9 +177,14 @@
 
 -- XXX consider renaming this...it doesn't bind the current connection
 function _M.bind(username, password)
-    local conn         = _M.getconnection();
-    local filter       = format('%s=%s', params.user.usernamefield, username);
-    local who          = _M.singlematch {
+    local conn   = _M.getconnection();
+    local filter = format('%s=%s', params.user.usernamefield, username);
+
+    if filter then
+        filter = _M.filter.combine_and(filter, params.user.filter);
+    end
+
+    local who = _M.singlematch {
         attrs     = params.user.usernamefield,
         base      = params.user.basedn,
         filter    = filter,