1 /* 2 * Copyright 2002 Sun Microsystems, Inc. All rights reserved. 3 * Use is subject to license terms. 4 */ 5 6 #pragma ident "%Z%%M% %I% %E% SMI" 7 8 /* 9 * Copyright 1993 by OpenVision Technologies, Inc. 10 * 11 * Permission to use, copy, modify, distribute, and sell this software 12 * and its documentation for any purpose is hereby granted without fee, 13 * provided that the above copyright notice appears in all copies and 14 * that both that copyright notice and this permission notice appear in 15 * supporting documentation, and that the name of OpenVision not be used 16 * in advertising or publicity pertaining to distribution of the software 17 * without specific, written prior permission. OpenVision makes no 18 * representations about the suitability of this software for any 19 * purpose. It is provided "as is" without express or implied warranty. 20 * 21 * OPENVISION DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, 22 * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO 23 * EVENT SHALL OPENVISION BE LIABLE FOR ANY SPECIAL, INDIRECT OR 24 * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF 25 * USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR 26 * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR 27 * PERFORMANCE OF THIS SOFTWARE. 28 */ 29 30 /* 31 * $Id: disp_com_err_status.c,v 1.5 1996/07/22 20:32:59 marc Exp $ 32 */ 33 34 #include <gssapiP_generic.h> 35 #include <com_err.h> 36 37 /* 38 * Solaris Kerberos does not dynamically load the error tables 39 */ 40 #if 0 41 static int init_et = 0; 42 #endif 43 static const char * const no_error = "No error"; 44 45 /* 46 * if status_type == GSS_C_GSS_CODE, return up to three error messages, 47 * for routine errors, call error, and status, in that order. 48 * message_context == 0 : print the routine error 49 * message_context == 1 : print the calling error 50 * message_context > 2 : print supplementary info bit (message_context-2) 51 * if status_type == GSS_C_MECH_CODE, return the output from error_message() 52 */ 53 54 OM_uint32 55 g_display_com_err_status(minor_status, status_value, status_string) 56 OM_uint32 *minor_status; 57 OM_uint32 status_value; 58 gss_buffer_t status_string; 59 { 60 status_string->length = 0; 61 status_string->value = NULL; 62 63 /* Solaris Kerberos does not dynamically load the error tables */ 64 #if 0 65 if (!init_et) { 66 initialize_ggss_error_table(); 67 init_et = 1; 68 } 69 #endif 70 71 if (! g_make_string_buffer(((status_value == 0)?no_error: 72 error_message(status_value)), 73 status_string)) { 74 *minor_status = ENOMEM; 75 return(GSS_S_FAILURE); 76 } 77 *minor_status = 0; 78 return(GSS_S_COMPLETE); 79 } 80