Comparison

mod_auth_ldap/mod_auth_ldap.lua @ 1374:ab638f6b53dc

mod_auth_ldap: Fix issue with some versions of LuaLDAP
author Kim Alvefur <zash@zash.se>
date Tue, 25 Mar 2014 15:11:34 +0100
parent 1287:da2e593317d7
child 1375:90bde50b3915
comparison
equal deleted inserted replaced
1373:985bfc6e8cad 1374:ab638f6b53dc
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
21 21
22 local function get_user(username) 22 local function get_user(username)
23 module:log("debug", "get_user(%q)", username); 23 module:log("debug", "get_user(%q)", username);
24 return ld:search({ 24 for dn, attr in ld:search({
25 base = ldap_base; 25 base = ldap_base;
26 scope = ldap_scope; 26 scope = ldap_scope;
27 filter = ldap_filter:gsub("%$(%a+)", { 27 filter = ldap_filter:gsub("%$(%a+)", {
28 user = ldap_filter_escape(username); 28 user = ldap_filter_escape(username);
29 host = host; 29 host = host;
30 }); 30 });
31 })(); 31 }) do return dn, attr; end
32 end 32 end
33 33
34 local provider = {}; 34 local provider = {};
35 35
36 function provider.create_user(username, password) 36 function provider.create_user(username, password)