summaryrefslogtreecommitdiffstats
path: root/ipalib/util.py
diff options
context:
space:
mode:
Diffstat (limited to 'ipalib/util.py')
-rw-r--r--ipalib/util.py13
1 files changed, 8 insertions, 5 deletions
diff --git a/ipalib/util.py b/ipalib/util.py
index fcc4b159..89c06800 100644
--- a/ipalib/util.py
+++ b/ipalib/util.py
@@ -57,12 +57,15 @@ def json_serialize(obj):
def get_current_principal():
try:
- # krbV isn't necessarily available on client machines, fail gracefully
- import krbV
- return unicode(krbV.default_context().default_ccache().principal().name)
+ import kerberos
+ rc, vc = kerberos.authGSSClientInit("notempty")
+ rc = kerberos.authGSSClientInquireCred(vc)
+ username = kerberos.authGSSClientUserName(vc)
+ kerberos.authGSSClientClean(vc)
+ return unicode(username)
except ImportError:
- raise RuntimeError('python-krbV is not available.')
- except krbV.Krb5Error:
+ raise RuntimeError('python-kerberos is not available.')
+ except kerberos.GSSError, e:
#TODO: do a kinit?
raise errors.CCacheError()