mirror of
https://salsa.debian.org/freeipa-team/freeipa.git
synced 2025-02-25 18:55:28 -06:00
Don't pass along the kw dictionary we were passed by XML-RPC.
We generally want to just search indexed attributes. We get this list of attributes from the configuration, use it.
This commit is contained in:
parent
af7b5645af
commit
46bd3974af
@ -184,13 +184,14 @@ class group_find(crud.Find):
|
||||
search_fields_conf_str = config.get('ipagroupsearchfields')
|
||||
search_fields = search_fields_conf_str.split(",")
|
||||
|
||||
search_kw = {}
|
||||
for s in search_fields:
|
||||
kw[s] = term
|
||||
search_kw[s] = term
|
||||
|
||||
object_type = ldap.get_object_type("cn")
|
||||
if object_type and not kw.get('objectclass'):
|
||||
kw['objectclass'] = object_type
|
||||
return ldap.search(**kw)
|
||||
search_kw['objectclass'] = object_type
|
||||
return ldap.search(**search_kw)
|
||||
|
||||
def output_for_cli(self, textui, result, uid, **options):
|
||||
counter = result[0]
|
||||
|
@ -229,16 +229,17 @@ class host_find(crud.Find):
|
||||
#search_fields = search_fields_conf_str.split(",")
|
||||
search_fields = ['cn','serverhostname','description','localityname','nshostlocation','nshardwareplatform','nsosversion']
|
||||
|
||||
search_kw = {}
|
||||
for s in search_fields:
|
||||
kw[s] = term
|
||||
search_kw[s] = term
|
||||
|
||||
# Can't use ldap.get_object_type() since cn is also used for group dns
|
||||
kw['objectclass'] = "ipaHost"
|
||||
search_kw['objectclass'] = "ipaHost"
|
||||
if kw.get('all', False):
|
||||
kw['attributes'] = ['*']
|
||||
search_kw['attributes'] = ['*']
|
||||
else:
|
||||
kw['attributes'] = default_attributes
|
||||
return ldap.search(**kw)
|
||||
search_kw['attributes'] = default_attributes
|
||||
return ldap.search(**search_kw)
|
||||
def output_for_cli(self, textui, result, *args, **options):
|
||||
counter = result[0]
|
||||
hosts = result[1:]
|
||||
|
@ -169,11 +169,12 @@ class hostgroup_find(crud.Find):
|
||||
search_fields_conf_str = config.get('ipagroupsearchfields')
|
||||
search_fields = search_fields_conf_str.split(",")
|
||||
|
||||
search_kw = {}
|
||||
for s in search_fields:
|
||||
kw[s] = term
|
||||
search_kw[s] = term
|
||||
|
||||
kw['objectclass'] = hostgroup_filter
|
||||
return ldap.search(**kw)
|
||||
search_kw['objectclass'] = hostgroup_filter
|
||||
return ldap.search(**search_kw)
|
||||
|
||||
def output_for_cli(self, textui, result, *args, **options):
|
||||
counter = result[0]
|
||||
|
@ -149,14 +149,15 @@ class service_find(crud.Find):
|
||||
def execute(self, principal, **kw):
|
||||
ldap = self.api.Backend.ldap
|
||||
|
||||
kw['filter'] = "&(objectclass=krbPrincipalAux)(!(objectClass=posixAccount))(!(|(krbprincipalname=kadmin/*)(krbprincipalname=K/M@*)(krbprincipalname=krbtgt/*)))"
|
||||
kw['krbprincipalname'] = principal
|
||||
search_kw = {}
|
||||
search_kw['filter'] = "&(objectclass=krbPrincipalAux)(!(objectClass=posixAccount))(!(|(krbprincipalname=kadmin/*)(krbprincipalname=K/M@*)(krbprincipalname=krbtgt/*)))"
|
||||
search_kw['krbprincipalname'] = principal
|
||||
|
||||
object_type = ldap.get_object_type("krbprincipalname")
|
||||
if object_type and not kw.get('objectclass'):
|
||||
kw['objectclass'] = object_type
|
||||
search_kw['objectclass'] = object_type
|
||||
|
||||
return ldap.search(**kw)
|
||||
return ldap.search(**search_kw)
|
||||
|
||||
def output_for_cli(self, textui, result, *args, **options):
|
||||
counter = result[0]
|
||||
|
@ -282,17 +282,18 @@ class user_find(crud.Find):
|
||||
search_fields_conf_str = config.get('ipausersearchfields')
|
||||
search_fields = search_fields_conf_str.split(",")
|
||||
|
||||
search_kw = {}
|
||||
for s in search_fields:
|
||||
kw[s] = term
|
||||
search_kw[s] = term
|
||||
|
||||
object_type = ldap.get_object_type("uid")
|
||||
if object_type and not kw.get('objectclass'):
|
||||
kw['objectclass'] = object_type
|
||||
search_kw['objectclass'] = object_type
|
||||
if kw.get('all', False):
|
||||
kw['attributes'] = ['*']
|
||||
search_kw['attributes'] = ['*']
|
||||
else:
|
||||
kw['attributes'] = default_attributes
|
||||
return ldap.search(**kw)
|
||||
search_kw['attributes'] = default_attributes
|
||||
return ldap.search(**search_kw)
|
||||
|
||||
def output_for_cli(self, textui, result, uid, **options):
|
||||
counter = result[0]
|
||||
|
Loading…
Reference in New Issue
Block a user