remove pyzfs
[unleashed.git] / usr / src / lib / libgss / g_export_name.c
blob89a9d45bc8a99fd8d68d84a316828253278491a8
1 /*
2 * CDDL HEADER START
4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License (the "License").
6 * You may not use this file except in compliance with the License.
8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 * or http://www.opensolaris.org/os/licensing.
10 * See the License for the specific language governing permissions
11 * and limitations under the License.
13 * When distributing Covered Code, include this CDDL HEADER in each
14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 * If applicable, add the following below this CDDL HEADER, with the
16 * fields enclosed by brackets "[]" replaced with your own identifying
17 * information: Portions Copyright [yyyy] [name of copyright owner]
19 * CDDL HEADER END
22 * Copyright 2009 Sun Microsystems, Inc. All rights reserved.
23 * Use is subject to license terms.
27 * glue routine gss_export_name
29 * Will either call the mechanism defined gss_export_name, or if one is
30 * not defined will call a generic_gss_export_name routine.
33 #include <mechglueP.h>
34 #ifdef HAVE_STDLIB_H
35 #include <stdlib.h>
36 #endif
37 #include <string.h>
38 #include <errno.h>
40 OM_uint32
41 gss_export_name(minor_status,
42 input_name,
43 exported_name)
44 OM_uint32 * minor_status;
45 const gss_name_t input_name;
46 gss_buffer_t exported_name;
48 gss_union_name_t union_name;
50 /* Initialize outputs. */
52 if (minor_status != NULL)
53 *minor_status = 0;
55 if (exported_name != GSS_C_NO_BUFFER) {
56 exported_name->value = NULL;
57 exported_name->length = 0;
60 /* Validate arguments. */
62 if (minor_status == NULL || exported_name == GSS_C_NO_BUFFER)
63 return (GSS_S_CALL_INACCESSIBLE_WRITE);
65 if (input_name == GSS_C_NO_NAME)
66 return (GSS_S_CALL_INACCESSIBLE_READ | GSS_S_BAD_NAME);
68 union_name = (gss_union_name_t)input_name;
70 /* the name must be in mechanism specific format */
71 if (!union_name->mech_type)
72 return (GSS_S_NAME_NOT_MN);
74 return __gss_export_internal_name(minor_status, union_name->mech_type,
75 union_name->mech_name, exported_name);