summaryrefslogtreecommitdiff
path: root/source4/scripting
diff options
context:
space:
mode:
authorJean Raby <jraby@inverse.ca>2013-04-10 21:33:34 -0400
committerAndrew Bartlett <abartlet@samba.org>2013-04-11 06:06:03 +0200
commitafd291b1dee44b2400bed119bccfc0b722d8cc9c (patch)
tree47637e80baed35b3c1f8a5b57f783eb0beb111cd /source4/scripting
parent8aae8b5bad167ac732b7f8949dfb40aebb2f26a9 (diff)
downloadsamba-afd291b1dee44b2400bed119bccfc0b722d8cc9c.tar.gz
samba-afd291b1dee44b2400bed119bccfc0b722d8cc9c.tar.bz2
samba-afd291b1dee44b2400bed119bccfc0b722d8cc9c.zip
Avoid leaking temp file if an exception is raised
Reviewed-by: Andrew Bartlett <abartlet@samba.org> Autobuild-User(master): Andrew Bartlett <abartlet@samba.org> Autobuild-Date(master): Thu Apr 11 06:06:03 CEST 2013 on sn-devel-104
Diffstat (limited to 'source4/scripting')
-rwxr-xr-xsource4/scripting/bin/samba_dnsupdate6
1 files changed, 5 insertions, 1 deletions
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):