Changeset View
Changeset View
Standalone View
Standalone View
head/lib/libgssapi/gss_display_status.c
Show First 20 Lines • Show All 86 Lines • ▼ Show 20 Lines | |||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | ||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | ||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | ||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | ||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | ||||
* SUCH DAMAGE. | * SUCH DAMAGE. | ||||
*/ | */ | ||||
#include <sys/param.h> | |||||
#include <gssapi/gssapi.h> | #include <gssapi/gssapi.h> | ||||
#include <stdio.h> | #include <stdio.h> | ||||
#include <string.h> | #include <string.h> | ||||
#include <stdlib.h> | #include <stdlib.h> | ||||
#include <errno.h> | #include <errno.h> | ||||
#include "mech_switch.h" | #include "mech_switch.h" | ||||
#include "utils.h" | #include "utils.h" | ||||
static const char * | static const char * | ||||
calling_error(OM_uint32 v) | calling_error(OM_uint32 v) | ||||
{ | { | ||||
static const char *msgs[] = { | static const char *msgs[] = { | ||||
NULL, /* 0 */ | [0] = "", | ||||
"A required input parameter could not be read.", /* */ | [1] = "A required input parameter could not be read.", | ||||
"A required output parameter could not be written.", /* */ | [2] = "A required output parameter could not be written.", | ||||
"A parameter was malformed" | [3] = "A parameter was malformed", | ||||
}; | }; | ||||
v >>= GSS_C_CALLING_ERROR_OFFSET; | v >>= GSS_C_CALLING_ERROR_OFFSET; | ||||
if (v == 0) | if (v >= nitems(msgs)) | ||||
return ""; | |||||
else if (v >= sizeof(msgs)/sizeof(*msgs)) | |||||
return "unknown calling error"; | return "unknown calling error"; | ||||
else | else | ||||
return msgs[v]; | return msgs[v]; | ||||
} | } | ||||
static const char * | static const char * | ||||
routine_error(OM_uint32 v) | routine_error(OM_uint32 v) | ||||
{ | { | ||||
static const char *msgs[] = { | static const char *msgs[] = { | ||||
"Function completed successfully", /* 0 */ | [0] = "Function completed successfully", | ||||
"An unsupported mechanism was requested", | [1] = "An unsupported mechanism was requested", | ||||
"An invalid name was supplied", | [2] = "An invalid name was supplied", | ||||
"A supplied name was of an unsupported type", | [3] = "A supplied name was of an unsupported type", | ||||
"Incorrect channel bindings were supplied", | [4] = "Incorrect channel bindings were supplied", | ||||
"An invalid status code was supplied", | [5] = "An invalid status code was supplied", | ||||
"A token had an invalid MIC", | [6] = "A token had an invalid MIC", | ||||
"No credentials were supplied, " | [7] = ("No credentials were supplied, " | ||||
"or the credentials were unavailable or inaccessible.", | "or the credentials were unavailable or inaccessible."), | ||||
"No context has been established", | [8] = "No context has been established", | ||||
"A token was invalid", | [9] = "A token was invalid", | ||||
"A credential was invalid", | [10] = "A credential was invalid", | ||||
"The referenced credentials have expired", | [11] = "The referenced credentials have expired", | ||||
"The context has expired", | [12] = "The context has expired", | ||||
"Miscellaneous failure (see text)", | [13] = "Miscellaneous failure (see text)", | ||||
"The quality-of-protection requested could not be provide", | [14] = "The quality-of-protection requested could not be provide", | ||||
"The operation is forbidden by local security policy", | [15] = "The operation is forbidden by local security policy", | ||||
"The operation or option is not available", | [16] = "The operation or option is not available", | ||||
"The requested credential element already exists", | [17] = "The requested credential element already exists", | ||||
"The provided name was not a mechanism name.", | [18] = "The provided name was not a mechanism name.", | ||||
}; | }; | ||||
v >>= GSS_C_ROUTINE_ERROR_OFFSET; | v >>= GSS_C_ROUTINE_ERROR_OFFSET; | ||||
if (v >= sizeof(msgs)/sizeof(*msgs)) | if (v >= nitems(msgs)) | ||||
return "unknown routine error"; | return "unknown routine error"; | ||||
else | else | ||||
return msgs[v]; | return msgs[v]; | ||||
} | } | ||||
static const char * | static const char * | ||||
supplementary_error(OM_uint32 v) | supplementary_error(OM_uint32 v) | ||||
{ | { | ||||
static const char *msgs[] = { | static const char *msgs[] = { | ||||
"normal completion", | [0] = "normal completion", | ||||
"continuation call to routine required", | [1] = "continuation call to routine required", | ||||
"duplicate per-message token detected", | [2] = "duplicate per-message token detected", | ||||
"timed-out per-message token detected", | [3] = "timed-out per-message token detected", | ||||
"reordered (early) per-message token detected", | [4] = "reordered (early) per-message token detected", | ||||
"skipped predecessor token(s) detected" | [5] = "skipped predecessor token(s) detected", | ||||
}; | }; | ||||
v >>= GSS_C_SUPPLEMENTARY_OFFSET; | v >>= GSS_C_SUPPLEMENTARY_OFFSET; | ||||
if (v >= sizeof(msgs)/sizeof(*msgs)) | if (v >= nitems(msgs)) | ||||
return "unknown routine error"; | return "unknown routine error"; | ||||
else | else | ||||
return msgs[v]; | return msgs[v]; | ||||
} | } | ||||
#if defined(__NO_TLS) | #if defined(__NO_TLS) | ||||
/* | /* | ||||
▲ Show 20 Lines • Show All 172 Lines • Show Last 20 Lines |