xref: /onnv-gate/usr/src/lib/libgss/g_dsp_status.c (revision 13132:9615cdbf7b70)
10Sstevel@tonic-gate /*
20Sstevel@tonic-gate  * CDDL HEADER START
30Sstevel@tonic-gate  *
40Sstevel@tonic-gate  * The contents of this file are subject to the terms of the
59698SPeter.Shoults@Sun.COM  * Common Development and Distribution License (the "License").
69698SPeter.Shoults@Sun.COM  * You may not use this file except in compliance with the License.
70Sstevel@tonic-gate  *
80Sstevel@tonic-gate  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
90Sstevel@tonic-gate  * or http://www.opensolaris.org/os/licensing.
100Sstevel@tonic-gate  * See the License for the specific language governing permissions
110Sstevel@tonic-gate  * and limitations under the License.
120Sstevel@tonic-gate  *
130Sstevel@tonic-gate  * When distributing Covered Code, include this CDDL HEADER in each
140Sstevel@tonic-gate  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
150Sstevel@tonic-gate  * If applicable, add the following below this CDDL HEADER, with the
160Sstevel@tonic-gate  * fields enclosed by brackets "[]" replaced with your own identifying
170Sstevel@tonic-gate  * information: Portions Copyright [yyyy] [name of copyright owner]
180Sstevel@tonic-gate  *
190Sstevel@tonic-gate  * CDDL HEADER END
200Sstevel@tonic-gate  */
210Sstevel@tonic-gate /*
22*13132SGlenn.Barry@oracle.com  * Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved.
230Sstevel@tonic-gate  */
240Sstevel@tonic-gate 
250Sstevel@tonic-gate /*
260Sstevel@tonic-gate  *  glue routine gss_display_status
270Sstevel@tonic-gate  *
280Sstevel@tonic-gate  */
290Sstevel@tonic-gate 
300Sstevel@tonic-gate #include <mechglueP.h>
31*13132SGlenn.Barry@oracle.com #include "gssapiP_generic.h"
320Sstevel@tonic-gate #include <stdio.h>
330Sstevel@tonic-gate #ifdef HAVE_STDLIB_H
340Sstevel@tonic-gate #include <stdlib.h>
350Sstevel@tonic-gate #endif
360Sstevel@tonic-gate #include <string.h>
370Sstevel@tonic-gate #include <libintl.h>
380Sstevel@tonic-gate #include <errno.h>
39*13132SGlenn.Barry@oracle.com #include <syslog.h>
400Sstevel@tonic-gate #ifndef TEXT_DOMAIN
410Sstevel@tonic-gate #error TEXT_DOMAIN not defined
420Sstevel@tonic-gate #endif
430Sstevel@tonic-gate 
440Sstevel@tonic-gate /* local function */
450Sstevel@tonic-gate static OM_uint32 displayMajor(OM_uint32, OM_uint32 *, gss_buffer_t);
460Sstevel@tonic-gate 
470Sstevel@tonic-gate 
480Sstevel@tonic-gate OM_uint32
gss_display_status(minor_status,status_value,status_type,req_mech_type,message_context,status_string)490Sstevel@tonic-gate gss_display_status(minor_status,
500Sstevel@tonic-gate 			status_value,
510Sstevel@tonic-gate 			status_type,
520Sstevel@tonic-gate 			req_mech_type,
530Sstevel@tonic-gate 			message_context,
540Sstevel@tonic-gate 			status_string)
550Sstevel@tonic-gate 
560Sstevel@tonic-gate OM_uint32 *minor_status;
570Sstevel@tonic-gate OM_uint32 status_value;
580Sstevel@tonic-gate int status_type;
590Sstevel@tonic-gate const gss_OID req_mech_type;
600Sstevel@tonic-gate OM_uint32 *message_context;
610Sstevel@tonic-gate gss_buffer_t status_string;
620Sstevel@tonic-gate {
63*13132SGlenn.Barry@oracle.com 	gss_OID			mech_type = (gss_OID) req_mech_type;
64*13132SGlenn.Barry@oracle.com 	gss_mechanism		mech;
65*13132SGlenn.Barry@oracle.com 	gss_OID_desc		m_oid = { 0, 0 };
660Sstevel@tonic-gate 
679698SPeter.Shoults@Sun.COM 	if (minor_status != NULL)
689698SPeter.Shoults@Sun.COM 		*minor_status = 0;
690Sstevel@tonic-gate 
709698SPeter.Shoults@Sun.COM 	if (status_string != GSS_C_NO_BUFFER) {
719698SPeter.Shoults@Sun.COM 		status_string->length = 0;
729698SPeter.Shoults@Sun.COM 		status_string->value = NULL;
739698SPeter.Shoults@Sun.COM 	}
740Sstevel@tonic-gate 
759698SPeter.Shoults@Sun.COM 	if (minor_status == NULL ||
769698SPeter.Shoults@Sun.COM 	    message_context == NULL ||
779698SPeter.Shoults@Sun.COM 	    status_string == GSS_C_NO_BUFFER)
789698SPeter.Shoults@Sun.COM 		return (GSS_S_CALL_INACCESSIBLE_WRITE);
79*13132SGlenn.Barry@oracle.com 
800Sstevel@tonic-gate 	/* we handle major status codes, and the mechs do the minor */
810Sstevel@tonic-gate 	if (status_type == GSS_C_GSS_CODE)
820Sstevel@tonic-gate 		return (displayMajor(status_value, message_context,
830Sstevel@tonic-gate 				status_string));
840Sstevel@tonic-gate 
850Sstevel@tonic-gate 	/*
860Sstevel@tonic-gate 	 * must be the minor status - let mechs do the work
870Sstevel@tonic-gate 	 * select the appropriate underlying mechanism routine and
880Sstevel@tonic-gate 	 * call it.
890Sstevel@tonic-gate 	 */
90*13132SGlenn.Barry@oracle.com 
91*13132SGlenn.Barry@oracle.com 	/* In this version, we only handle status codes that have been
92*13132SGlenn.Barry@oracle.com 	   mapped to a flat numbering space.  Look up the value we got
93*13132SGlenn.Barry@oracle.com 	   passed.  If it's not found, complain.  */
94*13132SGlenn.Barry@oracle.com 	if (status_value == 0) {
95*13132SGlenn.Barry@oracle.com 		status_string->value = strdup("Unknown error");
96*13132SGlenn.Barry@oracle.com 		if (status_string->value == NULL) {
97*13132SGlenn.Barry@oracle.com 			*minor_status = ENOMEM;
98*13132SGlenn.Barry@oracle.com 			map_errcode(minor_status);
99*13132SGlenn.Barry@oracle.com 			return GSS_S_FAILURE;
100*13132SGlenn.Barry@oracle.com 		}
101*13132SGlenn.Barry@oracle.com 		status_string->length = strlen(status_string->value);
102*13132SGlenn.Barry@oracle.com 		*message_context = 0;
103*13132SGlenn.Barry@oracle.com 		*minor_status = 0;
104*13132SGlenn.Barry@oracle.com 		return GSS_S_COMPLETE;
105*13132SGlenn.Barry@oracle.com 	}
106*13132SGlenn.Barry@oracle.com 	{
107*13132SGlenn.Barry@oracle.com 		int err;
108*13132SGlenn.Barry@oracle.com 	        OM_uint32 m_status = 0, status;
109*13132SGlenn.Barry@oracle.com 
110*13132SGlenn.Barry@oracle.com 		err = gssint_mecherrmap_get(status_value, &m_oid, &m_status);
111*13132SGlenn.Barry@oracle.com 		if (err) {
112*13132SGlenn.Barry@oracle.com 			*minor_status = err;
113*13132SGlenn.Barry@oracle.com 			map_errcode(minor_status);
114*13132SGlenn.Barry@oracle.com 			return GSS_S_BAD_STATUS;
115*13132SGlenn.Barry@oracle.com 		}
116*13132SGlenn.Barry@oracle.com 
117*13132SGlenn.Barry@oracle.com 		if (m_oid.length == 0) {
118*13132SGlenn.Barry@oracle.com 			/* Magic flag for com_err values.  */
119*13132SGlenn.Barry@oracle.com 			status = gssint_g_display_com_err_status(minor_status,
120*13132SGlenn.Barry@oracle.com 							m_status,
121*13132SGlenn.Barry@oracle.com 							status_string);
122*13132SGlenn.Barry@oracle.com 			if (status != GSS_S_COMPLETE)
123*13132SGlenn.Barry@oracle.com 				map_errcode(minor_status);
124*13132SGlenn.Barry@oracle.com 			return status;
125*13132SGlenn.Barry@oracle.com 		}
126*13132SGlenn.Barry@oracle.com 		mech_type = &m_oid;
127*13132SGlenn.Barry@oracle.com 		status_value = m_status;
128*13132SGlenn.Barry@oracle.com 	}
129*13132SGlenn.Barry@oracle.com 
1300Sstevel@tonic-gate 	mech = __gss_get_mechanism(mech_type);
1310Sstevel@tonic-gate 
1320Sstevel@tonic-gate 	if (mech && mech->gss_display_status) {
133*13132SGlenn.Barry@oracle.com 		OM_uint32 r;
134*13132SGlenn.Barry@oracle.com 
1350Sstevel@tonic-gate 		if (mech_type == GSS_C_NULL_OID)
1360Sstevel@tonic-gate 			mech_type = &mech->mech_type;
1370Sstevel@tonic-gate 
138*13132SGlenn.Barry@oracle.com 		r = mech->gss_display_status(mech->context, minor_status,
1390Sstevel@tonic-gate 				status_value, status_type, mech_type,
140*13132SGlenn.Barry@oracle.com 				message_context, status_string);
141*13132SGlenn.Barry@oracle.com 		/* How's this for weird?  If we get an error returning the
142*13132SGlenn.Barry@oracle.com 		mechanism-specific error code, we save away the
143*13132SGlenn.Barry@oracle.com 		mechanism-specific error code describing the error.  */
144*13132SGlenn.Barry@oracle.com 		if (r != GSS_S_COMPLETE)
145*13132SGlenn.Barry@oracle.com 			map_error(minor_status, mech);
146*13132SGlenn.Barry@oracle.com 		return r;
1470Sstevel@tonic-gate 	}
1480Sstevel@tonic-gate 
1490Sstevel@tonic-gate 	if (!mech)
1500Sstevel@tonic-gate 		return (GSS_S_BAD_MECH);
1510Sstevel@tonic-gate 
1520Sstevel@tonic-gate 	return (GSS_S_UNAVAILABLE);
1530Sstevel@tonic-gate } /* gss_display_status */
1540Sstevel@tonic-gate 
1550Sstevel@tonic-gate 
1560Sstevel@tonic-gate /*
1570Sstevel@tonic-gate  * function to map the major error codes
1580Sstevel@tonic-gate  * it uses case statements so that the strings could be wrapped by gettext
1590Sstevel@tonic-gate  * msgCtxt is interpreted as:
1600Sstevel@tonic-gate  *	0 - first call
1610Sstevel@tonic-gate  *	1 - routine error
1620Sstevel@tonic-gate  *	>= 2 - the supplementary error code bit shifted by 1
1630Sstevel@tonic-gate  */
1640Sstevel@tonic-gate static OM_uint32
displayMajor(status,msgCtxt,outStr)1650Sstevel@tonic-gate displayMajor(status, msgCtxt, outStr)
1660Sstevel@tonic-gate OM_uint32 status;
1670Sstevel@tonic-gate OM_uint32 *msgCtxt;
1680Sstevel@tonic-gate gss_buffer_t outStr;
1690Sstevel@tonic-gate {
1700Sstevel@tonic-gate 	OM_uint32 oneVal, mask = 0x1, currErr;
1710Sstevel@tonic-gate 	char *errStr = NULL;
1720Sstevel@tonic-gate 	int i, haveErr = 0;
1730Sstevel@tonic-gate 
1740Sstevel@tonic-gate 	/* take care of the success value first */
1750Sstevel@tonic-gate 	if (status == GSS_S_COMPLETE)
1760Sstevel@tonic-gate 		errStr = dgettext(TEXT_DOMAIN,
1770Sstevel@tonic-gate 				"The routine completed successfully");
1780Sstevel@tonic-gate 	else if (*msgCtxt == 0 && (oneVal = GSS_CALLING_ERROR(status))) {
1790Sstevel@tonic-gate 		switch (oneVal) {
1800Sstevel@tonic-gate 		case GSS_S_CALL_INACCESSIBLE_READ:
1810Sstevel@tonic-gate 			errStr = dgettext(TEXT_DOMAIN,
1820Sstevel@tonic-gate 					"A required input parameter"
1830Sstevel@tonic-gate 					" could not be read");
1840Sstevel@tonic-gate 			break;
1850Sstevel@tonic-gate 
1860Sstevel@tonic-gate 		case GSS_S_CALL_INACCESSIBLE_WRITE:
1870Sstevel@tonic-gate 			errStr = dgettext(TEXT_DOMAIN,
1880Sstevel@tonic-gate 					"A required output parameter"
1890Sstevel@tonic-gate 					" could not be written");
1900Sstevel@tonic-gate 			break;
1910Sstevel@tonic-gate 
1920Sstevel@tonic-gate 		case GSS_S_CALL_BAD_STRUCTURE:
1930Sstevel@tonic-gate 			errStr = dgettext(TEXT_DOMAIN,
1940Sstevel@tonic-gate 					"A parameter was malformed");
1950Sstevel@tonic-gate 			break;
1960Sstevel@tonic-gate 
1970Sstevel@tonic-gate 		default:
1980Sstevel@tonic-gate 			errStr = dgettext(TEXT_DOMAIN,
1990Sstevel@tonic-gate 					"An invalid status code was supplied");
2000Sstevel@tonic-gate 			break;
2010Sstevel@tonic-gate 		}
2020Sstevel@tonic-gate 
2030Sstevel@tonic-gate 		/* we now need to determine new value of msgCtxt */
2040Sstevel@tonic-gate 		if (GSS_ROUTINE_ERROR(status))
2050Sstevel@tonic-gate 			*msgCtxt = 1;
2060Sstevel@tonic-gate 		else if ((oneVal = GSS_SUPPLEMENTARY_INFO(status)) != 0)
2070Sstevel@tonic-gate 			*msgCtxt = (OM_uint32)(oneVal << 1);
2080Sstevel@tonic-gate 		else
2090Sstevel@tonic-gate 			*msgCtxt = 0;
2100Sstevel@tonic-gate 
2110Sstevel@tonic-gate 	} else if ((*msgCtxt == 0 || *msgCtxt == 1) &&
2120Sstevel@tonic-gate 		(oneVal = GSS_ROUTINE_ERROR(status))) {
2130Sstevel@tonic-gate 		switch (oneVal) {
2140Sstevel@tonic-gate 		case GSS_S_BAD_MECH:
2150Sstevel@tonic-gate 			errStr = dgettext(TEXT_DOMAIN,
2160Sstevel@tonic-gate 					"An unsupported mechanism"
2170Sstevel@tonic-gate 					" was requested");
2180Sstevel@tonic-gate 			break;
2190Sstevel@tonic-gate 
2200Sstevel@tonic-gate 		case GSS_S_BAD_NAME:
2210Sstevel@tonic-gate 			errStr = dgettext(TEXT_DOMAIN,
2220Sstevel@tonic-gate 					"An invalid name was supplied");
2230Sstevel@tonic-gate 			break;
2240Sstevel@tonic-gate 
2250Sstevel@tonic-gate 		case GSS_S_BAD_NAMETYPE:
2260Sstevel@tonic-gate 			errStr = dgettext(TEXT_DOMAIN,
2270Sstevel@tonic-gate 					"A supplied name was of an"
2280Sstevel@tonic-gate 					" unsupported type");
2290Sstevel@tonic-gate 			break;
2300Sstevel@tonic-gate 
2310Sstevel@tonic-gate 		case GSS_S_BAD_BINDINGS:
2320Sstevel@tonic-gate 			errStr = dgettext(TEXT_DOMAIN,
2330Sstevel@tonic-gate 					"Incorrect channel bindings"
2340Sstevel@tonic-gate 					" were supplied");
2350Sstevel@tonic-gate 			break;
2360Sstevel@tonic-gate 
2370Sstevel@tonic-gate 		case GSS_S_BAD_SIG: /* same as GSS_S_BAD_MIC: */
2380Sstevel@tonic-gate 			errStr = dgettext(TEXT_DOMAIN,
2390Sstevel@tonic-gate 					"A token had an invalid Message"
2400Sstevel@tonic-gate 					" Integrity Check (MIC)");
2410Sstevel@tonic-gate 			break;
2420Sstevel@tonic-gate 
2430Sstevel@tonic-gate 		case GSS_S_NO_CRED:
2440Sstevel@tonic-gate 			errStr = dgettext(TEXT_DOMAIN,
2450Sstevel@tonic-gate 					"No credentials were supplied, or the"
2460Sstevel@tonic-gate 					" credentials were unavailable or"
2470Sstevel@tonic-gate 					" inaccessible");
2480Sstevel@tonic-gate 			break;
2490Sstevel@tonic-gate 
2500Sstevel@tonic-gate 		case GSS_S_NO_CONTEXT:
2510Sstevel@tonic-gate 			errStr = dgettext(TEXT_DOMAIN,
2520Sstevel@tonic-gate 					"No context has been established");
2530Sstevel@tonic-gate 			break;
2540Sstevel@tonic-gate 
2550Sstevel@tonic-gate 		case GSS_S_DEFECTIVE_TOKEN:
2560Sstevel@tonic-gate 			errStr = dgettext(TEXT_DOMAIN,
2570Sstevel@tonic-gate 					"Invalid token was supplied");
2580Sstevel@tonic-gate 			break;
2590Sstevel@tonic-gate 
2600Sstevel@tonic-gate 		case GSS_S_DEFECTIVE_CREDENTIAL:
2610Sstevel@tonic-gate 			errStr = dgettext(TEXT_DOMAIN,
2620Sstevel@tonic-gate 					"Invalid credential was supplied");
2630Sstevel@tonic-gate 			break;
2640Sstevel@tonic-gate 
2650Sstevel@tonic-gate 		case GSS_S_CREDENTIALS_EXPIRED:
2660Sstevel@tonic-gate 			errStr = dgettext(TEXT_DOMAIN,
2670Sstevel@tonic-gate 					"The referenced credential has"
2680Sstevel@tonic-gate 					" expired");
2690Sstevel@tonic-gate 			break;
2700Sstevel@tonic-gate 
2710Sstevel@tonic-gate 		case GSS_S_CONTEXT_EXPIRED:
2720Sstevel@tonic-gate 			errStr = dgettext(TEXT_DOMAIN,
2730Sstevel@tonic-gate 					"The referenced context has expired");
2740Sstevel@tonic-gate 			break;
2750Sstevel@tonic-gate 
2760Sstevel@tonic-gate 		case GSS_S_FAILURE:
2770Sstevel@tonic-gate 			errStr = dgettext(TEXT_DOMAIN,
2780Sstevel@tonic-gate 					"Unspecified GSS failure.  Minor code"
2790Sstevel@tonic-gate 					" may provide more information");
2800Sstevel@tonic-gate 			break;
2810Sstevel@tonic-gate 
2820Sstevel@tonic-gate 		case GSS_S_BAD_QOP:
2830Sstevel@tonic-gate 			errStr = dgettext(TEXT_DOMAIN,
2840Sstevel@tonic-gate 					"The quality-of-protection (QOP) "
2850Sstevel@tonic-gate 					"requested could not be provided");
2860Sstevel@tonic-gate 			break;
2870Sstevel@tonic-gate 
2880Sstevel@tonic-gate 		case GSS_S_UNAUTHORIZED:
2890Sstevel@tonic-gate 			errStr = dgettext(TEXT_DOMAIN,
2900Sstevel@tonic-gate 					"The operation is forbidden by local"
2910Sstevel@tonic-gate 					" security policy");
2920Sstevel@tonic-gate 			break;
2930Sstevel@tonic-gate 
2940Sstevel@tonic-gate 		case GSS_S_UNAVAILABLE:
2950Sstevel@tonic-gate 			errStr = dgettext(TEXT_DOMAIN,
2960Sstevel@tonic-gate 					"The operation or option is not"
2970Sstevel@tonic-gate 					" available or unsupported");
2980Sstevel@tonic-gate 			break;
2990Sstevel@tonic-gate 
3000Sstevel@tonic-gate 		case GSS_S_DUPLICATE_ELEMENT:
3010Sstevel@tonic-gate 			errStr = dgettext(TEXT_DOMAIN,
3020Sstevel@tonic-gate 					"The requested credential element"
3030Sstevel@tonic-gate 					" already exists");
3040Sstevel@tonic-gate 			break;
3050Sstevel@tonic-gate 
3060Sstevel@tonic-gate 		case GSS_S_NAME_NOT_MN:
3070Sstevel@tonic-gate 			errStr = dgettext(TEXT_DOMAIN,
3080Sstevel@tonic-gate 					"The provided name was not mechanism"
3090Sstevel@tonic-gate 					" specific (MN)");
3100Sstevel@tonic-gate 			break;
3110Sstevel@tonic-gate 
3120Sstevel@tonic-gate 		case GSS_S_BAD_STATUS:
3130Sstevel@tonic-gate 		default:
3140Sstevel@tonic-gate 			errStr = dgettext(TEXT_DOMAIN,
3150Sstevel@tonic-gate 					"An invalid status code was supplied");
3160Sstevel@tonic-gate 		}
3170Sstevel@tonic-gate 
3180Sstevel@tonic-gate 		/* we must determine if the caller should call us again */
3190Sstevel@tonic-gate 		if ((oneVal = GSS_SUPPLEMENTARY_INFO(status)) != 0)
3200Sstevel@tonic-gate 			*msgCtxt = (OM_uint32)(oneVal << 1);
3210Sstevel@tonic-gate 		else
3220Sstevel@tonic-gate 			*msgCtxt = 0;
3230Sstevel@tonic-gate 
3240Sstevel@tonic-gate 	} else if ((*msgCtxt == 0 || *msgCtxt >= 2) &&
3250Sstevel@tonic-gate 		(oneVal = GSS_SUPPLEMENTARY_INFO(status))) {
3260Sstevel@tonic-gate 		/*
3270Sstevel@tonic-gate 		 * if msgCtxt is not 0, then it should encode
3280Sstevel@tonic-gate 		 * the supplementary error code we should be printing
3290Sstevel@tonic-gate 		 */
3300Sstevel@tonic-gate 		if (*msgCtxt >= 2)
3310Sstevel@tonic-gate 			oneVal = (OM_uint32) (*msgCtxt) >> 1;
3320Sstevel@tonic-gate 		else
3330Sstevel@tonic-gate 			oneVal = GSS_SUPPLEMENTARY_INFO(status);
3340Sstevel@tonic-gate 
3350Sstevel@tonic-gate 		/* we display the errors LSB first */
3360Sstevel@tonic-gate 		for (i = 0; i < 16; i++) {
3370Sstevel@tonic-gate 			if (oneVal & mask) {
3380Sstevel@tonic-gate 				haveErr = 1;
3390Sstevel@tonic-gate 				break;
3400Sstevel@tonic-gate 			}
3410Sstevel@tonic-gate 			mask <<= 1;
3420Sstevel@tonic-gate 		}
3430Sstevel@tonic-gate 
3440Sstevel@tonic-gate 		/* isolate the bit or if not found set to illegal value */
3450Sstevel@tonic-gate 		if (haveErr)
3460Sstevel@tonic-gate 			currErr = oneVal & mask;
3470Sstevel@tonic-gate 		else
3480Sstevel@tonic-gate 			currErr = 1 << 17; /* illegal value */
3490Sstevel@tonic-gate 
3500Sstevel@tonic-gate 		switch (currErr) {
3510Sstevel@tonic-gate 		case GSS_S_CONTINUE_NEEDED:
3520Sstevel@tonic-gate 			errStr = dgettext(TEXT_DOMAIN,
3530Sstevel@tonic-gate 					"The routine must be called again to"
3540Sstevel@tonic-gate 					" complete its function");
3550Sstevel@tonic-gate 			break;
3560Sstevel@tonic-gate 
3570Sstevel@tonic-gate 		case GSS_S_DUPLICATE_TOKEN:
3580Sstevel@tonic-gate 			errStr = dgettext(TEXT_DOMAIN,
3590Sstevel@tonic-gate 					"The token was a duplicate of an"
3600Sstevel@tonic-gate 					" earlier token");
3610Sstevel@tonic-gate 			break;
3620Sstevel@tonic-gate 
3630Sstevel@tonic-gate 		case GSS_S_OLD_TOKEN:
3640Sstevel@tonic-gate 			errStr = dgettext(TEXT_DOMAIN,
3650Sstevel@tonic-gate 					"The token's validity period"
3660Sstevel@tonic-gate 					" has expired");
3670Sstevel@tonic-gate 			break;
3680Sstevel@tonic-gate 
3690Sstevel@tonic-gate 		case GSS_S_UNSEQ_TOKEN:
3700Sstevel@tonic-gate 			errStr = dgettext(TEXT_DOMAIN,
3710Sstevel@tonic-gate 					"A later token has already been"
3720Sstevel@tonic-gate 					" processed");
3730Sstevel@tonic-gate 			break;
3740Sstevel@tonic-gate 
3750Sstevel@tonic-gate 		case GSS_S_GAP_TOKEN:
3760Sstevel@tonic-gate 			errStr = dgettext(TEXT_DOMAIN,
3770Sstevel@tonic-gate 					"An expected per-message token was"
3780Sstevel@tonic-gate 					" not received");
3790Sstevel@tonic-gate 			break;
3800Sstevel@tonic-gate 
3810Sstevel@tonic-gate 		default:
3820Sstevel@tonic-gate 			errStr = dgettext(TEXT_DOMAIN,
3830Sstevel@tonic-gate 					"An invalid status code was supplied");
3840Sstevel@tonic-gate 		}
3850Sstevel@tonic-gate 
3860Sstevel@tonic-gate 		/*
3870Sstevel@tonic-gate 		 * we must check if there is any other supplementary errors
3880Sstevel@tonic-gate 		 * if found, then turn off current bit, and store next value
3890Sstevel@tonic-gate 		 * in msgCtxt shifted by 1 bit
3900Sstevel@tonic-gate 		 */
3910Sstevel@tonic-gate 		if (!haveErr)
3920Sstevel@tonic-gate 			*msgCtxt = 0;
3930Sstevel@tonic-gate 		else if (GSS_SUPPLEMENTARY_INFO(oneVal) ^ mask)
3940Sstevel@tonic-gate 			*msgCtxt = (OM_uint32)
3950Sstevel@tonic-gate 				((GSS_SUPPLEMENTARY_INFO(oneVal) ^ mask) << 1);
3960Sstevel@tonic-gate 		else
3970Sstevel@tonic-gate 			*msgCtxt = 0;
3980Sstevel@tonic-gate 	}
3990Sstevel@tonic-gate 
4000Sstevel@tonic-gate 	if (errStr == NULL)
4010Sstevel@tonic-gate 		errStr = dgettext(TEXT_DOMAIN,
4020Sstevel@tonic-gate 				"An invalid status code was supplied");
4030Sstevel@tonic-gate 
4040Sstevel@tonic-gate 	/* now copy the status code and return to caller */
4050Sstevel@tonic-gate 	outStr->length = strlen(errStr);
406*13132SGlenn.Barry@oracle.com 	outStr->value = strdup(errStr);
4070Sstevel@tonic-gate 	if (outStr->value == NULL) {
4080Sstevel@tonic-gate 		outStr->length = 0;
4090Sstevel@tonic-gate 		return (GSS_S_FAILURE);
4100Sstevel@tonic-gate 	}
4110Sstevel@tonic-gate 
4120Sstevel@tonic-gate 	return (GSS_S_COMPLETE);
4130Sstevel@tonic-gate } /* displayMajor */
414