From f48009d662f5f47c58cedbc3093efa145946ed85 Mon Sep 17 00:00:00 2001 From: Luke Howard Date: Thu, 10 Mar 2011 01:22:09 +1100 Subject: [PATCH] add some more assertion checks --- mech_eap/util_sm.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/mech_eap/util_sm.c b/mech_eap/util_sm.c index ae687ba..339d397 100644 --- a/mech_eap/util_sm.c +++ b/mech_eap/util_sm.c @@ -382,7 +382,7 @@ gssEapSmStep(OM_uint32 *minor, /* Format output token from inner tokens */ if (innerOutputTokens->count != 0 || /* inner tokens to send */ !CTX_IS_INITIATOR(ctx) || /* any leg acceptor */ - ctx->state != GSSEAP_STATE_ESTABLISHED) { /* non-last leg initiator */ + !CTX_IS_ESTABLISHED(ctx)) { /* non-last leg initiator */ tmpMajor = gssEapEncodeInnerTokens(&tmpMinor, innerOutputTokens, outputTokenTypes, &unwrappedOutputToken); if (tmpMajor == GSS_S_COMPLETE) { @@ -396,6 +396,9 @@ gssEapSmStep(OM_uint32 *minor, } } + /* If the context is established, empty tokens only to be emitted by initiator */ + assert(!CTX_IS_ESTABLISHED(ctx) || ((outputToken->length == 0) == CTX_IS_INITIATOR(ctx))); + SM_ASSERT_VALID(ctx, major); cleanup: -- 2.1.4