1
0
mirror of https://github.com/samba-team/samba.git synced 2024-12-22 13:34:15 +03:00

gpo: avoid quadratic behaviour in guid retrieval

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: David Mulder <dmulder@suse.com>
Reviewed-by: Aurelien Aptel <aaptel@suse.com>
This commit is contained in:
Douglas Bagnall 2018-08-29 16:39:51 +12:00 committed by Aurélien Aptel
parent cc02de6bfa
commit 9d7a0bb3de

View File

@ -244,12 +244,12 @@ class gp_log:
user_obj = self.gpdb.find('user[@name="%s"]' % self.user)
if user_obj is not None:
apply_log = user_obj.find('applylog')
if apply_log is None:
return guids
for i in reversed(range(0, len(apply_log))):
guid_obj = apply_log.find('guid[@count="%d"]' % i)
guid = guid_obj.attrib['value']
guids.append(guid)
if apply_log is not None:
guid_objs = apply_log.findall('guid[@count]')
guids_by_count = [(g.get('count'), g.get('value'))
for g in guid_objs]
guids_by_count.sort(reverse=True)
guids.extend(guid for count, guid in guids_by_count)
return guids
def get_applied_settings(self, guids):