Merge remote-tracking branch 'origin/master'
[unleashed/lotheac.git] / usr / src / uts / common / gssapi / gss_display_name.c
blob78c48c4a24deadf03d2933e69ef2e662307036f2
1 /*
2 * CDDL HEADER START
4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License, Version 1.0 only
6 * (the "License"). You may not use this file except in compliance
7 * with the License.
9 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10 * or http://www.opensolaris.org/os/licensing.
11 * See the License for the specific language governing permissions
12 * and limitations under the License.
14 * When distributing Covered Code, include this CDDL HEADER in each
15 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16 * If applicable, add the following below this CDDL HEADER, with the
17 * fields enclosed by brackets "[]" replaced with your own identifying
18 * information: Portions Copyright [yyyy] [name of copyright owner]
20 * CDDL HEADER END
23 * Copyright 2004 Sun Microsystems, Inc. All rights reserved.
24 * Use is subject to license terms.
27 #pragma ident "%Z%%M% %I% %E% SMI"
30 * glue routine for gss_display_name()
33 #include <mechglueP.h>
34 #include <gssapi/kgssapi_defs.h>
36 OM_uint32
37 gss_display_name(OM_uint32 *minor_status,
38 const gss_name_t input_name,
39 gss_buffer_t output_name_buffer,
40 gss_OID *output_name_type)
42 gss_union_name_t union_name;
44 if (input_name == 0)
45 return (GSS_S_BAD_NAME);
47 union_name = (gss_union_name_t) input_name;
49 GSSLOG(8, "union_name value %s\n",
50 (char *)union_name->external_name->value);
53 * copy the value of the external_name component of the union
54 * name into the output_name_buffer and point the output_name_type
55 * to the name_type component of union_name
57 if (output_name_type != NULL)
58 *output_name_type = union_name->name_type;
60 if (output_name_buffer != NULL) {
61 output_name_buffer->length = union_name->external_name->length;
63 output_name_buffer->value =
64 (void *) MALLOC(output_name_buffer->length);
66 (void) memcpy(output_name_buffer->value,
67 union_name->external_name->value,
68 output_name_buffer->length);
71 if (minor_status)
72 *minor_status = 0;
74 return (GSS_S_COMPLETE);