mirror of
https://salsa.debian.org/freeipa-team/freeipa.git
synced 2026-10-25 14:40:16 -05:00
ldap2.find_entries: Do not modify attrs_list in-place
dap2.find_entries modified the passed in attrs_list to remove
the virtual attributes memberindirect and memberofindirect
before passing the list to LDAP. This means that a call like
ldap2.get_entry(dn, attrs_list=some_framework_object.default_attributes)
would permanently remove the virtual attributes from
some_framework_object's definition.
Create a copy of the list instead.
https://fedorahosted.org/freeipa/ticket/4349
Reviewed-By: Jan Cholasta <jcholast@redhat.com>
This commit is contained in:
1 parent
193ced0bd7
commit
988b2cebf4
1 file changed
+9
-6
@@ -186,12 +186,15 @@ class ldap2(LDAPClient, CrudBackend):
|
||||
has_memberindirect = False
|
||||
has_memberofindirect = False
|
||||
if attrs_list:
|
||||
if 'memberindirect' in attrs_list:
|
||||
has_memberindirect = True
|
||||
attrs_list.remove('memberindirect')
|
||||
if 'memberofindirect' in attrs_list:
|
||||
has_memberofindirect = True
|
||||
attrs_list.remove('memberofindirect')
|
||||
new_attrs_list = []
|
||||
for attr_name in attrs_list:
|
||||
if attr_name == 'memberindirect':
|
||||
has_memberindirect = True
|
||||
elif attr_name == 'memberofindirect':
|
||||
has_memberofindirect = True
|
||||
else:
|
||||
new_attrs_list.append(attr_name)
|
||||
attrs_list = new_attrs_list
|
||||
|
||||
res, truncated = super(ldap2, self).find_entries(
|
||||
filter=filter, attrs_list=attrs_list, base_dn=base_dn, scope=scope,
|
||||
|
||||
Reference in new issue
Block a user