g_store_cred.c revision 503a2b89eaf04b96af9e457a7806f65ce3e0b723
/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License (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 2009 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
/*
* glue routine for gss_store_cred
*/
#include <mechglueP.h>
static OM_uint32 val_store_cred_args(
const gss_cred_id_t input_cred_handle,
{
/* Initialize outputs. */
if (minor_status != NULL)
*minor_status = 0;
if (elements_stored != NULL)
/* Validate arguments. */
if (minor_status == NULL)
return (GSS_S_CALL_INACCESSIBLE_WRITE);
if (input_cred_handle == GSS_C_NO_CREDENTIAL)
return (GSS_S_CALL_INACCESSIBLE_READ | GSS_S_NO_CRED);
return (GSS_S_COMPLETE);
}
const gss_cred_id_t input_cred_handle;
const gss_OID desired_mech;
{
int i;
if (major_status != GSS_S_COMPLETE)
return (major_status);
/* Initial value needed below. */
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);
}