X-Git-Url: http://www.project-moonshot.org/gitweb/?a=blobdiff_plain;f=inquire_context.c;h=796f450bc56e5d24c2b4593bbeb3a344baa5f426;hb=1b40376cbe579a5b0c4da96bd7140e77356de5eb;hp=abe6c621ccfdde6c8efac6fe58fc8ddd0cbe39ad;hpb=0e14ab0c812cf75456b61b7ed5e235f8a3da9b87;p=mech_eap.orig diff --git a/inquire_context.c b/inquire_context.c index abe6c62..796f450 100644 --- a/inquire_context.c +++ b/inquire_context.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2010, JANET(UK) + * Copyright (c) 2011, JANET(UK) * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -30,6 +30,10 @@ * SUCH DAMAGE. */ +/* + * Return context handle properties. + */ + #include "gssapiP_eap.h" OM_uint32 @@ -45,21 +49,21 @@ gss_inquire_context(OM_uint32 *minor, { OM_uint32 major, tmpMinor; - *minor = 0; - if (ctx == GSS_C_NO_CONTEXT) { - major = GSS_S_NO_CONTEXT; - goto cleanup; + *minor = EINVAL; + return GSS_S_CALL_INACCESSIBLE_READ | GSS_S_NO_CONTEXT; } + GSSEAP_MUTEX_LOCK(&ctx->mutex); + if (src_name != NULL) { - major = gss_duplicate_name(minor, ctx->initiatorName, src_name); + major = gssEapDuplicateName(minor, ctx->initiatorName, src_name); if (GSS_ERROR(major)) goto cleanup; } if (targ_name != NULL) { - major = gss_duplicate_name(minor, ctx->acceptorName, targ_name); + major = gssEapDuplicateName(minor, ctx->acceptorName, targ_name); if (GSS_ERROR(major)) goto cleanup; } @@ -79,6 +83,14 @@ gss_inquire_context(OM_uint32 *minor, *lifetime_rec = lifetime; } + if (mech_type != NULL) { + if (!gssEapInternalizeOid(ctx->mechanismUsed, mech_type)) { + major = duplicateOid(minor, ctx->mechanismUsed, mech_type); + if (GSS_ERROR(major)) + goto cleanup; + } + } + if (ctx_flags != NULL) { *ctx_flags = ctx->gssFlags; } @@ -92,8 +104,11 @@ gss_inquire_context(OM_uint32 *minor, } major = GSS_S_COMPLETE; + *minor = 0; cleanup: + GSSEAP_MUTEX_UNLOCK(&ctx->mutex); + if (GSS_ERROR(major)) { gssEapReleaseName(&tmpMinor, src_name); gssEapReleaseName(&tmpMinor, targ_name);