1 0 stevel /* 2 0 stevel * CDDL HEADER START 3 0 stevel * 4 0 stevel * The contents of this file are subject to the terms of the 5 0 stevel * Common Development and Distribution License, Version 1.0 only 6 0 stevel * (the "License"). You may not use this file except in compliance 7 0 stevel * with the License. 8 0 stevel * 9 0 stevel * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 10 0 stevel * or http://www.opensolaris.org/os/licensing. 11 0 stevel * See the License for the specific language governing permissions 12 0 stevel * and limitations under the License. 13 0 stevel * 14 0 stevel * When distributing Covered Code, include this CDDL HEADER in each 15 0 stevel * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 16 0 stevel * If applicable, add the following below this CDDL HEADER, with the 17 0 stevel * fields enclosed by brackets "[]" replaced with your own identifying 18 0 stevel * information: Portions Copyright [yyyy] [name of copyright owner] 19 0 stevel * 20 0 stevel * CDDL HEADER END 21 0 stevel */ 22 0 stevel /* 23 0 stevel * Copyright 2004 Sun Microsystems, Inc. All rights reserved. 24 0 stevel * Use is subject to license terms. 25 0 stevel */ 26 0 stevel 27 0 stevel #pragma ident "%Z%%M% %I% %E% SMI" 28 0 stevel 29 0 stevel /* 30 0 stevel * glue routine for gss_release_cred 31 0 stevel */ 32 0 stevel 33 0 stevel #include <mechglueP.h> 34 0 stevel #include <stdio.h> 35 0 stevel #ifdef HAVE_STDLIB_H 36 0 stevel #include <stdlib.h> 37 0 stevel #endif 38 0 stevel 39 0 stevel OM_uint32 40 0 stevel gss_release_cred(minor_status, 41 0 stevel cred_handle) 42 0 stevel 43 0 stevel OM_uint32 *minor_status; 44 0 stevel gss_cred_id_t *cred_handle; 45 0 stevel 46 0 stevel { 47 0 stevel OM_uint32 status, temp_status; 48 0 stevel int j; 49 0 stevel gss_union_cred_t union_cred; 50 0 stevel gss_mechanism mech; 51 0 stevel 52 0 stevel if (minor_status == NULL) 53 0 stevel return (GSS_S_CALL_INACCESSIBLE_WRITE); 54 0 stevel 55 0 stevel *minor_status = 0; 56 0 stevel 57 0 stevel if (cred_handle == NULL) 58 0 stevel return (GSS_S_NO_CRED | GSS_S_CALL_INACCESSIBLE_READ); 59 0 stevel 60 0 stevel /* 61 0 stevel * Loop through the union_cred struct, selecting the approprate 62 0 stevel * underlying mechanism routine and calling it. At the end, 63 0 stevel * release all of the storage taken by the union_cred struct. 64 0 stevel */ 65 0 stevel 66 0 stevel union_cred = (gss_union_cred_t)*cred_handle; 67 0 stevel *cred_handle = NULL; 68 0 stevel 69 0 stevel if (union_cred == (gss_union_cred_t)GSS_C_NO_CREDENTIAL) 70 0 stevel return (GSS_S_COMPLETE); 71 0 stevel 72 0 stevel status = GSS_S_COMPLETE; 73 0 stevel 74 0 stevel for (j = 0; j < union_cred->count; j++) { 75 0 stevel 76 0 stevel mech = __gss_get_mechanism(&union_cred->mechs_array[j]); 77 0 stevel 78 0 stevel if (union_cred->mechs_array[j].elements) 79 0 stevel free(union_cred->mechs_array[j].elements); 80 0 stevel if (mech) { 81 0 stevel if (mech->gss_release_cred) { 82 0 stevel temp_status = mech->gss_release_cred 83 0 stevel (mech->context, minor_status, 84 0 stevel &union_cred->cred_array[j]); 85 0 stevel 86 0 stevel if (temp_status != GSS_S_COMPLETE) 87 0 stevel status = GSS_S_NO_CRED; 88 0 stevel } else 89 0 stevel status = GSS_S_UNAVAILABLE; 90 0 stevel } else 91 0 stevel status = GSS_S_DEFECTIVE_CREDENTIAL; 92 0 stevel } 93 0 stevel 94 0 stevel (void) gss_release_buffer(minor_status, &union_cred->auxinfo.name); 95 0 stevel free(union_cred->cred_array); 96 0 stevel free(union_cred->mechs_array); 97 0 stevel free(union_cred); 98 0 stevel 99 0 stevel return (status); 100 0 stevel } 101