summaryrefslogtreecommitdiffstats
path: root/lite-server.py
diff options
context:
space:
mode:
Diffstat (limited to 'lite-server.py')
-rwxr-xr-xlite-server.py16
1 files changed, 15 insertions, 1 deletions
diff --git a/lite-server.py b/lite-server.py
index 99089b00f..0e867915f 100755
--- a/lite-server.py
+++ b/lite-server.py
@@ -37,13 +37,27 @@ from paste import httpserver
import paste.gzipper
from paste.urlmap import URLMap
from ipalib import api
+from subprocess import check_output, CalledProcessError
+import re
+
+# Ugly hack for test purposes only. GSSAPI has no way to get default ccache
+# name, but we don't need it outside test server
+def get_default_ccache_name():
+ try:
+ out = check_output(['klist'])
+ except CalledProcessError:
+ raise RuntimeError("Default ccache not found. Did you kinit?")
+ match = re.match(r'^Ticket cache:\s*(\S+)', out)
+ if not match:
+ raise RuntimeError("Cannot obtain ccache name")
+ return match.group(1)
class KRBCheater(object):
def __init__(self, app):
self.app = app
self.url = app.url
- self.ccname = api.Backend.krb.default_ccname()
+ self.ccname = get_default_ccache_name()
def __call__(self, environ, start_response):
environ['KRB5CCNAME'] = self.ccname