comparison mod_auth_ldap/mod_auth_ldap.lua @ 1375:90bde50b3915

mod_auth_ldap: Limit results in user lookup query to 1
author Kim Alvefur <zash@zash.se>
date Wed, 02 Apr 2014 13:30:53 +0200
parents ab638f6b53dc
children f4de4a35778d
comparison
equal deleted inserted replaced
1374:ab638f6b53dc 1375:90bde50b3915
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 for dn, attr in 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 sizelimit = 1;
27 filter = ldap_filter:gsub("%$(%a+)", { 28 filter = ldap_filter:gsub("%$(%a+)", {
28 user = ldap_filter_escape(username); 29 user = ldap_filter_escape(username);
29 host = host; 30 host = host;
30 }); 31 });
31 }) do return dn, attr; end 32 }) do return dn, attr; end