diff options
author | Tomas Babej <tbabej@redhat.com> | 2015-11-23 12:47:56 +0100 |
---|---|---|
committer | Tomas Babej <tbabej@redhat.com> | 2015-11-25 13:51:10 +0100 |
commit | 1904d7cc3ab33046428dbdcb7c6f521f9e083287 (patch) | |
tree | 1849f7d7266dd47f250608b65f876f4dd3458f5f | |
parent | 6eeb4e4f2a9fb6fe5cf83e6b84c737ad3e295de1 (diff) | |
download | freeipa-1904d7cc3ab33046428dbdcb7c6f521f9e083287.tar.gz freeipa-1904d7cc3ab33046428dbdcb7c6f521f9e083287.tar.xz freeipa-1904d7cc3ab33046428dbdcb7c6f521f9e083287.zip |
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 <jcholast@redhat.com>
-rw-r--r-- | ipapython/ipautil.py | 2 |
1 files changed, 1 insertions, 1 deletions
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) |