2N/A/*
2N/A * CDDL HEADER START
2N/A *
2N/A * The contents of this file are subject to the terms of the
2N/A * Common Development and Distribution License (the "License").
2N/A * You may not use this file except in compliance with the License.
2N/A *
2N/A * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
2N/A * or http://www.opensolaris.org/os/licensing.
2N/A * See the License for the specific language governing permissions
2N/A * and limitations under the License.
2N/A *
2N/A * When distributing Covered Code, include this CDDL HEADER in each
2N/A * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
2N/A * If applicable, add the following below this CDDL HEADER, with the
2N/A * fields enclosed by brackets "[]" replaced with your own identifying
2N/A * information: Portions Copyright [yyyy] [name of copyright owner]
2N/A *
2N/A * CDDL HEADER END
2N/A */
2N/A/*
2N/A * Copyright (c) 1999, 2011, Oracle and/or its affiliates. All rights reserved.
2N/A */
2N/A
2N/A/*
2N/A * glue routine for gss_release_cred
2N/A */
2N/A
2N/A#include <mglueP.h>
2N/A#include "gssapiP_generic.h"
2N/A#include <stdio.h>
2N/A#ifdef HAVE_STDLIB_H
2N/A#include <stdlib.h>
2N/A#endif
2N/A
2N/AOM_uint32
2N/Agss_release_cred(minor_status,
2N/A cred_handle)
2N/A
2N/AOM_uint32 *minor_status;
2N/Agss_cred_id_t *cred_handle;
2N/A
2N/A{
2N/A OM_uint32 status, temp_status;
2N/A int j;
2N/A gss_union_cred_t union_cred;
2N/A gss_mechanism mech;
2N/A
2N/A if (minor_status == NULL)
2N/A return (GSS_S_CALL_INACCESSIBLE_WRITE);
2N/A
2N/A *minor_status = 0;
2N/A
2N/A if (cred_handle == NULL)
2N/A return (GSS_S_NO_CRED | GSS_S_CALL_INACCESSIBLE_READ);
2N/A
2N/A /*
2N/A * Loop through the union_cred struct, selecting the approprate
2N/A * underlying mechanism routine and calling it. At the end,
2N/A * release all of the storage taken by the union_cred struct.
2N/A */
2N/A
2N/A union_cred = (gss_union_cred_t)*cred_handle;
2N/A if (union_cred == (gss_union_cred_t)GSS_C_NO_CREDENTIAL)
2N/A return (GSS_S_COMPLETE);
2N/A
2N/A if (GSSINT_CHK_LOOP(union_cred))
2N/A return (GSS_S_NO_CRED | GSS_S_CALL_INACCESSIBLE_READ);
2N/A
2N/A *cred_handle = NULL;
2N/A
2N/A status = GSS_S_COMPLETE;
2N/A
2N/A for (j = 0; j < union_cred->count; j++) {
2N/A
2N/A mech = __gss_get_mechanism(&union_cred->mechs_array[j]);
2N/A
2N/A if (union_cred->mechs_array[j].elements)
2N/A free(union_cred->mechs_array[j].elements);
2N/A if (mech) {
2N/A if (mech->gss_release_cred) {
2N/A temp_status = mech->gss_release_cred
2N/A (minor_status,
2N/A &union_cred->cred_array[j]);
2N/A
2N/A if (temp_status != GSS_S_COMPLETE) {
2N/A map_error(minor_status, mech);
2N/A status = GSS_S_NO_CRED;
2N/A }
2N/A } else
2N/A status = GSS_S_UNAVAILABLE;
2N/A } else
2N/A status = GSS_S_DEFECTIVE_CREDENTIAL;
2N/A }
2N/A
2N/A (void) gss_release_buffer(minor_status, &union_cred->auxinfo.name);
2N/A free(union_cred->cred_array);
2N/A free(union_cred->mechs_array);
2N/A free(union_cred);
2N/A
2N/A return (status);
2N/A}