From: David Mulder Date: Fri, 7 Aug 2020 19:44:55 +0000 (-0600) Subject: gpo: Sudoers ext should not crash if policy missing X-Git-Tag: talloc-2.3.2~704 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=8626910c0eaaac57d95d2b2f8583ee0c732d98c6;p=thirdparty%2Fsamba.git 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 Reviewed-by: Douglas Bagnall --- diff --git a/python/samba/gp_sudoers_ext.py b/python/samba/gp_sudoers_ext.py index 673b0e131c6..a693fc960a2 100644 --- a/python/samba/gp_sudoers_ext.py +++ b/python/samba/gp_sudoers_ext.py @@ -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()