changeset 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 512e31cd8b70
children 6b7a2d1a1879
files mod_lib_ldap/ldap.lib.lua
diffstat 1 files changed, 8 insertions(+), 3 deletions(-) [+]
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,