#define HEADER_LEN (sizeof(eap_mschapv2_header_t))
/**
- * Length of the header for MS-CHAPv2 success/failure packets (does not include
- * MS-CHAPv2-ID and MS-Length, i.e. 3 octets)
+ * Length of the header as used for MS-CHAPv2 success packets (does
+ * not include MS-CHAPv2-ID, MS-Length or any data, i.e. 3 octets)
*/
#define SHORT_HEADER_LEN (HEADER_LEN - 3)
chunk_t data, auth_string = chunk_empty;
char *message, *token, *msg = NULL;
int message_len;
- uint16_t len = SHORT_HEADER_LEN;
data = in->get_data(in);
eap = (eap_mschapv2_header_t*)data.ptr;
DBG1(DBG_IKE, "EAP-MS-CHAPv2 succeeded: '%s'", sanitize(msg));
- eap = alloca(len);
+ eap = alloca(HEADER_LEN);
eap->code = EAP_RESPONSE;
eap->identifier = this->identifier;
- eap->length = htons(len);
+ eap->length = htons(SHORT_HEADER_LEN);
eap->type = EAP_MSCHAPV2;
eap->opcode = MSCHAPV2_SUCCESS;
- *out = eap_payload_create_data(chunk_create((void*) eap, len));
+ *out = eap_payload_create_data(chunk_create((void*)eap, SHORT_HEADER_LEN));
status = NEED_MORE;
this->state = S_DONE;