1 /* #ident "@(#)gss_release_cred.c 1.15 95/08/07 SMI" */
4 * Copyright 1996 by Sun Microsystems, Inc.
6 * Permission to use, copy, modify, distribute, and sell this software
7 * and its documentation for any purpose is hereby granted without fee,
8 * provided that the above copyright notice appears in all copies and
9 * that both that copyright notice and this permission notice appear in
10 * supporting documentation, and that the name of Sun Microsystems not be used
11 * in advertising or publicity pertaining to distribution of the software
12 * without specific, written prior permission. Sun Microsystems makes no
13 * representations about the suitability of this software for any
14 * purpose. It is provided "as is" without express or implied warranty.
16 * SUN MICROSYSTEMS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
17 * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
18 * EVENT SHALL SUN MICROSYSTEMS BE LIABLE FOR ANY SPECIAL, INDIRECT OR
19 * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF
20 * USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
21 * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
22 * PERFORMANCE OF THIS SOFTWARE.
26 * glue routine for gss_release_cred
35 OM_uint32 KRB5_CALLCONV
36 gss_release_cred(minor_status,
39 OM_uint32 * minor_status;
40 gss_cred_id_t * cred_handle;
43 OM_uint32 status, temp_status;
45 gss_union_cred_t union_cred;
53 /* if the cred_handle is null, return a NO_CRED error */
55 if (cred_handle == GSS_C_NO_CREDENTIAL)
56 return(GSS_S_NO_CRED);
59 * Loop through the union_cred struct, selecting the approprate
60 * underlying mechanism routine and calling it. At the end,
61 * release all of the storage taken by the union_cred struct.
64 union_cred = (gss_union_cred_t) *cred_handle;
67 if (union_cred == NULL)
70 status = GSS_S_COMPLETE;
72 for(j=0; j < union_cred->count; j++) {
74 mech = __gss_get_mechanism (&union_cred->mechs_array[j]);
76 if (union_cred->mechs_array[j].elements)
77 free(union_cred->mechs_array[j].elements);
79 if (mech->gss_release_cred) {
80 temp_status = mech->gss_release_cred
81 #ifdef USE_MECH_CONTEXT
87 &union_cred->cred_array[j]);
89 if (temp_status != GSS_S_COMPLETE)
90 status = GSS_S_NO_CRED;
93 status = GSS_S_NO_CRED;
95 status = GSS_S_NO_CRED;
98 gss_release_buffer(minor_status, &union_cred->auxinfo.name);
99 free(union_cred->cred_array);
100 free(union_cred->mechs_array);