Contents

Function Status

Evaluate return values that most GSS-API functions use to indicate the outcome of an operation.

Overview

The functions of the GSS-API return two status codes. The major status code, delivered as the function’s return value, provides a mechanism-independent status output. A value of GSS_S_COMPLETE typically indicates success, but the code is actually composed of several fields that enable communicating a more nuanced result. Always check the major status code to determine if an operation succeeds.

The minor status code provides additional information, often mechanism-specific, when an operation fails. This result returns using the OM_uint32 pointer given as the function’s first argument. Examine this value to further debug a problem. For example, many functions allocate memory as a side effect of their main task. If memory allocation fails, the entire operation fails. But while the major status indicates a generic problem, a minor status of ENOMEM indicates that failed memory allocation is the exact culprit.

Three bitfields bundled together make up major status codes in a single OM_uint32 value. These fields are:

The calling error

A generic GSS-API error in the most significant 8 bits.

The routine error

An error specific to the routine in the next 8 bits.

Supplementary Information

Additional information about the error in the lower 16 bits.

When a function successfully runs to completion, it returns zero for all of these fields. As a convenience, you can compare the result directly with the status code GSS_S_COMPLETE to test for this condition.

[Image]

For any other result, use one of the available extraction macros (such as GSS_CALLING_ERROR) to obtain a value that you compare against one of the known error codes. For example, you can test for a failure to read one of the function inputs as follows:

OM_uint32 major = <# Some GSS call #>
if (GSS_CALLING_ERROR(major) == GSS_S_CALL_INACCESSIBLE_READ) {
    // Handle the error
}

Use the gss_display_status(_:_:_:_:_:_:) function to retrieve a human readable string corresponding to a given status result.

Topics

Status and Error Creation

Calling Errors

Routine Errors

Masks and Offsets

See Also

Memory and Context