]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
gpo: Don't duplicate guids in the apply log
authorDavid Mulder <dmulder@suse.com>
Tue, 15 May 2018 14:37:08 +0000 (08:37 -0600)
committerAndrew Bartlett <abartlet@samba.org>
Thu, 12 Jul 2018 20:11:23 +0000 (22:11 +0200)
Signed-off-by: David Mulder <dmulder@suse.com>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
python/samba/gpclass.py

index 391f4345f9713d274d0a6264c19a9cfe4aa1a7e0..70ab2612f275e3fac499f2a3070b16c5b5bc8f56 100644 (file)
@@ -139,9 +139,11 @@ class gp_log:
             apply_log = user_obj.find('applylog')
             if apply_log is None:
                 apply_log = etree.SubElement(user_obj, 'applylog')
-            item = etree.SubElement(apply_log, 'guid')
-            item.attrib['count'] = '%d' % (len(apply_log)-1)
-            item.attrib['value'] = guid
+            prev = apply_log.find('guid[@value="%s"]' % guid)
+            if prev is None:
+                item = etree.SubElement(apply_log, 'guid')
+                item.attrib['count'] = '%d' % (len(apply_log)-1)
+                item.attrib['value'] = guid
 
     def apply_log_pop(self):
         ''' Pop a GPO guid from the applylog