X-Git-Url: http://www.project-moonshot.org/gitweb/?p=mech_eap.git;a=blobdiff_plain;f=mech_eap%2Fexport_sec_context.c;h=3b7436667d36113c73f52216ef0d925cb8ab716f;hp=8695bf61779ddb49745352ade851566d6df20840;hb=HEAD;hpb=9c9f46eeed8ecbd816732d49d3f6ba9a5649fe71 diff --git a/mech_eap/export_sec_context.c b/mech_eap/export_sec_context.c index 8695bf6..3b74366 100644 --- a/mech_eap/export_sec_context.c +++ b/mech_eap/export_sec_context.c @@ -37,6 +37,7 @@ #include "gssapiP_eap.h" +#ifdef GSSEAP_ENABLE_ACCEPTOR static OM_uint32 gssEapExportPartialContext(OM_uint32 *minor, gss_ctx_id_t ctx, @@ -46,7 +47,6 @@ gssEapExportPartialContext(OM_uint32 *minor, size_t length, serverLen = 0; unsigned char *p; char serverBuf[MAXHOSTNAMELEN]; - if (ctx->acceptorCtx.radConn != NULL) { if (rs_conn_get_current_peer(ctx->acceptorCtx.radConn, serverBuf, sizeof(serverBuf)) != 0) { @@ -59,7 +59,6 @@ gssEapExportPartialContext(OM_uint32 *minor, } serverLen = strlen(serverBuf); } - length = 4 + serverLen + 4 + ctx->acceptorCtx.state.length; token->value = GSSEAP_MALLOC(length); @@ -87,7 +86,7 @@ gssEapExportPartialContext(OM_uint32 *minor, p += ctx->acceptorCtx.state.length; } - assert(p == (unsigned char *)token->value + token->length); + GSSEAP_ASSERT(p == (unsigned char *)token->value + token->length); major = GSS_S_COMPLETE; *minor = 0; @@ -98,6 +97,7 @@ cleanup: return major; } +#endif /* GSSEAP_ENABLE_ACCEPTOR */ OM_uint32 gssEapExportSecContext(OM_uint32 *minor, @@ -121,6 +121,11 @@ gssEapExportSecContext(OM_uint32 *minor, key.length = KRB_KEY_LENGTH(&ctx->rfc3961Key); key.value = KRB_KEY_DATA(&ctx->rfc3961Key); + /* + * As a shortcut, we omit the mechanism OID of the initiator name because + * we know it will match the context mechanism. The acceptor name mech OID + * is always included. + */ if (ctx->initiatorName != GSS_C_NO_NAME) { major = gssEapExportNameInternal(minor, ctx->initiatorName, &initiatorName, @@ -132,11 +137,12 @@ gssEapExportSecContext(OM_uint32 *minor, if (ctx->acceptorName != GSS_C_NO_NAME) { major = gssEapExportNameInternal(minor, ctx->acceptorName, &acceptorName, - EXPORT_NAME_FLAG_COMPOSITE); + EXPORT_NAME_FLAG_OID | EXPORT_NAME_FLAG_COMPOSITE); if (GSS_ERROR(major)) goto cleanup; } +#ifdef GSSEAP_ENABLE_ACCEPTOR /* * The partial context is only transmitted for unestablished acceptor * contexts. @@ -147,6 +153,7 @@ gssEapExportSecContext(OM_uint32 *minor, if (GSS_ERROR(major)) goto cleanup; } +#endif length = 16; /* version, state, flags, */ length += 4 + ctx->mechanismUsed->length; /* mechanismUsed */ @@ -193,7 +200,7 @@ gssEapExportSecContext(OM_uint32 *minor, if (partialCtx.value != NULL) p = store_buffer(&partialCtx, p, FALSE); - assert(p == (unsigned char *)token->value + token->length); + GSSEAP_ASSERT(p == (unsigned char *)token->value + token->length); major = GSS_S_COMPLETE; *minor = 0;