Skip to content

docs/add specific errors #44

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Feb 11, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 34 additions & 0 deletions gssapi/creds.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,13 @@ def __new__(cls, base=None, token=None, name=None, lifetime=None,

Otherwise, the credentials are acquired as per the
:meth:`acquire` method.

Raises:
BadMechanismError
BadNameTypeError
BadNameError
ExpiredCredentialsError
MissingCredentialsError
"""

# TODO(directxman12): this is missing support for password
Expand Down Expand Up @@ -119,6 +126,13 @@ def acquire(cls, name=None, lifetime=None, mechs=None, usage='both',
Returns:
AcquireCredResult: the acquired credentials and information about
them

Raises:
BadMechanismError
BadNameTypeError
BadNameError
ExpiredCredentialsError
MissingCredentialsError
"""

if store is None:
Expand Down Expand Up @@ -161,6 +175,13 @@ def store(self, store=None, usage='both', mech=None,

Returns:
StoreCredResult: the results of the credential storing operation

Raises:
GSSError
ExpiredCredentialsError
MissingCredentialsError
OperationUnavailableError
DuplicateCredentialsElementError
"""

if store is None:
Expand Down Expand Up @@ -227,6 +248,11 @@ def inquire(self, name=True, lifetime=True, usage=True, mechs=True):
Returns:
InquireCredResult: the information about the credentials,
with None used when the corresponding argument was False

Raises:
MissingCredentialsError
InvalidCredentialsError
ExpiredCredentialsError
"""

res = rcreds.inquire_cred(self, name, lifetime, usage, mechs)
Expand Down Expand Up @@ -319,6 +345,14 @@ def add(self, name, mech, usage='both',
Returns:
Credentials: the credentials set containing the current credentials
and the newly acquired ones.

Raises:
BadMechanismError
BadNameTypeError
BadNameError
DuplicateCredentialsElementError
ExpiredCredentialsError
MissingCredentialsError
"""

if store is not None and impersonator is not None:
Expand Down
15 changes: 15 additions & 0 deletions gssapi/names.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,11 @@ def __new__(cls, base=None, name_type=None, token=None):

Otherwise, a new name will be created, using the `base` argument as
the string and the `name_type` argument to denote the name type.

Raises:
BadNameTypeError
BadNameError
BadMechanismError
"""

if token is not None:
Expand Down Expand Up @@ -95,6 +100,11 @@ def export(self):

Returns:
bytes: the exported name in token form

Raises:
MechanismNameRequiredError
BadNameTypeError
BadNameError
"""

return rname.export_name(self)
Expand All @@ -110,6 +120,11 @@ def canonicalize(self, mech):

Returns:
Name: the canonicalized name

Raises:
BadMechanismError
BadNameTypeError
BadNameError
"""

return type(self)(rname.canonicalize_name(self, mech))
Expand Down
23 changes: 17 additions & 6 deletions gssapi/raw/creds.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,11 @@ def acquire_cred(Name name=None, lifetime=None, mechs=None, usage='both'):
indefinite or not supported)

Raises:
GSSError
BadMechanismError
BadNameTypeError
BadNameError
ExpiredCredentialsError
MissingCredentialsError
"""

cdef gss_OID_set desired_mechs
Expand Down Expand Up @@ -163,7 +167,7 @@ def release_cred(Creds creds not None):
creds (Creds): the credentials in question

Raises:
GSSError
MissingCredentialsError
"""

cdef OM_uint32 maj_stat, min_stat
Expand Down Expand Up @@ -202,8 +206,12 @@ def add_cred(Creds input_cred, Name name not None, OID mech not None,
be set to None if mutate_input is set to True.

Raises:
GSSError

BadMechanismError
BadNameTypeError
BadNameError
DuplicateCredentialsElementError
ExpiredCredentialsError
MissingCredentialsError
"""
cdef gss_cred_usage_t c_usage
if usage == 'initiate':
Expand Down Expand Up @@ -272,7 +280,9 @@ def inquire_cred(Creds creds not None, name=True, lifetime=True, usage=True,
with unused fields set to None

Raises:
GSSError
MissingCredentialsError
InvalidCredentialsError
ExpiredCredentialsError
"""

# TODO(directxman12): add docs
Expand Down Expand Up @@ -351,7 +361,8 @@ def inquire_cred_by_mech(Creds creds not None, OID mech not None,
with unused fields set to None

Raises:
GSSError
MissingCredentialsError
InvalidCredentialsError
"""

# TODO(directxman12): add docs
Expand Down
4 changes: 4 additions & 0 deletions gssapi/raw/ext_rfc5588.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,10 @@ def store_cred(Creds creds not None, usage='both', OID mech=None,

Raises:
GSSError
ExpiredCredentialsError
MissingCredentialsError
OperationUnavailableError
DuplicateCredentialsElementError
"""
cdef gss_OID desired_mech
if mech is not None:
Expand Down
30 changes: 25 additions & 5 deletions gssapi/raw/message.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,9 @@ def get_mic(SecurityContext context not None, message, qop=None):
bytes: the generated MIC token

Raises:
GSSError
ExpiredContextError
MissingContextError
BadQoPError
"""

cdef gss_buffer_desc message_buffer = gss_buffer_desc(len(message),
Expand Down Expand Up @@ -104,7 +106,14 @@ def verify_mic(SecurityContext context not None, message, token):
int: the QoP used.

Raises:
GSSError
InvalidTokenError
BadMICError
DuplicateTokenError
ExpiredTokenError
TokenTooLateError
TokenTooEarlyError
ExpiredContextError
MissingContextError
"""

cdef gss_buffer_desc message_buffer = gss_buffer_desc(len(message),
Expand Down Expand Up @@ -144,7 +153,9 @@ def wrap_size_limit(SecurityContext context not None, OM_uint32 output_size,
int: the maximum unencrypted/unwrapped message size

Raises:
GSSError
MissingContextError
ExpiredContextError
BadQoPError
"""

cdef int conf_req = confidential
Expand Down Expand Up @@ -185,7 +196,9 @@ def wrap(SecurityContext context not None, message, confidential=True,
encryption was actually used

Raises:
GSSError
ExpiredContextError
MissingContextError
BadQoPError
"""

cdef int conf_req = confidential
Expand Down Expand Up @@ -227,7 +240,14 @@ def unwrap(SecurityContext context not None, message):
encryption was used, and the QoP used

Raises:
GSSError
InvalidTokenError
BadMICError
DuplicateTokenError
ExpiredTokenError
TokenTooLateError
TokenTooEarlyError
ExpiredContextError
MissingContextError
"""

cdef gss_buffer_desc input_buffer = gss_buffer_desc(len(message), message)
Expand Down
21 changes: 14 additions & 7 deletions gssapi/raw/names.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,9 @@ def import_name(name not None, OID name_type=None):
Name: the GSSAPI version of the name

Raises:
GSSError
BadNameTypeError
BadNameError
BadMechanismError
"""

cdef gss_OID nt
Expand Down Expand Up @@ -126,7 +128,7 @@ def display_name(Name name not None, name_type=True):
DisplayNameResult: the text part of the name and its type

Raises:
GSSError
BadNameError
"""

# GSS_C_EMPTY_BUFFER
Expand Down Expand Up @@ -178,7 +180,8 @@ def compare_name(Name name1=None, Name name2=None):
bool: whether or not the names are equal

Raises:
GSSError
BadNameTypeError
BadNameError
"""

# check for either value being None
Expand Down Expand Up @@ -221,7 +224,9 @@ def export_name(Name name not None):
bytes: the exported name

Raises:
GSSError
MechanismNameRequiredError
BadNameTypeError
BadNameError
"""

# GSS_C_EMPTY_BUFFER
Expand Down Expand Up @@ -258,7 +263,9 @@ def canonicalize_name(Name name not None, OID mech not None):
Name: a canonicalized version of the input name

Raises:
GSSError
BadMechanismError
BadNameTypeError
BadNameError
"""

cdef gss_name_t canonicalized_name
Expand Down Expand Up @@ -289,7 +296,7 @@ def duplicate_name(Name name not None):
Name: a duplicate of the input name

Raises:
GSSError
BadNameError
"""

cdef gss_name_t new_name
Expand All @@ -314,7 +321,7 @@ def release_name(Name name not None):
name (Name): the name in question

Raises:
GSSError
BadNameError
"""

cdef OM_uint32 maj_stat, min_stat
Expand Down
Loading