static OM_uint32 send_reject (OM_uint32 *minor_status, gss_buffer_t output_token) { NegTokenTarg targ; OM_uint32 ret; targ.negResult = malloc(sizeof(*targ.negResult)); if (targ.negResult == NULL) { *minor_status = ENOMEM; return GSS_S_FAILURE; } *(targ.negResult) = reject; targ.supportedMech = NULL; targ.responseToken = NULL; targ.mechListMIC = NULL; ret = code_NegTokenArg (minor_status, &targ, (unsigned char**) &output_token->value, &output_token->length); free_NegTokenTarg(&targ); if (ret) return ret; return GSS_S_BAD_MECH; }
static OM_uint32 send_accept (OM_uint32 *minor_status, gss_buffer_t output_token, gss_buffer_t mech_token) { NegTokenTarg targ; OM_uint32 ret; unsigned char *value = NULL; size_t length = 0; memset(&targ, 0, sizeof(targ)); targ.negResult = malloc(sizeof(*targ.negResult)); if (targ.negResult == NULL) { *minor_status = ENOMEM; return GSS_S_FAILURE; } *(targ.negResult) = accept_completed; targ.supportedMech = malloc(sizeof(*targ.supportedMech)); if (targ.supportedMech == NULL) { free_NegTokenTarg(&targ); *minor_status = ENOMEM; return GSS_S_FAILURE; } ret = der_get_oid(GSS_KRB5_MECH->elements, GSS_KRB5_MECH->length, targ.supportedMech, NULL); if (ret) { free_NegTokenTarg(&targ); *minor_status = ENOMEM; return GSS_S_FAILURE; } if (mech_token != NULL && mech_token->length != 0) { targ.responseToken = malloc(sizeof(*targ.responseToken)); if (targ.responseToken == NULL) { free_NegTokenTarg(&targ); *minor_status = ENOMEM; return GSS_S_FAILURE; } targ.responseToken->length = mech_token->length; targ.responseToken->data = mech_token->value; mech_token->length = 0; mech_token->value = NULL; } else { targ.responseToken = NULL; } ret = code_NegTokenArg (minor_status, &targ, &value, &length); output_token->value = value; output_token->length = length; free_NegTokenTarg(&targ); if (ret) return ret; return GSS_S_COMPLETE; }