25 lines
905 B
Diff
25 lines
905 B
Diff
Description: so we don't need to patch pykerberos
|
|
--- a/ipalib/util.py
|
|
+++ b/ipalib/util.py
|
|
@@ -59,15 +59,12 @@ def json_serialize(obj):
|
|
|
|
def get_current_principal():
|
|
try:
|
|
- import kerberos
|
|
- rc, vc = kerberos.authGSSClientInit("notempty")
|
|
- rc = kerberos.authGSSClientInquireCred(vc)
|
|
- username = kerberos.authGSSClientUserName(vc)
|
|
- kerberos.authGSSClientClean(vc)
|
|
- return unicode(username)
|
|
+ # krbV isn't necessarily available on client machines, fail gracefully
|
|
+ import krbV
|
|
+ return unicode(krbV.default_context().default_ccache().principal().name)
|
|
except ImportError:
|
|
- raise RuntimeError('python-kerberos is not available.')
|
|
- except kerberos.GSSError, e:
|
|
+ raise RuntimeError('python-krbV is not available.')
|
|
+ except krbV.Krb5Error:
|
|
#TODO: do a kinit?
|
|
raise errors.CCacheError()
|
|
|