10Sstevel@tonic-gate /*
20Sstevel@tonic-gate * Copyright 1993 by OpenVision Technologies, Inc.
35053Sgtb *
40Sstevel@tonic-gate * Permission to use, copy, modify, distribute, and sell this software
50Sstevel@tonic-gate * and its documentation for any purpose is hereby granted without fee,
60Sstevel@tonic-gate * provided that the above copyright notice appears in all copies and
70Sstevel@tonic-gate * that both that copyright notice and this permission notice appear in
80Sstevel@tonic-gate * supporting documentation, and that the name of OpenVision not be used
90Sstevel@tonic-gate * in advertising or publicity pertaining to distribution of the software
100Sstevel@tonic-gate * without specific, written prior permission. OpenVision makes no
110Sstevel@tonic-gate * representations about the suitability of this software for any
120Sstevel@tonic-gate * purpose. It is provided "as is" without express or implied warranty.
135053Sgtb *
140Sstevel@tonic-gate * OPENVISION DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
150Sstevel@tonic-gate * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
160Sstevel@tonic-gate * EVENT SHALL OPENVISION BE LIABLE FOR ANY SPECIAL, INDIRECT OR
170Sstevel@tonic-gate * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF
180Sstevel@tonic-gate * USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
190Sstevel@tonic-gate * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
200Sstevel@tonic-gate * PERFORMANCE OF THIS SOFTWARE.
210Sstevel@tonic-gate */
220Sstevel@tonic-gate
235053Sgtb #include "gssapiP_krb5.h"
240Sstevel@tonic-gate
250Sstevel@tonic-gate OM_uint32
krb5_gss_display_name(minor_status,input_name,output_name_buffer,output_name_type)265053Sgtb krb5_gss_display_name(minor_status, input_name, output_name_buffer,
270Sstevel@tonic-gate output_name_type)
280Sstevel@tonic-gate OM_uint32 *minor_status;
290Sstevel@tonic-gate gss_name_t input_name;
300Sstevel@tonic-gate gss_buffer_t output_name_buffer;
310Sstevel@tonic-gate gss_OID *output_name_type;
320Sstevel@tonic-gate {
335053Sgtb krb5_context context;
340Sstevel@tonic-gate krb5_error_code code;
350Sstevel@tonic-gate char *str;
360Sstevel@tonic-gate
375053Sgtb code = krb5_gss_init_context(&context);
385053Sgtb if (code) {
395053Sgtb *minor_status = code;
405053Sgtb return GSS_S_FAILURE;
415053Sgtb }
420Sstevel@tonic-gate
430Sstevel@tonic-gate output_name_buffer->length = 0;
440Sstevel@tonic-gate output_name_buffer->value = NULL;
450Sstevel@tonic-gate
460Sstevel@tonic-gate if (! kg_validate_name(input_name)) {
470Sstevel@tonic-gate *minor_status = (OM_uint32) G_VALIDATE_FAILED;
485053Sgtb krb5_free_context(context);
490Sstevel@tonic-gate return(GSS_S_CALL_BAD_STRUCTURE|GSS_S_BAD_NAME);
500Sstevel@tonic-gate }
510Sstevel@tonic-gate
520Sstevel@tonic-gate if ((code = krb5_unparse_name(context,
530Sstevel@tonic-gate (krb5_principal) input_name, &str))) {
540Sstevel@tonic-gate *minor_status = code;
55*13132SGlenn.Barry@oracle.com save_error_info(*minor_status, context);
565053Sgtb krb5_free_context(context);
570Sstevel@tonic-gate return(GSS_S_FAILURE);
580Sstevel@tonic-gate }
590Sstevel@tonic-gate
600Sstevel@tonic-gate if (! g_make_string_buffer(str, output_name_buffer)) {
615053Sgtb krb5_free_unparsed_name(context, str);
625053Sgtb krb5_free_context(context);
630Sstevel@tonic-gate
640Sstevel@tonic-gate *minor_status = (OM_uint32) G_BUFFER_ALLOC;
650Sstevel@tonic-gate return(GSS_S_FAILURE);
660Sstevel@tonic-gate }
670Sstevel@tonic-gate
685053Sgtb krb5_free_unparsed_name(context, str);
695053Sgtb krb5_free_context(context);
700Sstevel@tonic-gate
710Sstevel@tonic-gate *minor_status = 0;
720Sstevel@tonic-gate if (output_name_type)
730Sstevel@tonic-gate *output_name_type = (gss_OID) gss_nt_krb5_name;
740Sstevel@tonic-gate return(GSS_S_COMPLETE);
750Sstevel@tonic-gate }
76