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

gpo: Sudoers ext should not crash if policy missing

If a user has manually removed a policy, the
extension should not crash in an unapply removing
it.

Signed-off-by: David Mulder <dmulder@suse.com>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
This commit is contained in:
David Mulder 2020-08-07 13:44:55 -06:00 committed by David Mulder
parent 87fe86270e
commit 8626910c0e

View File

@ -51,7 +51,8 @@ class gp_sudoers_ext(gp_pol_ext):
self.gp_db.set_guid(guid)
if str(self) in settings:
for attribute, sudoers in settings[str(self)].items():
os.unlink(sudoers)
if os.path.exists(sudoers):
os.unlink(sudoers)
self.gp_db.delete(str(self), attribute)
self.gp_db.commit()