diff options
author | Jason Gerard DeRose <jderose@redhat.com> | 2009-01-23 12:51:48 -0700 |
---|---|---|
committer | Rob Crittenden <rcritten@redhat.com> | 2009-02-03 15:29:02 -0500 |
commit | 0313f03277cf0b3e3b24019fd22734dab65d4860 (patch) | |
tree | 1143714800efee619cb6e6ec9927158f7c37c57f /ipalib | |
parent | 114b6b8577ca9585efe8914d5fdd739f208d6ba8 (diff) | |
download | freeipa-0313f03277cf0b3e3b24019fd22734dab65d4860.tar.gz freeipa-0313f03277cf0b3e3b24019fd22734dab65d4860.tar.xz freeipa-0313f03277cf0b3e3b24019fd22734dab65d4860.zip |
Added ServiceError (KerberosError) and make rpc.KerbTransport raise it if appropriate
Diffstat (limited to 'ipalib')
-rw-r--r-- | ipalib/errors2.py | 17 | ||||
-rw-r--r-- | ipalib/frontend.py | 5 | ||||
-rw-r--r-- | ipalib/rpc.py | 9 |
3 files changed, 28 insertions, 3 deletions
diff --git a/ipalib/errors2.py b/ipalib/errors2.py index 91b231159..4a6a517dd 100644 --- a/ipalib/errors2.py +++ b/ipalib/errors2.py @@ -410,6 +410,23 @@ class KerberosError(AuthenticationError): errno = 1100 +class ServiceError(KerberosError): + """ + **1101** Raised when service is not found in Kerberos DB. + + For example: + + >>> raise ServiceError(service='HTTP@localhost') + Traceback (most recent call last): + ... + ServiceError: Service 'HTTP@localhost' not found in Kerberos database + + """ + + errno = 1101 + format = _('Service %(service)r not found in Kerberos database') + + ############################################################################## # 2000 - 2999: Authorization errors diff --git a/ipalib/frontend.py b/ipalib/frontend.py index 3665cc0e7..6a7d1719f 100644 --- a/ipalib/frontend.py +++ b/ipalib/frontend.py @@ -98,11 +98,14 @@ class Command(plugable.Plugin): """ params = self.args_options_2_params(*args, **options) self.info( - '%s(%s)', self.name, ', '.join(self._repr_iter(**params)) + 'raw: %s(%s)', self.name, ', '.join(self._repr_iter(**params)) ) params = self.normalize(**params) params = self.convert(**params) params.update(self.get_default(**params)) + self.info( + 'processed: %s(%s)', self.name, ', '.join(self._repr_iter(**params)) + ) self.validate(**params) (args, options) = self.params_2_args_options(**params) result = self.run(*args, **options) diff --git a/ipalib/rpc.py b/ipalib/rpc.py index 55f3ea954..9e7060d28 100644 --- a/ipalib/rpc.py +++ b/ipalib/rpc.py @@ -37,6 +37,7 @@ from xmlrpclib import Binary, Fault, dumps, loads, ServerProxy, SafeTransport import kerberos from ipalib.backend import Backend from ipalib.errors2 import public_errors, PublicError, UnknownError, NetworkError +from ipalib import errors2 from ipalib.request import context @@ -178,7 +179,6 @@ class KerbTransport(SafeTransport): """ def get_host_info(self, host): - (host, extra_headers, x509) = SafeTransport.get_host_info(self, host) # Set the remote host principal @@ -192,7 +192,11 @@ class KerbTransport(SafeTransport): try: kerberos.authGSSClientStep(vc, "") except kerberos.GSSError, e: - raise e # FIXME: raise a PublicError + (major, minor) = e.args + if minor[1] == -1765328377: + raise errors2.ServiceError(service=service) + else: + raise e extra_headers += [ ('Authorization', 'negotiate %s' % kerberos.authGSSClientResponse(vc)) @@ -220,6 +224,7 @@ class xmlclient(Backend): ) ) conn = ServerProxy(self.env.xmlrpc_uri, + transport=KerbTransport(), allow_none=True, encoding='UTF-8', ) |