{
OM_uint32 major;
- if (ctx == GSS_C_NO_CONTEXT)
+ if (ctx == GSS_C_NO_CONTEXT) {
+ *minor = EINVAL;
return GSS_S_NO_CONTEXT;
+ }
+
+ *minor = 0;
GSSEAP_MUTEX_LOCK(&ctx->mutex);
if (!CTX_IS_ESTABLISHED(ctx)) {
- *minor = 0;
+ *minor = GSSEAP_CONTEXT_INCOMPLETE;
major = GSS_S_NO_CONTEXT;
- } else {
- major = gssEapWrap(minor, ctx, conf_req_flag, qop_req,
- input_message_buffer,
- conf_state, output_message_buffer);
+ goto cleanup;
}
+ major = gssEapWrap(minor, ctx, conf_req_flag, qop_req,
+ input_message_buffer,
+ conf_state, output_message_buffer);
+ if (GSS_ERROR(major))
+ goto cleanup;
+
+cleanup:
GSSEAP_MUTEX_UNLOCK(&ctx->mutex);
return major;