Skip to content

Commit

Permalink
gpo: add unapply to the gp_sec_ext
Browse files Browse the repository at this point in the history
Signed-off-by: David Mulder <[email protected]>
Reviewed-by: Douglas Bagnall <[email protected]>
Reviewed-by: Aurelien Aptel <[email protected]>
  • Loading branch information
dmulder authored and Aurélien Aptel committed Oct 8, 2018
1 parent cab1650 commit 7d07d8b
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 0 deletions.
18 changes: 18 additions & 0 deletions python/samba/gp_sec_ext.py
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,24 @@ def process_group_policy(self, deleted_gpo_list, changed_gpo_list):
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:
Expand Down
4 changes: 4 additions & 0 deletions python/samba/gpclass.py
Original file line number Diff line number Diff line change
Expand Up @@ -385,6 +385,10 @@ def update_samba(self):
def mapper(self):
pass

def delete(self):
upd_sam, _ = self.mapper().get(self.attribute)
upd_sam(self.val)

@abstractmethod
def __str__(self):
pass
Expand Down

0 comments on commit 7d07d8b

Please sign in to comment.