From afd291b1dee44b2400bed119bccfc0b722d8cc9c Mon Sep 17 00:00:00 2001 From: Jean Raby Date: Wed, 10 Apr 2013 21:33:34 -0400 Subject: Avoid leaking temp file if an exception is raised Reviewed-by: Andrew Bartlett Autobuild-User(master): Andrew Bartlett Autobuild-Date(master): Thu Apr 11 06:06:03 CEST 2013 on sn-devel-104 --- source4/scripting/bin/samba_dnsupdate | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'source4/scripting/bin/samba_dnsupdate') diff --git a/source4/scripting/bin/samba_dnsupdate b/source4/scripting/bin/samba_dnsupdate index 33c16ecd00..68b0f72151 100755 --- a/source4/scripting/bin/samba_dnsupdate +++ b/source4/scripting/bin/samba_dnsupdate @@ -116,7 +116,11 @@ def get_credentials(lp): creds.set_machine_account(lp) creds.set_krb_forwardable(credentials.NO_KRB_FORWARDABLE) (tmp_fd, ccachename) = tempfile.mkstemp() - creds.get_named_ccache(lp, ccachename) + try: + creds.get_named_ccache(lp, ccachename) + except RuntimeError as e: + os.unlink(ccachename) + raise e class dnsobj(object): -- cgit