summaryrefslogtreecommitdiffstats
path: root/ipaserver/plugins/ldap2.py
diff options
context:
space:
mode:
authorRob Crittenden <rcritten@redhat.com>2010-12-03 17:23:38 -0500
committerRob Crittenden <rcritten@redhat.com>2010-12-06 11:43:56 -0500
commit4f6d83e9e548d55e082d51bdfaa44dd1ecfeb868 (patch)
treecd7cf30cdd09f0a8765e18d63d90fdd1ba9e0c3e /ipaserver/plugins/ldap2.py
parentbfb3e4699643308e4787fd52067b38f1cb278f47 (diff)
downloadfreeipa-4f6d83e9e548d55e082d51bdfaa44dd1ecfeb868.tar.gz
freeipa-4f6d83e9e548d55e082d51bdfaa44dd1ecfeb868.tar.xz
freeipa-4f6d83e9e548d55e082d51bdfaa44dd1ecfeb868.zip
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
Diffstat (limited to 'ipaserver/plugins/ldap2.py')
-rw-r--r--ipaserver/plugins/ldap2.py12
1 files changed, 9 insertions, 3 deletions
diff --git a/ipaserver/plugins/ldap2.py b/ipaserver/plugins/ldap2.py
index cbb8ddb63..39606008e 100644
--- a/ipaserver/plugins/ldap2.py
+++ b/ipaserver/plugins/ldap2.py
@@ -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]