6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20 * Copyright 2001 hereUare Communications, Inc. <raghud@hereuare.com>
21 * Copyright 2003 Alan DeKok <aland@freeradius.org>
26 * TLS Packet Format in EAP
27 * --- ------ ------ -- ---
29 * 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
30 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
31 * | Code | Identifier | Length |
32 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
33 * | Type | Flags | TLS Message Length
34 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
35 * | TLS Message Length | TLS Data...
36 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
43 * Allocate a new TLS_PACKET
45 EAPTLS_PACKET *eaptls_alloc(void)
49 if ((rp = malloc(sizeof(EAPTLS_PACKET))) == NULL) {
50 radlog(L_ERR, "rlm_eap_tls: out of memory");
53 memset(rp, 0, sizeof(EAPTLS_PACKET));
60 void eaptls_free(EAPTLS_PACKET **eaptls_packet_ptr)
62 EAPTLS_PACKET *eaptls_packet;
64 if (!eaptls_packet_ptr) return;
65 eaptls_packet = *eaptls_packet_ptr;
66 if (eaptls_packet == NULL) return;
68 if (eaptls_packet->data) {
69 free(eaptls_packet->data);
70 eaptls_packet->data = NULL;
74 *eaptls_packet_ptr = NULL;
78 The S flag is set only within the EAP-TLS start message
79 sent from the EAP server to the peer.
81 int eaptls_start(EAP_DS *eap_ds, int peap_flag)
85 reply.code = EAPTLS_START;
86 reply.length = TLS_HEADER_LEN + 1/*flags*/;
88 reply.flags = peap_flag;
89 reply.flags = SET_START(reply.flags);
94 eaptls_compose(eap_ds, &reply);
99 int eaptls_success(EAP_DS *eap_ds, int peap_flag)
103 reply.code = EAPTLS_SUCCESS;
104 reply.length = TLS_HEADER_LEN;
105 reply.flags = peap_flag;
109 eaptls_compose(eap_ds, &reply);
114 int eaptls_fail(EAP_DS *eap_ds, int peap_flag)
118 reply.code = EAPTLS_FAIL;
119 reply.length = TLS_HEADER_LEN;
120 reply.flags = peap_flag;
124 eaptls_compose(eap_ds, &reply);
130 A single TLS record may be up to 16384 octets in length, but a TLS
131 message may span multiple TLS records, and a TLS certificate message
132 may in principle be as long as 16MB.
136 * Frame the Dirty data that needs to be send to the client in an
137 * EAP-Request. We always embed the TLS-length in all EAP-TLS
138 * packets that we send, for easy reference purpose. Handle
139 * fragmentation and sending the next fragment etc.
141 int eaptls_request(EAP_DS *eap_ds, tls_session_t *ssn)
146 unsigned int lbit = 0;
148 /* This value determines whether we set (L)ength flag for
149 EVERY packet we send and add corresponding
150 "TLS Message Length" field.
153 This means we include L flag and "TLS Msg Len" in EVERY
157 This means we include L flag and "TLS Msg Len" **ONLY**
158 in First packet of a fragment series. We do not use
161 Having L flag in every packet is prefered.
164 if (ssn->length_flag) {
167 if (ssn->fragment == 0) {
168 ssn->tls_msg_len = ssn->dirty_out.used;
171 reply.code = EAPTLS_REQUEST;
172 reply.flags = ssn->peap_flag;
174 /* Send data, NOT more than the FRAGMENT size */
175 if (ssn->dirty_out.used > ssn->offset) {
177 reply.flags = SET_MORE_FRAGMENTS(reply.flags);
178 /* Length MUST be included if it is the First Fragment */
179 if (ssn->fragment == 0) {
184 size = ssn->dirty_out.used;
188 reply.dlen = lbit + size;
189 reply.length = TLS_HEADER_LEN + 1/*flags*/ + reply.dlen;
191 reply.data = malloc(reply.dlen);
193 nlen = htonl(ssn->tls_msg_len);
194 memcpy(reply.data, &nlen, lbit);
195 reply.flags = SET_LENGTH_INCLUDED(reply.flags);
197 (ssn->record_minus)(&ssn->dirty_out, reply.data + lbit, size);
199 eaptls_compose(eap_ds, &reply);
207 * Acknowledge received is for one of the following messages sent earlier
208 * 1. Handshake completed Message, so now send, EAP-Success
209 * 2. Alert Message, now send, EAP-Failure
210 * 3. Fragment Message, now send, next Fragment
212 static eaptls_status_t eaptls_ack_handler(EAP_HANDLER *handler)
214 tls_session_t *tls_session;
216 tls_session = (tls_session_t *)handler->opaque;
217 if (tls_session == NULL){
218 radlog(L_ERR, "rlm_eap_tls: Unexpected ACK received");
221 if (tls_session->info.initialized == 0) {
222 DEBUG(" rlm_eap_tls: No SSL info available. Waiting for more SSL data.");
223 return EAPTLS_REQUEST;
225 if (tls_session->info.origin == 0) {
226 radlog(L_ERR, "rlm_eap_tls: Unexpected ACK received");
230 switch (tls_session->info.content_type) {
232 DEBUG2(" rlm_eap_tls: ack alert");
233 eaptls_fail(handler->eap_ds, tls_session->peap_flag);
237 if (tls_session->info.handshake_type == finished) {
238 DEBUG2(" rlm_eap_tls: ack handshake is finished");
239 return EAPTLS_SUCCESS;
242 DEBUG2(" rlm_eap_tls: ack handshake fragment handler");
243 /* Fragmentation handler, send next fragment */
244 return EAPTLS_REQUEST;
247 * For the rest of the conditions, switch over
248 * to the default section below.
251 DEBUG2(" rlm_eap_tls: ack default");
252 radlog(L_ERR, "rlm_eap_tls: Invalid ACK received: %d",
253 tls_session->info.content_type);
259 * Similarly, when the EAP server receives an EAP-Response with
260 * the M bit set, it MUST respond with an EAP-Request with
261 * EAP-Type=EAP-TLS and no data. This serves as a fragment ACK.
263 * In order to prevent errors in the processing of fragments, the
264 * EAP server MUST use increment the Identifier value for each
265 * fragment ACK contained within an EAP-Request, and the peer
266 * MUST include this Identifier value in the subsequent fragment
267 * contained within an EAP- Reponse.
269 * EAP server sends an ACK when it determines there are More
270 * fragments to receive to make the complete
271 * TLS-record/TLS-Message
273 static int eaptls_send_ack(EAP_DS *eap_ds, int peap_flag)
277 reply.code = EAPTLS_ACK;
278 reply.length = TLS_HEADER_LEN + 1/*flags*/;
279 reply.flags = peap_flag;
283 eaptls_compose(eap_ds, &reply);
289 * The S flag is set only within the EAP-TLS start message sent
290 * from the EAP server to the peer.
292 * Similarly, when the EAP server receives an EAP-Response with
293 * the M bit set, it MUST respond with an EAP-Request with
294 * EAP-Type=EAP-TLS and no data. This serves as a fragment
295 * ACK. The EAP peer MUST wait.
297 static eaptls_status_t eaptls_verify(EAP_HANDLER *handler)
299 EAP_DS *eap_ds = handler->eap_ds;
300 EAP_DS *prev_eap_ds = handler->prev_eapds;
301 eaptls_packet_t *eaptls_packet, *eaptls_prev = NULL;
304 * We don't check ANY of the input parameters. It's all
305 * code which works together, so if something is wrong,
306 * we SHOULD core dump.
308 * e.g. if eap_ds is NULL, of if eap_ds->response is
309 * NULL, of if it's NOT an EAP-Response, or if the packet
310 * is too short. See eap_validation()., in ../../eap.c
312 * Also, eaptype_select() takes care of selecting the
313 * appropriate type, so we don't need to check
314 * eap_ds->response->type.type == PW_EAP_TLS, or anything
317 eaptls_packet = (eaptls_packet_t *)eap_ds->response->type.data;
318 if (prev_eap_ds && prev_eap_ds->response)
319 eaptls_prev = (eaptls_packet_t *)prev_eap_ds->response->type.data;
324 * If there's no TLS data, or there's 1 byte of TLS data,
325 * with the flags set to zero, then it's an ACK.
327 * Find if this is a reply to the previous request sent
329 if ((eaptls_packet == NULL) ||
330 ((eap_ds->response->length == EAP_HEADER_LEN + 2) &&
331 ((eaptls_packet->flags & 0xc0) == 0x00))) {
333 if (prev_eap_ds->request->id == eap_ds->response->id) {
335 * Run the ACK handler directly from here.
337 DEBUG2("rlm_eap_tls: Received EAP-TLS ACK message");
338 return eaptls_ack_handler(handler);
340 radlog(L_ERR, "rlm_eap_tls: Received Invalid EAP-TLS ACK message");
341 return EAPTLS_INVALID;
346 * We send TLS_START, but do not receive it.
348 if (TLS_START(eaptls_packet->flags)) {
349 radlog(L_ERR, "rlm_eap_tls: Received unexpected EAP-TLS Start message");
350 return EAPTLS_INVALID;
354 * The L bit (length included) is set to indicate the
355 * presence of the four octet TLS Message Length field,
356 * and MUST be set for the first fragment of a fragmented
357 * TLS message or set of messages.
359 * The M bit (more fragments) is set on all but the last
362 * The S bit (EAP-TLS start) is set in an EAP-TLS Start
363 * message. This differentiates the EAP-TLS Start message
364 * from a fragment acknowledgement.
366 if (TLS_LENGTH_INCLUDED(eaptls_packet->flags)) {
367 if (TLS_MORE_FRAGMENTS(eaptls_packet->flags)) {
369 * FIRST_FRAGMENT is identified
370 * 1. If there is no previous EAP-response received.
371 * 2. If EAP-response received, then its M bit not set.
372 * (It is because Last fragment will not have M bit set)
374 if ((prev_eap_ds->response == NULL) ||
375 (eaptls_prev == NULL) ||
376 !TLS_MORE_FRAGMENTS(eaptls_prev->flags)) {
378 DEBUG2("rlm_eap_tls: Received EAP-TLS First Fragment of the message");
379 return EAPTLS_FIRST_FRAGMENT;
382 DEBUG2("rlm_eap_tls: More Fragments with length included");
383 return EAPTLS_MORE_FRAGMENTS_WITH_LENGTH;
387 DEBUG2("rlm_eap_tls: Length Included");
388 return EAPTLS_LENGTH_INCLUDED;
392 if (TLS_MORE_FRAGMENTS(eaptls_packet->flags)) {
393 DEBUG2("rlm_eap_tls: More fragments to follow");
394 return EAPTLS_MORE_FRAGMENTS;
398 * None of the flags are set, but it's still a valid
408 * length = code + id + length + flags + tlsdata
409 * = 1 + 1 + 2 + 1 + X
410 * length = EAP-length - 1(EAP-Type = 1 octet)
411 * flags = EAP-typedata[0] (1 octet)
412 * dlen = EAP-typedata[1-4] (4 octets), if L flag set
413 * = length - 5(code+id+length+flags), otherwise
414 * data = EAP-typedata[5-n], if L flag set
415 * = EAP-typedata[1-n], otherwise
416 * packet = EAP-typedata (complete typedata)
418 * Points to consider during EAP-TLS data extraction
419 * 1. In the received packet, No data will be present incase of ACK-NAK
420 * 2. Incase if more fragments need to be received then ACK after retreiving this fragment.
422 * RFC 2716 Section 4.2. PPP EAP TLS Request Packet
425 * 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
426 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
427 * | Code | Identifier | Length |
428 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
429 * | Type | Flags | TLS Message Length
430 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
431 * | TLS Message Length | TLS Data...
432 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
434 * The Length field is two octets and indicates the length of the EAP
435 * packet including the Code, Identifir, Length, Type, and TLS data
438 static EAPTLS_PACKET *eaptls_extract(EAP_DS *eap_ds, eaptls_status_t status)
440 EAPTLS_PACKET *tlspacket;
441 uint32_t data_len = 0;
443 uint8_t *data = NULL;
445 if (status == EAPTLS_INVALID)
449 * The main EAP code & eaptls_verify() take care of
450 * ensuring that the packet is OK, and that we can
451 * extract the various fields we want.
453 * e.g. a TLS packet with zero data is allowed as an ACK,
454 * but we will never see it here, as we will simply
455 * send another fragment, instead of trying to extract
458 * MUST have TLS type octet, followed by flags, followed
461 rad_assert(eap_ds->response->length > 2);
463 tlspacket = eaptls_alloc();
464 if (tlspacket == NULL) return NULL;
467 * Code & id for EAPTLS & EAP are same
468 * but eaptls_length = eap_length - 1(EAP-Type = 1 octet)
470 * length = code + id + length + type + tlsdata
471 * = 1 + 1 + 2 + 1 + X
473 tlspacket->code = eap_ds->response->code;
474 tlspacket->id = eap_ds->response->id;
475 tlspacket->length = eap_ds->response->length - 1; /* EAP type */
476 tlspacket->flags = eap_ds->response->type.data[0];
479 * A quick sanity check of the flags. If we've been told
480 * that there's a length, and there isn't one, then stop.
482 if (TLS_LENGTH_INCLUDED(tlspacket->flags) &&
483 (tlspacket->length < 5)) { /* flags + TLS message length */
484 radlog(L_ERR, "rlm_eap_tls: Invalid EAP-TLS packet received. (Length bit is set, but no length was found.)");
485 eaptls_free(&tlspacket);
490 * If the final TLS packet is larger than we can handle, die
493 * Likewise, if the EAP packet says N bytes, and the TLS
494 * packet says there's fewer bytes, it's a problem.
496 * FIXME: Try to ensure that the claimed length is
497 * consistent across multiple TLS fragments.
499 if (TLS_LENGTH_INCLUDED(tlspacket->flags)) {
500 memcpy(&data_len, &eap_ds->response->type.data[1], 4);
501 data_len = ntohl(data_len);
502 if (data_len > MAX_RECORD_SIZE) {
503 radlog(L_ERR, "rlm_eap_tls: The EAP-TLS packet will contain more data than we can process.");
504 eaptls_free(&tlspacket);
509 DEBUG2(" TLS: %d %d\n", data_len, tlspacket->length);
511 if (data_len < tlspacket->length) {
512 radlog(L_ERR, "rlm_eap_tls: EAP-TLS packet claims to be smaller than the encapsulating EAP packet.");
513 eaptls_free(&tlspacket);
521 * The TLS Message Length field is four octets, and
522 * provides the total length of the TLS message or set of
523 * messages that is being fragmented; this simplifies
526 * Dynamic allocation of buffers as & when we know the
527 * length should solve the problem.
529 case EAPTLS_FIRST_FRAGMENT:
530 case EAPTLS_LENGTH_INCLUDED:
531 case EAPTLS_MORE_FRAGMENTS_WITH_LENGTH:
532 if (tlspacket->length < 5) { /* flags + TLS message length */
533 radlog(L_ERR, "rlm_eap_tls: Invalid EAP-TLS packet received. (Expected length, got none.)");
534 eaptls_free(&tlspacket);
539 * Extract all the TLS fragments from the
540 * previous eap_ds Start appending this
541 * fragment to the above ds
543 memcpy(&data_len, &eap_ds->response->type.data[1], sizeof(uint32_t));
544 data_len = ntohl(data_len);
545 data = (eap_ds->response->type.data + 5/*flags+TLS-Length*/);
546 len = eap_ds->response->type.length - 5/*flags+TLS-Length*/;
549 * Hmm... this should be an error, too.
551 if (data_len > len) {
557 * Data length is implicit, from the EAP header.
559 case EAPTLS_MORE_FRAGMENTS:
561 data_len = eap_ds->response->type.length - 1/*flags*/;
562 data = eap_ds->response->type.data + 1/*flags*/;
566 radlog(L_ERR, "rlm_eap_tls: Invalid EAP-TLS packet received");
567 eaptls_free(&tlspacket);
571 tlspacket->dlen = data_len;
573 tlspacket->data = (unsigned char *)malloc(data_len);
574 if (tlspacket->data == NULL) {
575 radlog(L_ERR, "rlm_eap_tls: out of memory");
576 eaptls_free(&tlspacket);
579 memcpy(tlspacket->data, data, data_len);
588 * To process the TLS,
590 * 1. EAP-TLS should get the compelete TLS data from the peer.
591 * 2. Store that data in a data structure with any other required info
592 * 3. Handle that data structure to the TLS module.
593 * 4. TLS module will perform its operations on the data and
594 * handle back to EAP-TLS
597 * 1. EAP-TLS if necessary will fragment it and send it to the
600 * During EAP-TLS initialization, TLS Context object will be
601 * initialized and stored. For every new authentication
602 * requests, TLS will open a new session object and that session
603 * object should be maintained even after the session is
604 * completed for session resumption. (Probably later as a feature
605 * as we donot know who maintains these session objects ie,
606 * SSL_CTX (internally) or TLS module(explicitly). If TLS module,
607 * then how to let SSL API know about these sessions.)
609 static void eaptls_operation(EAPTLS_PACKET *eaptls_packet UNUSED,
610 eaptls_status_t status, EAP_HANDLER *handler)
612 tls_session_t *tls_session;
614 tls_session = (tls_session_t *)handler->opaque;
616 if ((status == EAPTLS_MORE_FRAGMENTS) ||
617 (status == EAPTLS_MORE_FRAGMENTS_WITH_LENGTH) ||
618 (status == EAPTLS_FIRST_FRAGMENT)) {
622 eaptls_send_ack(handler->eap_ds, tls_session->peap_flag);
625 * We have the complete TLS-data or TLS-message.
627 * Clean the dirty message.
629 * Authenticate the user and send
633 * is required then send another request. */
634 if (tls_handshake_recv(tls_session)) {
636 * FIXME: return success/fail.
638 * TLS proper can decide what to do, then.
640 eaptls_request(handler->eap_ds, tls_session);
642 eaptls_fail(handler->eap_ds, tls_session->peap_flag);
650 * In the actual authentication first verify the packet and then create the data structure
653 * To process the TLS,
655 * 1. EAP-TLS should get the compelete TLS data from the peer.
656 * 2. Store that data in a data structure with any other required info
657 * 3. Hand this data structure to the TLS module.
658 * 4. TLS module will perform its operations on the data and hands back to EAP-TLS
660 * 1. EAP-TLS if necessary will fragment it and send it to the destination.
662 * During EAP-TLS initialization, TLS Context object will be
663 * initialized and stored. For every new authentication
664 * requests, TLS will open a new session object and that
665 * session object SHOULD be maintained even after the session
666 * is completed, for session resumption. (Probably later as a
667 * feature, as we do not know who maintains these session
668 * objects ie, SSL_CTX (internally) or TLS module (explicitly). If
669 * TLS module, then how to let SSL API know about these
674 * Process an EAP request
676 eaptls_status_t eaptls_process(EAP_HANDLER *handler)
678 tls_session_t *tls_session = (tls_session_t *) handler->opaque;
679 EAPTLS_PACKET *tlspacket;
680 eaptls_status_t status;
682 DEBUG2(" rlm_eap_tls: processing TLS");
684 /* This case is when SSL generates Alert then we
685 * send that alert to the client and then send the EAP-Failure
687 status = eaptls_verify(handler);
688 DEBUG2(" eaptls_verify returned %d\n", status);
696 * Success means that we're done the initial
697 * handshake. For TTLS, this means send stuff
698 * back to the client, and the client sends us
699 * more tunneled data.
706 * Normal TLS request, continue with the "get rest
707 * of fragments" phase.
710 eaptls_request(handler->eap_ds, tls_session);
711 return EAPTLS_HANDLED;
715 * The handshake is done, and we're in the "tunnel
719 DEBUG2(" rlm_eap_tls: Done initial handshake");
722 * Get the rest of the fragments.
724 case EAPTLS_FIRST_FRAGMENT:
725 case EAPTLS_MORE_FRAGMENTS:
726 case EAPTLS_LENGTH_INCLUDED:
727 case EAPTLS_MORE_FRAGMENTS_WITH_LENGTH:
732 * Extract the TLS packet from the buffer.
734 if ((tlspacket = eaptls_extract(handler->eap_ds, status)) == NULL)
738 * Get the session struct from the handler
740 * update the dirty_in buffer
742 * NOTE: This buffer will contain partial data when M bit is set.
744 * CAUTION while reinitializing this buffer, it should be
745 * reinitialized only when this M bit is NOT set.
747 if (tlspacket->dlen !=
748 (tls_session->record_plus)(&tls_session->dirty_in, tlspacket->data, tlspacket->dlen)) {
749 eaptls_free(&tlspacket);
750 radlog(L_ERR, "rlm_eap_tls: Exceeded maximum record size");
755 * SSL initalization is done. Return.
757 * The TLS data will be in the tls_session structure.
759 if (SSL_is_init_finished(tls_session->ssl)) {
760 eaptls_free(&tlspacket);
765 * Continue the handshake.
767 eaptls_operation(tlspacket, status, handler);
769 eaptls_free(&tlspacket);
770 return EAPTLS_HANDLED;
775 * compose the TLS reply packet in the EAP reply typedata
777 int eaptls_compose(EAP_DS *eap_ds, EAPTLS_PACKET *reply)
782 * Don't set eap_ds->request->type.type, as the main EAP
783 * handler will do that for us. This allows the TLS
784 * module to be called from TTLS & PEAP.
788 * When the EAP server receives an EAP-Response with the
789 * M bit set, it MUST respond with an EAP-Request with
790 * EAP-Type=EAP-TLS and no data. This serves as a
791 * fragment ACK. The EAP peer MUST wait until it receives
792 * the EAP-Request before sending another fragment.
794 * In order to prevent errors in the processing of
795 * fragments, the EAP server MUST use increment the
796 * Identifier value for each fragment ACK contained
797 * within an EAP-Request, and the peer MUST include this
798 * Identifier value in the subsequent fragment contained
799 * within an EAP- Reponse.
801 eap_ds->request->type.data = malloc(reply->length - TLS_HEADER_LEN + 1);
802 if (eap_ds->request->type.data == NULL) {
803 radlog(L_ERR, "rlm_eap_tls: out of memory");
807 /* EAPTLS Header length is excluded while computing EAP typelen */
808 eap_ds->request->type.length = reply->length - TLS_HEADER_LEN;
810 ptr = eap_ds->request->type.data;
811 *ptr++ = (uint8_t)(reply->flags & 0xFF);
813 if (reply->dlen) memcpy(ptr, reply->data, reply->dlen);
815 switch (reply->code) {
819 eap_ds->request->code = PW_EAP_REQUEST;
822 eap_ds->request->code = PW_EAP_SUCCESS;
825 eap_ds->request->code = PW_EAP_FAILURE;
828 /* Should never enter here */
829 eap_ds->request->code = PW_EAP_FAILURE;