#include "mglueP.h"
#ifdef HAVE_STDLIB_H
#include <stdlib.h>
#endif
OM_uint32 KRB5_CALLCONV
gss_inquire_context(
minor_status,
context_handle,
src_name,
targ_name,
lifetime_rec,
mech_type,
ctx_flags,
locally_initiated,
open)
OM_uint32 * minor_status;
gss_ctx_id_t context_handle;
gss_name_t * src_name;
gss_name_t * targ_name;
OM_uint32 * lifetime_rec;
gss_OID * mech_type;
OM_uint32 * ctx_flags;
int * locally_initiated;
int * open;
{
gss_union_ctx_id_t ctx;
gss_mechanism mech;
OM_uint32 status, temp_minor;
gss_initialize();
if(context_handle == GSS_C_NO_CONTEXT)
return(GSS_S_NO_CONTEXT);
ctx = (gss_union_ctx_id_t) context_handle;
mech = __gss_get_mechanism (ctx->mech_type);
if (!mech || !mech->gss_inquire_context || !mech->gss_display_name) {
return(GSS_S_NO_CONTEXT);
}
status = mech->gss_inquire_context(
mech->context,
minor_status,
ctx->internal_ctx_id,
src_name,
targ_name,
lifetime_rec,
mech_type,
ctx_flags,
locally_initiated,
open);
if (status != GSS_S_COMPLETE) {
return status;
}
if (src_name) {
status = __gss_convert_name_to_union_name(minor_status, mech,
*src_name, src_name);
if (status != GSS_S_COMPLETE) {
(void) mech->gss_release_name(mech->context,
&temp_minor, src_name);
(void) mech->gss_release_name(mech->context,
&temp_minor, targ_name);
if (mech_type) {
gss_release_oid(&temp_minor, mech_type);
}
return (GSS_S_FAILURE);
}
}
if (targ_name) {
status = __gss_convert_name_to_union_name(minor_status, mech,
*targ_name, targ_name);
if (status != GSS_S_COMPLETE) {
if (mech_type) {
gss_release_oid(&temp_minor, mech_type);
}
return (GSS_S_FAILURE);
}
}
return(GSS_S_COMPLETE);
}