6069 libdisasm: instrlen arch op should have a sane default
[illumos-gate.git] / usr / src / lib / libgss / g_rel_name.c
blobe4df5438f276e48f072d5c00fd68039cd34a40d8
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_release_name
33 #include <mechglueP.h>
34 #include <stdio.h>
35 #ifdef HAVE_STDLIB_H
36 #include <stdlib.h>
37 #endif
38 #include <string.h>
40 OM_uint32
41 gss_release_name(minor_status,
42 input_name)
44 OM_uint32 *minor_status;
45 gss_name_t *input_name;
48 gss_union_name_t union_name;
50 if (minor_status == NULL)
51 return (GSS_S_CALL_INACCESSIBLE_WRITE);
52 *minor_status = 0;
54 /* if input_name is NULL, return error */
55 if (input_name == 0)
56 return (GSS_S_CALL_INACCESSIBLE_READ | GSS_S_BAD_NAME);
59 * free up the space for the external_name and then
60 * free the union_name descriptor
63 union_name = (gss_union_name_t)*input_name;
64 *input_name = 0;
65 *minor_status = 0;
67 if (union_name->name_type)
68 (void) gss_release_oid(minor_status, &union_name->name_type);
70 free(union_name->external_name->value);
71 free(union_name->external_name);
73 if (union_name->mech_type) {
74 (void) __gss_release_internal_name(minor_status,
75 union_name->mech_type,
76 &union_name->mech_name);
77 (void) gss_release_oid(minor_status, &union_name->mech_type);
80 free(union_name);
82 return (GSS_S_COMPLETE);