Index: head/lib/libgssapi/gss_display_status.c =================================================================== --- head/lib/libgssapi/gss_display_status.c +++ head/lib/libgssapi/gss_display_status.c @@ -92,6 +92,7 @@ * SUCH DAMAGE. */ +#include #include #include #include @@ -105,17 +106,15 @@ calling_error(OM_uint32 v) { static const char *msgs[] = { - NULL, /* 0 */ - "A required input parameter could not be read.", /* */ - "A required output parameter could not be written.", /* */ - "A parameter was malformed" + [0] = "", + [1] = "A required input parameter could not be read.", + [2] = "A required output parameter could not be written.", + [3] = "A parameter was malformed", }; v >>= GSS_C_CALLING_ERROR_OFFSET; - if (v == 0) - return ""; - else if (v >= sizeof(msgs)/sizeof(*msgs)) + if (v >= nitems(msgs)) return "unknown calling error"; else return msgs[v]; @@ -125,31 +124,31 @@ routine_error(OM_uint32 v) { static const char *msgs[] = { - "Function completed successfully", /* 0 */ - "An unsupported mechanism was requested", - "An invalid name was supplied", - "A supplied name was of an unsupported type", - "Incorrect channel bindings were supplied", - "An invalid status code was supplied", - "A token had an invalid MIC", - "No credentials were supplied, " - "or the credentials were unavailable or inaccessible.", - "No context has been established", - "A token was invalid", - "A credential was invalid", - "The referenced credentials have expired", - "The context has expired", - "Miscellaneous failure (see text)", - "The quality-of-protection requested could not be provide", - "The operation is forbidden by local security policy", - "The operation or option is not available", - "The requested credential element already exists", - "The provided name was not a mechanism name.", + [0] = "Function completed successfully", + [1] = "An unsupported mechanism was requested", + [2] = "An invalid name was supplied", + [3] = "A supplied name was of an unsupported type", + [4] = "Incorrect channel bindings were supplied", + [5] = "An invalid status code was supplied", + [6] = "A token had an invalid MIC", + [7] = ("No credentials were supplied, " + "or the credentials were unavailable or inaccessible."), + [8] = "No context has been established", + [9] = "A token was invalid", + [10] = "A credential was invalid", + [11] = "The referenced credentials have expired", + [12] = "The context has expired", + [13] = "Miscellaneous failure (see text)", + [14] = "The quality-of-protection requested could not be provide", + [15] = "The operation is forbidden by local security policy", + [16] = "The operation or option is not available", + [17] = "The requested credential element already exists", + [18] = "The provided name was not a mechanism name.", }; v >>= GSS_C_ROUTINE_ERROR_OFFSET; - if (v >= sizeof(msgs)/sizeof(*msgs)) + if (v >= nitems(msgs)) return "unknown routine error"; else return msgs[v]; @@ -159,17 +158,17 @@ supplementary_error(OM_uint32 v) { static const char *msgs[] = { - "normal completion", - "continuation call to routine required", - "duplicate per-message token detected", - "timed-out per-message token detected", - "reordered (early) per-message token detected", - "skipped predecessor token(s) detected" + [0] = "normal completion", + [1] = "continuation call to routine required", + [2] = "duplicate per-message token detected", + [3] = "timed-out per-message token detected", + [4] = "reordered (early) per-message token detected", + [5] = "skipped predecessor token(s) detected", }; v >>= GSS_C_SUPPLEMENTARY_OFFSET; - if (v >= sizeof(msgs)/sizeof(*msgs)) + if (v >= nitems(msgs)) return "unknown routine error"; else return msgs[v];