Home | History | Annotate | Download | only in mech
      1 /*
      2  * Copyright 1993 by OpenVision Technologies, Inc.
      3  *
      4  * Permission to use, copy, modify, distribute, and sell this software
      5  * and its documentation for any purpose is hereby granted without fee,
      6  * provided that the above copyright notice appears in all copies and
      7  * that both that copyright notice and this permission notice appear in
      8  * supporting documentation, and that the name of OpenVision not be used
      9  * in advertising or publicity pertaining to distribution of the software
     10  * without specific, written prior permission. OpenVision makes no
     11  * representations about the suitability of this software for any
     12  * purpose.  It is provided "as is" without express or implied warranty.
     13  *
     14  * OPENVISION DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
     15  * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
     16  * EVENT SHALL OPENVISION BE LIABLE FOR ANY SPECIAL, INDIRECT OR
     17  * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF
     18  * USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
     19  * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
     20  * PERFORMANCE OF THIS SOFTWARE.
     21  */
     22 
     23 #pragma ident	"%Z%%M%	%I%	%E% SMI"
     24 
     25 #include "gssapiP_krb5.h"
     26 #include "gss_libinit.h"
     27 #include "com_err.h"
     28 
     29 /* XXXX internationalization!! */
     30 
     31 /**/
     32 
     33 OM_uint32
     34 krb5_gss_display_status(minor_status, status_value, status_type,
     35 			mech_type, message_context, status_string)
     36      OM_uint32 *minor_status;
     37      OM_uint32 status_value;
     38      int status_type;
     39      gss_OID mech_type;
     40      OM_uint32 *message_context;
     41      gss_buffer_t status_string;
     42 {
     43    status_string->length = 0;
     44    status_string->value = NULL;
     45 
     46    if ((mech_type != GSS_C_NULL_OID) &&
     47        !g_OID_equal(gss_mech_krb5, mech_type) &&
     48        !g_OID_equal(gss_mech_krb5_old, mech_type)) {
     49        *minor_status = 0;
     50        return(GSS_S_BAD_MECH);
     51     }
     52 
     53    if (status_type == GSS_C_GSS_CODE) {
     54       return(g_display_major_status(minor_status, status_value,
     55 				    message_context, status_string));
     56    } else if (status_type == GSS_C_MECH_CODE) {
     57       (void) gssint_initialize_library();
     58 
     59       if (*message_context) {
     60 	 *minor_status = (OM_uint32) G_BAD_MSG_CTX;
     61 	 return(GSS_S_FAILURE);
     62       }
     63 
     64       return(g_display_com_err_status(minor_status, status_value,
     65 				      status_string));
     66    } else {
     67       *minor_status = 0;
     68       return(GSS_S_BAD_STATUS);
     69    }
     70 }
     71