assert(toktype == TOK_TYPE_WRAP);
if (toktype != TOK_TYPE_WRAP) {
- code = EINVAL;
+ code = GSSEAP_WRONG_TOK_ID;
goto cleanup;
}
if (type == GSS_IOV_BUFFER_TYPE_DATA) {
if (data != NULL) {
/* only a single DATA buffer can appear */
- code = EINVAL;
+ code = GSSEAP_BAD_STREAM_IOV;
goto cleanup;
}
if (data == NULL) {
/* a single DATA buffer must be present */
- code = EINVAL;
+ code = GSSEAP_BAD_STREAM_IOV;
goto cleanup;
}
if (stream->buffer.length < theader->buffer.length +
tpadding->buffer.length +
ttrailer->buffer.length) {
- code = KRB5_BAD_MSIZE;
+ code = GSSEAP_WRONG_SIZE;
major = GSS_S_DEFECTIVE_TOKEN;
goto cleanup;
}
gss_iov_buffer_desc *iov,
int iov_count)
{
- OM_uint32 major = GSS_S_NO_CONTEXT;
+ OM_uint32 major;
if (ctx == GSS_C_NO_CONTEXT) {
*minor = EINVAL;
GSSEAP_MUTEX_LOCK(&ctx->mutex);
- if (CTX_IS_ESTABLISHED(ctx)) {
- major = gssEapUnwrapOrVerifyMIC(minor, ctx, conf_state, qop_state,
- iov, iov_count, TOK_TYPE_WRAP);
+ if (!CTX_IS_ESTABLISHED(ctx)) {
+ *minor = GSSEAP_CONTEXT_INCOMPLETE;
+ major = GSS_S_NO_CONTEXT;
+ goto cleanup;
}
+ major = gssEapUnwrapOrVerifyMIC(minor, ctx, conf_state, qop_state,
+ iov, iov_count, TOK_TYPE_WRAP);
+ if (GSS_ERROR(major))
+ goto cleanup;
+
+cleanup:
GSSEAP_MUTEX_UNLOCK(&ctx->mutex);
return major;