g_store_cred.c revision 7c478bd95313f5f23a4c958a745db2134aa03244
/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License, Version 1.0 only
* (the "License"). You may not use this file except in compliance
* with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
* Copyright 2004 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#pragma ident "%Z%%M% %I% %E% SMI"
/*
* glue routine for gss_store_cred
*/
#include <mechglueP.h>
const gss_cred_id_t input_cred_handle;
const gss_OID desired_mech;
{
int i;
/* Start by checking parameters */
if (minor_status == NULL)
return (GSS_S_CALL_INACCESSIBLE_WRITE|GSS_S_NO_CRED);
*minor_status = 0;
if (input_cred_handle == GSS_C_NO_CREDENTIAL)
return (GSS_S_CALL_INACCESSIBLE_READ);
if (elements_stored != NULL)
if (cred_usage_stored != NULL)
/* desired_mech != GSS_C_NULL_OID -> store one element */
if (desired_mech != GSS_C_NULL_OID) {
return (GSS_S_BAD_MECH);
return (major_status);
if (mech_cred == GSS_C_NO_CREDENTIAL)
return (GSS_S_NO_CRED);
}
/* desired_mech == GSS_C_NULL_OID -> store all elements */
*minor_status = 0;
for (i = 0; i < union_cred->count; i++) {
/* Get mech and cred element */
continue;
continue;
if (mech_cred == GSS_C_NO_CREDENTIAL)
continue; /* can't happen, but safe to ignore */
NULL,
if (major_status != GSS_S_COMPLETE)
continue;
/* Succeeded for at least one mech */
if (elements_stored == NULL)
continue;
if (*elements_stored == GSS_C_NULL_OID_SET) {
if (GSS_ERROR(major_status))
return (major_status);
}
/* The caller should clean up elements_stored */
if (GSS_ERROR(major_status))
return (major_status);
}
/*
* Success with some mechs may mask failure with others, but
* that's what elements_stored is for.
*/
return (major_status);
}