/*
* 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
*/
/*
*/
/*
* glue routine for gss_store_cred
*/
#include <mglueP.h>
#include "gssapiP_generic.h"
#include <errno.h>
static OM_uint32
const gss_cred_id_t input_cred_handle,
/*LINTED*/
const gss_OID desired_mech,
/*LINTED*/
/*LINTED*/
/*LINTED*/
{
/* 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);
if (cred_usage != GSS_C_ACCEPT &&
cred_usage != GSS_C_INITIATE &&
cred_usage != GSS_C_BOTH) {
if (minor_status) {
*minor_status = EINVAL;
}
return (GSS_S_FAILURE);
}
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);
if (major_status != GSS_S_COMPLETE)
return (major_status);
}
/* 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);
}