/*
* 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_inquire_cred
*/
#include <mglueP.h>
#include "gssapiP_generic.h"
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
name,
const gss_cred_id_t cred_handle;
int *cred_usage;
{
int i;
/* Initialize outputs. */
if (minor_status != NULL)
*minor_status = 0;
*name = GSS_C_NO_NAME;
if (mechanisms != NULL)
/* Validate arguments. */
if (minor_status == NULL)
return (GSS_S_CALL_INACCESSIBLE_WRITE);
if (cred_handle == GSS_C_NO_CREDENTIAL) {
/*
* No credential was supplied. This means we can't get a mechanism
* pointer to call the mechanism specific gss_inquire_cred.
* So, call get_mechanism with an arguement of GSS_C_NULL_OID.
* get_mechanism will return the first mechanism in the mech
* array, which becomes the default mechanism.
*/
return (GSS_S_DEFECTIVE_CREDENTIAL);
if (!mech->gss_inquire_cred)
return (GSS_S_UNAVAILABLE);
if (status != GSS_S_COMPLETE) {
return (status);
}
if (name) {
/*
* Convert internal_name into a union_name equivalent.
*/
if (status != GSS_S_COMPLETE) {
if (mechanisms && *mechanisms) {
(void) gss_release_oid_set(
}
return (status);
}
}
return (GSS_S_COMPLETE);
}
/* get the cred_handle cast as a union_credentials structure */
/*
* get the information out of the union_cred structure that was
* placed there during gss_acquire_cred.
*/
if (cred_usage != NULL)
}
/*
* if name is non_null,
* call gss_import_name() followed by gss_canonicalize_name()
* to get a mechanism specific name passed back to the caller.
* If this call fails, return failure to our caller.
* XXX The cred_handle may contain an array of mechanism OID's
* but we only return the MN for the first mechanism to the caller.
* In theory, we should modify this to provide an array of MN's
* one per mechanism back to the caller.
*/
*name = GSS_C_NO_NAME;
} else if ((gss_import_name(minor_status,
name) != GSS_S_COMPLETE) ||
&union_cred->mechs_array[0],
NULL) != GSS_S_COMPLETE)) {
goto error;
}
}
/*
* copy the mechanism set in union_cred into an OID set and return in
* the mechanisms parameter.
*/
if (mechanisms != NULL) {
if (*mechanisms == NULL)
goto error;
(*mechanisms)->count = 0;
(*mechanisms)->elements =
union_cred->count);
free(*mechanisms);
*mechanisms = NULL;
goto error;
}
for (i = 0; i < union_cred->count; i++) {
goto error;
&union_cred->mechs_array[i]);
(*mechanisms)->count++;
}
}
return (GSS_S_COMPLETE);
/*
* cleanup any allocated memory - we can just call
* gss_release_oid_set, because the set is constructed so that
* count always references the currently copied number of
* elements.
*/
return (status);
}
const gss_cred_id_t cred_handle;
{
if (minor_status != NULL)
*minor_status = 0;
*name = GSS_C_NO_NAME;
if (minor_status == NULL)
return (GSS_S_CALL_INACCESSIBLE_WRITE);
if (!mech)
return (GSS_S_BAD_MECH);
if (!mech->gss_inquire_cred_by_mech)
return (GSS_S_UNAVAILABLE);
return (GSS_S_DEFECTIVE_CREDENTIAL);
if (status != GSS_S_COMPLETE) {
return (status);
}
if (name) {
/*
* Convert internal_name into a union_name equivalent.
*/
if (status != GSS_S_COMPLETE) {
return (status);
}
}
} else {
return (GSS_S_UNAVAILABLE);
}
return (GSS_S_COMPLETE);
}