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) 1995,1997, by Sun Microsystems, Inc.
24 * All rights reserved.
25 */
26
27 /*
28 * glue routine for gssd_release_name_and_type -- this is a hack,
29 * it is only used by the client-side rpc library. Perhaps it should
30 * be in there? Perhaps this should be a part of the release_name
31 * function? Or perhaps it should always allocate it? I don't know
32 * the right answer.
33 */
34
35 #include <sys/types.h>
36 #include <stdlib.h>
37 #include <mechglueP.h>
38
39 /*ARGSUSED*/
40 OM_uint32
gssd_release_name_and_type(minor_status,input_name)41 gssd_release_name_and_type(minor_status, input_name)
42 OM_uint32 * minor_status;
43 gss_name_t * input_name;
44
45 {
46
47 gss_union_name_t union_name;
48
49 if (input_name == NULL)
50 return (GSS_S_COMPLETE);
51
52 /*
53 * free up the space for the external_name and also the name
54 * type data. Then free the union_name descriptor.
55 */
56
57 union_name = (gss_union_name_t) *input_name;
58 *input_name = NULL;
59
60 if (union_name == NULL)
61 return (GSS_S_COMPLETE);
62
63 FREE(union_name->external_name->value,
64 union_name->external_name->length);
65 FREE(union_name->external_name, sizeof (gss_buffer_desc));
66 FREE(union_name->name_type->elements, union_name->name_type->length);
67 FREE(union_name->name_type, sizeof (gss_OID_desc));
68 FREE(union_name, sizeof (gss_union_name_desc));
69
70 return (GSS_S_COMPLETE);
71 }
72
73 OM_uint32
gss_release_oid_set_and_oids(minor_status,set)74 gss_release_oid_set_and_oids(minor_status, set)
75 OM_uint32 * minor_status;
76 gss_OID_set * set;
77 {
78 int i;
79
80 if (minor_status)
81 *minor_status = 0;
82
83 if (set == NULL)
84 return (GSS_S_COMPLETE);
85
86 if (*set == GSS_C_NULL_OID_SET)
87 return (GSS_S_COMPLETE);
88
89 for (i = 0; i < (*set)->count; i++)
90 FREE((*set)->elements[i].elements, (*set)->elements[i].length);
91
92 FREE((*set)->elements, (*set)->count * sizeof (gss_OID_desc));
93 FREE(*set, sizeof (gss_OID_set_desc));
94
95 *set = GSS_C_NULL_OID_SET;
96
97 return (GSS_S_COMPLETE);
98 }
99