xref: /illumos-gate/usr/src/uts/common/gssapi/gss_release_name.c (revision 16b76d3cb933ff92018a2a75594449010192eacb)
1 /*
2  * CDDL HEADER START
3  *
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.
8  *
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.
13  *
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]
19  *
20  * CDDL HEADER END
21  */
22 /*
23  * Copyright (c) 1996,1997, by Sun Microsystems, Inc.
24  * All rights reserved.
25  */
26 
27 /*
28  *  glue routine for gss_release_name
29  */
30 
31 #include "mechglueP.h"
32 
33 OM_uint32
34 gss_release_name(OM_uint32 *minor_status, gss_name_t *input_name)
35 {
36 	gss_union_name_t	union_name;
37 
38 	/* if input_name is NULL, return error */
39 
40 	if (input_name == 0)
41 		return (GSS_S_BAD_NAME);
42 
43 	/*
44 	 * free up the space for the external_name, name_type
45 	 * and then free the union_name descriptor
46 	 */
47 	union_name = (gss_union_name_t) *input_name;
48 	*input_name = 0;
49 	*minor_status = 0;
50 
51 	if (union_name == NULL)
52 		return (GSS_S_BAD_NAME);
53 
54 	FREE(union_name->external_name->value,
55 		union_name->external_name->length);
56 	FREE(union_name->external_name, sizeof (gss_buffer_desc));
57 
58 	/* free the name_type */
59 	FREE(union_name->name_type->elements, union_name->name_type->length);
60 	FREE(union_name->name_type, sizeof (gss_OID_desc));
61 
62 	FREE(union_name, sizeof (gss_union_name_desc));
63 
64 	return (GSS_S_COMPLETE);
65 }
66