mirror of
https://salsa.debian.org/freeipa-team/freeipa.git
synced 2025-01-27 00:26:33 -06:00
Ensure list of attrs to retrieve is unique, optimize getting indirect members
This fixes search where we were asking for the member attribute 10 or more times. When retrieving indirect members make sure we always pass around the size and time limits so we don't have to look it up with every call to find_entries() ticket 557
This commit is contained in:
parent
bfb3e46996
commit
4f6d83e9e5
@ -528,6 +528,9 @@ class ldap2(CrudBackend, Encoder):
|
||||
if not isinstance(time_limit, float):
|
||||
time_limit = float(time_limit)
|
||||
|
||||
if attrs_list:
|
||||
attrs_list = list(set(attrs_list))
|
||||
|
||||
# pass arguments to python-ldap
|
||||
try:
|
||||
id = self.conn.search_ext(
|
||||
@ -850,12 +853,14 @@ class ldap2(CrudBackend, Encoder):
|
||||
# accounts container.
|
||||
try:
|
||||
(results, truncated) = self.find_entries(searchfilter, attr_list,
|
||||
api.env.container_accounts, time_limit=time_limit, size_limit = size_limit, normalize=normalize)
|
||||
api.env.container_accounts, time_limit=time_limit,
|
||||
size_limit=size_limit, normalize=normalize)
|
||||
except errors.NotFound:
|
||||
results = []
|
||||
try:
|
||||
(netresults, truncated) = self.find_entries(searchfilter, attr_list,
|
||||
api.env.container_netgroup, time_limit=time_limit, size_limit = size_limit, normalize=normalize)
|
||||
api.env.container_netgroup, time_limit=time_limit,
|
||||
size_limit=size_limit, normalize=normalize)
|
||||
except errors.NotFound:
|
||||
netresults = []
|
||||
results = results + netresults
|
||||
@ -867,7 +872,8 @@ class ldap2(CrudBackend, Encoder):
|
||||
|
||||
return entries
|
||||
|
||||
(dn, group) = self.get_entry(group_dn, ['dn', 'member'])
|
||||
(dn, group) = self.get_entry(group_dn, ['dn', 'member'],
|
||||
size_limit=size_limit, time_limit=time_limit)
|
||||
real_members = group.get('member')
|
||||
if isinstance(real_members, basestring):
|
||||
real_members = [real_members]
|
||||
|
Loading…
Reference in New Issue
Block a user