1 /* -*- mode: c; c-basic-offset: 4; indent-tabs-mode: nil -*- */
3 * Copyright 1993 by OpenVision Technologies, Inc.
5 * Permission to use, copy, modify, distribute, and sell this software
6 * and its documentation for any purpose is hereby granted without fee,
7 * provided that the above copyright notice appears in all copies and
8 * that both that copyright notice and this permission notice appear in
9 * supporting documentation, and that the name of OpenVision not be used
10 * in advertising or publicity pertaining to distribution of the software
11 * without specific, written prior permission. OpenVision makes no
12 * representations about the suitability of this software for any
13 * purpose. It is provided "as is" without express or implied warranty.
15 * OPENVISION DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
16 * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
17 * EVENT SHALL OPENVISION BE LIABLE FOR ANY SPECIAL, INDIRECT OR
18 * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF
19 * USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
20 * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
21 * PERFORMANCE OF THIS SOFTWARE.
24 #include "gssapiP_krb5.h"
26 OM_uint32 KRB5_CALLCONV
27 krb5_gss_display_name(minor_status, input_name, output_name_buffer,
29 OM_uint32 *minor_status;
30 gss_name_t input_name;
31 gss_buffer_t output_name_buffer;
32 gss_OID *output_name_type;
37 krb5_gss_name_t k5name = (krb5_gss_name_t) input_name;
38 gss_OID nametype = (gss_OID) gss_nt_krb5_name;
40 output_name_buffer->length = 0;
41 output_name_buffer->value = NULL;
43 *output_name_type = GSS_C_NO_OID;
45 code = krb5_gss_init_context(&context);
51 if (krb5_princ_type(context, k5name->princ) == KRB5_NT_WELLKNOWN) {
52 if (krb5_principal_compare(context, k5name->princ,
53 krb5_anonymous_principal()))
54 nametype = GSS_C_NT_ANONYMOUS;
57 if ((code = krb5_unparse_name(context,
58 ((krb5_gss_name_t) input_name)->princ,
61 save_error_info(*minor_status, context);
62 krb5_free_context(context);
63 return(GSS_S_FAILURE);
66 if (! g_make_string_buffer(str, output_name_buffer)) {
67 krb5_free_unparsed_name(context, str);
68 krb5_free_context(context);
70 *minor_status = (OM_uint32) G_BUFFER_ALLOC;
71 return(GSS_S_FAILURE);
74 krb5_free_unparsed_name(context, str);
75 krb5_free_context(context);
79 *output_name_type = (gss_OID) nametype;
80 return(GSS_S_COMPLETE);