diff options
author | Jan Cholasta <jcholast@redhat.com> | 2015-11-18 08:34:35 +0100 |
---|---|---|
committer | Jan Cholasta <jcholast@redhat.com> | 2015-12-07 08:14:13 +0100 |
commit | 662158b781f11ac3b323142ab4cc71f7e4e23451 (patch) | |
tree | 6eff466247b8effa6e9fc298bbfdc888dd39959f /ipapython/ipautil.py | |
parent | e137f305edf2a107b06a00b05b06464b8707ab82 (diff) | |
download | freeipa-662158b781f11ac3b323142ab4cc71f7e4e23451.tar.gz freeipa-662158b781f11ac3b323142ab4cc71f7e4e23451.tar.xz freeipa-662158b781f11ac3b323142ab4cc71f7e4e23451.zip |
ipautil: use file in a temporary dir as ccache in private_ccache
python-gssapi chokes on empty ccache files, so instead of creating an empty
temporary ccache file in private_ccache, create a temporary directory and
use a non-existent file in that directory as the ccache.
https://fedorahosted.org/freeipa/ticket/5401
Reviewed-By: Martin Basti <mbasti@redhat.com>
Reviewed-By: Simo Sorce <ssorce@redhat.com>
Diffstat (limited to 'ipapython/ipautil.py')
-rw-r--r-- | ipapython/ipautil.py | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/ipapython/ipautil.py b/ipapython/ipautil.py index 104f9d180..89047b2e8 100644 --- a/ipapython/ipautil.py +++ b/ipapython/ipautil.py @@ -1345,8 +1345,10 @@ def posixify(string): def private_ccache(path=None): if path is None: - (desc, path) = tempfile.mkstemp(prefix='krbcc') - os.close(desc) + dir_path = tempfile.mkdtemp(prefix='krbcc') + path = os.path.join(dir_path, 'ccache') + else: + dir_path = None original_value = os.environ.get('KRB5CCNAME', None) @@ -1362,6 +1364,11 @@ def private_ccache(path=None): if os.path.exists(path): os.remove(path) + if dir_path is not None: + try: + os.rmdir(dir_path) + except OSError: + pass if six.PY2: |