xref: /titanic_52/usr/src/uts/common/gssapi/gss_release_name.c (revision c2580b931007758eab8cb5ae8726ebe1588e259b)
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 #pragma ident	"%Z%%M%	%I%	%E% SMI"
28 
29 /*
30  *  glue routine for gss_release_name
31  */
32 
33 #include "mechglueP.h"
34 
35 OM_uint32
36 gss_release_name(OM_uint32 *minor_status, gss_name_t *input_name)
37 {
38 	gss_union_name_t	union_name;
39 
40 	/* if input_name is NULL, return error */
41 
42 	if (input_name == 0)
43 		return (GSS_S_BAD_NAME);
44 
45 	/*
46 	 * free up the space for the external_name, name_type
47 	 * and then free the union_name descriptor
48 	 */
49 	union_name = (gss_union_name_t) *input_name;
50 	*input_name = 0;
51 	*minor_status = 0;
52 
53 	if (union_name == NULL)
54 		return (GSS_S_BAD_NAME);
55 
56 	FREE(union_name->external_name->value,
57 		union_name->external_name->length);
58 	FREE(union_name->external_name, sizeof (gss_buffer_desc));
59 
60 	/* free the name_type */
61 	FREE(union_name->name_type->elements, union_name->name_type->length);
62 	FREE(union_name->name_type, sizeof (gss_OID_desc));
63 
64 	FREE(union_name, sizeof (gss_union_name_desc));
65 
66 	return (GSS_S_COMPLETE);
67 }
68