From 662158b781f11ac3b323142ab4cc71f7e4e23451 Mon Sep 17 00:00:00 2001 From: Jan Cholasta Date: Wed, 18 Nov 2015 08:34:35 +0100 Subject: 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 Reviewed-By: Simo Sorce --- ipapython/ipautil.py | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'ipapython') 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: -- cgit