mirror of
https://salsa.debian.org/freeipa-team/freeipa.git
synced 2025-02-25 18:55:28 -06:00
replica-manage: Properly delete nested entries
Bad ordering of LDAP entries during replica removal resulted in a failure to delete replica and its services from cn=masters,cn=ipa,cn=etc,$SUFFIX. This patch enforces the correct ordering of entries resulting in proper removal of services before the host entry itself. https://fedorahosted.org/freeipa/ticket/5019 Reviewed-By: Martin Babinsky <mbabinsk@redhat.com>
This commit is contained in:
committed by
Petr Vobornik
parent
d0a330aa1c
commit
c5f319d3e8
@@ -1178,7 +1178,7 @@ class ReplicationManager(object):
|
||||
self.suffix, ldap.SCOPE_SUBTREE,
|
||||
filter='(krbprincipalname=*/%s@%s)' % (replica, realm))
|
||||
if entries:
|
||||
entries.sort(key=len, reverse=True)
|
||||
entries.sort(key=lambda x: len(x.dn), reverse=True)
|
||||
for entry in entries:
|
||||
self.conn.delete_entry(entry)
|
||||
except errors.NotFound:
|
||||
@@ -1220,7 +1220,7 @@ class ReplicationManager(object):
|
||||
('cn', 'etc'), self.suffix)
|
||||
entries = self.conn.get_entries(dn, ldap.SCOPE_SUBTREE)
|
||||
if entries:
|
||||
entries.sort(key=len, reverse=True)
|
||||
entries.sort(key=lambda x: len(x.dn), reverse=True)
|
||||
for entry in entries:
|
||||
self.conn.delete_entry(entry)
|
||||
except errors.NotFound:
|
||||
|
||||
Reference in New Issue
Block a user