mirror of
https://salsa.debian.org/freeipa-team/freeipa.git
synced 2026-08-25 20:58:09 -05:00
Performace: don't download password attributes in host/user-find
For each entry in user/host-find was executed an extra search for password attributes what has significant impact on performance (for 2000 users there were 2000 additional searches) http://www.freeipa.org/page/V4/Performance_Improvements https://fedorahosted.org/freeipa/ticket/5281 Reviewed-By: David Kupka <dkupka@redhat.com>
This commit is contained in:
@@ -617,7 +617,6 @@ class baseuser_find(LDAPSearch):
|
||||
|
||||
def post_common_callback(self, ldap, entries, lockout=False, **options):
|
||||
for attrs in entries:
|
||||
self.obj.get_password_attributes(ldap, attrs.dn, attrs)
|
||||
self.obj.convert_usercertificate_post(attrs, **options)
|
||||
if (lockout):
|
||||
attrs['nsaccountlock'] = True
|
||||
|
||||
@@ -1024,12 +1024,7 @@ class host_find(LDAPSearch):
|
||||
set_certificate_attrs(entry_attrs)
|
||||
set_kerberos_attrs(entry_attrs, options)
|
||||
rename_ipaallowedtoperform_from_ldap(entry_attrs, options)
|
||||
self.obj.get_password_attributes(ldap, entry_attrs.dn, entry_attrs)
|
||||
self.obj.suppress_netgroup_memberof(ldap, entry_attrs)
|
||||
if entry_attrs['has_password']:
|
||||
# If an OTP is set there is no keytab, at least not one
|
||||
# fetched anywhere.
|
||||
entry_attrs['has_keytab'] = False
|
||||
|
||||
if options.get('all', False):
|
||||
entry_attrs['managing'] = self.obj.get_managed_hosts(entry_attrs.dn)
|
||||
|
||||
@@ -416,7 +416,7 @@ class TestManagedHosts(XMLRPC_test):
|
||||
count=1,
|
||||
truncated=False,
|
||||
summary=u'1 host matched',
|
||||
result=[host.filter_attrs(host.retrieve_keys)],
|
||||
result=[host.filter_attrs(host.find_keys)],
|
||||
), result)
|
||||
|
||||
def search_man_hosts(self, host1, host2):
|
||||
|
||||
@@ -42,6 +42,8 @@ class HostTracker(Tracker):
|
||||
update_keys = retrieve_keys - {'dn'}
|
||||
managedby_keys = retrieve_keys - {'has_keytab', 'has_password'}
|
||||
allowedto_keys = retrieve_keys - {'has_keytab', 'has_password'}
|
||||
find_keys = retrieve_keys - {'has_keytab', 'has_password'}
|
||||
find_all_keys = retrieve_all_keys - {'has_keytab', 'has_password'}
|
||||
|
||||
def __init__(self, name, fqdn=None, default_version=None):
|
||||
super(HostTracker, self).__init__(default_version=default_version)
|
||||
@@ -136,9 +138,9 @@ class HostTracker(Tracker):
|
||||
def check_find(self, result, all=False, raw=False):
|
||||
"""Check `host_find` command result"""
|
||||
if all:
|
||||
expected = self.filter_attrs(self.retrieve_all_keys)
|
||||
expected = self.filter_attrs(self.find_all_keys)
|
||||
else:
|
||||
expected = self.filter_attrs(self.retrieve_keys)
|
||||
expected = self.filter_attrs(self.find_keys)
|
||||
assert_deepequal(dict(
|
||||
count=1,
|
||||
truncated=False,
|
||||
|
||||
@@ -51,8 +51,12 @@ class UserTracker(Tracker):
|
||||
update_keys = retrieve_keys - {u'dn'}
|
||||
activate_keys = retrieve_keys
|
||||
|
||||
find_keys = retrieve_keys - {u'mepmanagedentry', u'memberof_group'}
|
||||
find_all_keys = retrieve_all_keys
|
||||
find_keys = retrieve_keys - {
|
||||
u'mepmanagedentry', u'memberof_group', u'has_keytab', u'has_password'
|
||||
}
|
||||
find_all_keys = retrieve_all_keys - {
|
||||
u'has_keytab', u'has_password'
|
||||
}
|
||||
|
||||
primary_keys = {u'uid', u'dn'}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user