From 1904d7cc3ab33046428dbdcb7c6f521f9e083287 Mon Sep 17 00:00:00 2001 From: Tomas Babej Date: Mon, 23 Nov 2015 12:47:56 +0100 Subject: private_ccache: Harden the removal of KRB5CCNAME env variable If the code within the private_ccache contextmanager does not set/removes the KRB5CCNAME, the pop method will raise KeyError, which will cause unnecessary termination of the code flow. Make sure the KRB5CCNAME is popped out of os.environ only if present. Reviewed-By: Jan Cholasta --- ipapython/ipautil.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'ipapython') diff --git a/ipapython/ipautil.py b/ipapython/ipautil.py index 4acdd1a98..a5545688d 100644 --- a/ipapython/ipautil.py +++ b/ipapython/ipautil.py @@ -1367,7 +1367,7 @@ def private_ccache(path=None): if original_value is not None: os.environ['KRB5CCNAME'] = original_value else: - os.environ.pop('KRB5CCNAME') + os.environ.pop('KRB5CCNAME', None) if os.path.exists(path): os.remove(path) -- cgit