From 7d07d8bf33754748ccf1703bb4d8564ab062de6c Mon Sep 17 00:00:00 2001 From: David Mulder Date: Thu, 19 Jul 2018 14:10:33 -0600 Subject: [PATCH] gpo: add unapply to the gp_sec_ext Signed-off-by: David Mulder Reviewed-by: Douglas Bagnall Reviewed-by: Aurelien Aptel --- python/samba/gp_sec_ext.py | 18 ++++++++++++++++++ python/samba/gpclass.py | 4 ++++ 2 files changed, 22 insertions(+) diff --git a/python/samba/gp_sec_ext.py b/python/samba/gp_sec_ext.py index 55f71b74565..fcde46808c8 100644 --- a/python/samba/gp_sec_ext.py +++ b/python/samba/gp_sec_ext.py @@ -165,6 +165,24 @@ class gp_sec_ext(gp_inf_ext): return inf_file = 'MACHINE/Microsoft/Windows NT/SecEdit/GptTmpl.inf' apply_map = self.apply_map() + for gpo in deleted_gpo_list: + self.gp_db.set_guid(gpo[0]) + for section in gpo[1].keys(): + current_section = apply_map.get(section) + if not current_section: + continue + for key, value in gpo[1][section].items(): + setter = None + for _, tup in current_section.items(): + if tup[0] == key: + setter = tup[1] + if setter: + value = value.encode('ascii', 'ignore') \ + if value else value + setter(self.logger, self.gp_db, self.lp, self.creds, + key, value).delete() + self.gp_db.delete(section, key) + self.gp_db.commit() for gpo in changed_gpo_list: if gpo.file_sys_path: diff --git a/python/samba/gpclass.py b/python/samba/gpclass.py index 922b800d3db..13d6d8e25d7 100644 --- a/python/samba/gpclass.py +++ b/python/samba/gpclass.py @@ -385,6 +385,10 @@ class gp_ext_setter(object): def mapper(self): pass + def delete(self): + upd_sam, _ = self.mapper().get(self.attribute) + upd_sam(self.val) + @abstractmethod def __str__(self): pass -- 2.11.4.GIT