2 * peap.c contains the interfaces that are called from eap
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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
20 * Copyright 2003 Alan DeKok <aland@freeradius.org>
21 * Copyright 2006 The FreeRADIUS server project
24 #include <freeradius-devel/ident.h>
30 * Send protected EAP-Failure
32 * Result-TLV = Failure
34 static int eappeap_failure(EAP_HANDLER *handler, tls_session_t *tls_session)
36 uint8_t tlv_packet[11];
37 REQUEST *request = handler->request;
41 tlv_packet[0] = PW_EAP_REQUEST;
42 tlv_packet[1] = handler->eap_ds->response->id +1;
44 tlv_packet[3] = 11; /* length of this packet */
45 tlv_packet[4] = PW_EAP_TLV;
47 tlv_packet[6] = EAP_TLV_ACK_RESULT;
49 tlv_packet[8] = 2; /* length of the data portion */
51 tlv_packet[10] = EAP_TLV_FAILURE;
53 (tls_session->record_plus)(&tls_session->clean_in, tlv_packet, 11);
56 * FIXME: Check the return code.
58 tls_handshake_send(tls_session);
65 * Send protected EAP-Success
67 * Result-TLV = Success
69 static int eappeap_success(EAP_HANDLER *handler, tls_session_t *tls_session)
71 uint8_t tlv_packet[11];
72 REQUEST *request = handler->request;
76 tlv_packet[0] = PW_EAP_REQUEST;
77 tlv_packet[1] = handler->eap_ds->response->id +1;
79 tlv_packet[3] = 11; /* length of this packet */
80 tlv_packet[4] = PW_EAP_TLV;
81 tlv_packet[5] = 0x80; /* mandatory AVP */
82 tlv_packet[6] = EAP_TLV_ACK_RESULT;
84 tlv_packet[8] = 2; /* length of the data portion */
86 tlv_packet[10] = EAP_TLV_SUCCESS;
88 (tls_session->record_plus)(&tls_session->clean_in, tlv_packet, 11);
91 * FIXME: Check the return code.
93 tls_handshake_send(tls_session);
99 static int eappeap_identity(EAP_HANDLER *handler, tls_session_t *tls_session)
101 eap_packet_t eap_packet;
103 eap_packet.code = PW_EAP_REQUEST;
104 eap_packet.id = handler->eap_ds->response->id + 1;
105 eap_packet.length[0] = 0;
106 eap_packet.length[1] = EAP_HEADER_LEN + 1;
107 eap_packet.data[0] = PW_EAP_IDENTITY;
109 (tls_session->record_plus)(&tls_session->clean_in,
110 &eap_packet, sizeof(eap_packet));
112 tls_handshake_send(tls_session);
113 (tls_session->record_init)(&tls_session->clean_in);
120 * Verify the tunneled EAP message.
122 static int eapmessage_verify(REQUEST *request,
123 const uint8_t *data, unsigned int data_len)
125 const eap_packet_t *eap_packet = (const eap_packet_t *) data;
130 * No data, OR only 1 byte of EAP type.
132 if (!data || (data_len == 0) ||
133 ((data_len <= 1) && (data[0] != PW_EAP_IDENTITY))) {
139 case PW_EAP_IDENTITY:
141 RDEBUG2("Identity - ");
144 RDEBUG2("Identity - %*s",
145 data_len - 1, data + 1);
150 * If the first byte of the packet is
151 * EAP-Response, and the EAP data is a TLV,
152 * then it looks OK...
154 case PW_EAP_RESPONSE:
155 if (eap_packet->data[0] == PW_EAP_TLV) {
156 RDEBUG2("Received EAP-TLV response.");
159 RDEBUG2("Got something weird.");
164 * We normally do Microsoft MS-CHAPv2 (26), versus
165 * Cisco MS-CHAPv2 (29).
167 case PW_EAP_MSCHAPV2:
169 RDEBUG2("EAP type %s",
170 eaptype_type2name(eap_type,
171 buffer, sizeof(buffer)));
180 * Convert a pseudo-EAP packet to a list of VALUE_PAIR's.
182 static VALUE_PAIR *eap2vp(REQUEST *request, EAP_DS *eap_ds,
183 const uint8_t *data, size_t data_len)
186 VALUE_PAIR *vp = NULL, *head, **tail;
188 if (data_len > 65535) return NULL; /* paranoia */
190 vp = paircreate(PW_EAP_MESSAGE, 0, PW_TYPE_OCTETS);
192 RDEBUG2("Failure in creating VP");
197 if (total > 249) total = 249;
200 * Hand-build an EAP packet from the crap in PEAP version 0.
202 vp->vp_octets[0] = PW_EAP_RESPONSE;
203 vp->vp_octets[1] = eap_ds->response->id;
204 vp->vp_octets[2] = (data_len + EAP_HEADER_LEN) >> 8;
205 vp->vp_octets[3] = (data_len + EAP_HEADER_LEN) & 0xff;
207 memcpy(vp->vp_octets + EAP_HEADER_LEN, data, total);
208 vp->length = EAP_HEADER_LEN + total;
212 while (total < data_len) {
216 vp = paircreate(PW_EAP_MESSAGE, 0, PW_TYPE_OCTETS);
218 RDEBUG2("Failure in creating VP");
222 vp_len = (data_len - total);
223 if (vp_len > 253) vp_len = 253;
225 memcpy(vp->vp_octets, data + total, vp_len);
238 * Convert a list of VALUE_PAIR's to an EAP packet, through the
239 * simple expedient of dumping the EAP message
241 static int vp2eap(tls_session_t *tls_session, VALUE_PAIR *vp)
244 * Skip the id, code, and length. Just write the EAP
245 * type & data to the client.
248 if ((debug_flag > 2) && fr_log_fp) {
254 for (this = vp; this != NULL; this = this->next) {
257 if (this == vp) start = EAP_HEADER_LEN;
259 for (i = start; i < vp->length; i++) {
260 if ((total & 0x0f) == 0) fprintf(fr_log_fp, " PEAP tunnel data out %04x: ", (int) total);
262 fprintf(fr_log_fp, "%02x ", vp->vp_octets[i]);
264 if ((total & 0x0f) == 0x0f) fprintf(fr_log_fp, "\n");
268 if ((total & 0x0f) != 0) fprintf(fr_log_fp, "\n");
273 * Send the EAP data, WITHOUT the header.
275 (tls_session->record_plus)(&tls_session->clean_in,
276 vp->vp_octets + EAP_HEADER_LEN,
277 vp->length - EAP_HEADER_LEN);
280 * Send the rest of the EAP data.
282 for (vp = vp->next; vp != NULL; vp = vp->next) {
283 (tls_session->record_plus)(&tls_session->clean_in,
284 vp->vp_octets, vp->length);
287 tls_handshake_send(tls_session);
294 * See if there's a TLV in the response.
296 static int eappeap_check_tlv(REQUEST *request, const uint8_t *data)
298 const eap_packet_t *eap_packet = (const eap_packet_t *) data;
301 * Look for success or failure.
303 if ((eap_packet->code == PW_EAP_RESPONSE) &&
304 (eap_packet->data[0] == PW_EAP_TLV)) {
305 if (data[10] == EAP_TLV_SUCCESS) {
309 if (data[10] == EAP_TLV_FAILURE) {
310 RDEBUG2("Client rejected our response. The password is probably incorrect.");
320 * Use a reply packet to determine what to do.
322 static int process_reply(EAP_HANDLER *handler, tls_session_t *tls_session,
323 REQUEST *request, RADIUS_PACKET *reply)
325 int rcode = RLM_MODULE_REJECT;
327 peap_tunnel_t *t = tls_session->opaque;
329 if ((debug_flag > 0) && fr_log_fp) {
330 RDEBUG("Got tunneled reply RADIUS code %d",
333 debug_pair_list(reply->vps);
336 switch (reply->code) {
337 case PW_AUTHENTICATION_ACK:
338 RDEBUG2("Tunneled authentication was successful.");
339 t->status = PEAP_STATUS_SENT_TLV_SUCCESS;
340 eappeap_success(handler, tls_session);
341 rcode = RLM_MODULE_HANDLED;
344 * If we've been told to use the attributes from
345 * the reply, then do so.
347 * WARNING: This may leak information about the
350 if (t->use_tunneled_reply) {
351 RDEBUG2("Saving tunneled attributes for later");
354 * Clean up the tunneled reply.
356 pairdelete(&reply->vps, PW_PROXY_STATE, 0);
357 pairdelete(&reply->vps, PW_EAP_MESSAGE, 0);
358 pairdelete(&reply->vps, PW_MESSAGE_AUTHENTICATOR, 0);
361 * Delete MPPE keys & encryption policy. We don't
364 pairdelete(&reply->vps, 7, VENDORPEC_MICROSOFT);
365 pairdelete(&reply->vps, 8, VENDORPEC_MICROSOFT);
366 pairdelete(&reply->vps, 16, VENDORPEC_MICROSOFT);
367 pairdelete(&reply->vps, 17, VENDORPEC_MICROSOFT);
369 t->accept_vps = reply->vps;
374 case PW_AUTHENTICATION_REJECT:
375 RDEBUG2("Tunneled authentication was rejected.");
376 t->status = PEAP_STATUS_SENT_TLV_FAILURE;
377 eappeap_failure(handler, tls_session);
378 rcode = RLM_MODULE_HANDLED;
381 case PW_ACCESS_CHALLENGE:
382 RDEBUG2("Got tunneled Access-Challenge");
385 * Keep the State attribute, if necessary.
387 * Get rid of the old State, too.
390 pairmove2(&t->state, &(reply->vps), PW_STATE, 0);
393 * PEAP takes only EAP-Message attributes inside
394 * of the tunnel. Any Reply-Message in the
395 * Access-Challenge is ignored.
398 pairmove2(&vp, &(reply->vps), PW_EAP_MESSAGE, 0);
401 * Handle EAP-MSCHAP-V2, where Access-Accept's
402 * from the home server may contain MS-CHAP-Success,
403 * which the module turns into challenges, so that
404 * the client may respond to the challenge with
407 if (t->home_access_accept && t->use_tunneled_reply) {
408 RDEBUG2("Saving tunneled attributes for later");
411 * Clean up the tunneled reply.
413 pairdelete(&reply->vps, PW_PROXY_STATE, 0);
414 pairdelete(&reply->vps, PW_MESSAGE_AUTHENTICATOR, 0);
416 t->accept_vps = reply->vps;
421 * Handle the ACK, by tunneling any necessary reply
422 * VP's back to the client.
425 vp2eap(tls_session, vp);
429 rcode = RLM_MODULE_HANDLED;
433 RDEBUG2("Unknown RADIUS packet type %d: rejecting tunneled user", reply->code);
434 rcode = RLM_MODULE_REJECT;
443 * Do post-proxy processing,
445 static int eappeap_postproxy(EAP_HANDLER *handler, void *data)
448 tls_session_t *tls_session = (tls_session_t *) data;
449 REQUEST *fake, *request = handler->request;
451 RDEBUG2("Passing reply from proxy back into the tunnel.");
454 * If there was a fake request associated with the proxied
455 * request, do more processing of it.
457 fake = (REQUEST *) request_data_get(handler->request,
458 handler->request->proxy,
459 REQUEST_DATA_EAP_MSCHAP_TUNNEL_CALLBACK);
462 * Do the callback, if it exists, and if it was a success.
464 if (fake && (handler->request->proxy_reply->code == PW_AUTHENTICATION_ACK)) {
465 peap_tunnel_t *t = tls_session->opaque;
467 t->home_access_accept = TRUE;
472 rad_assert(fake->packet == NULL);
473 fake->packet = request->proxy;
474 fake->packet->src_ipaddr = request->packet->src_ipaddr;
475 request->proxy = NULL;
477 rad_assert(fake->reply == NULL);
478 fake->reply = request->proxy_reply;
479 request->proxy_reply = NULL;
481 if ((debug_flag > 0) && fr_log_fp) {
482 fprintf(fr_log_fp, "server %s {\n", fake->server);
486 * Perform a post-auth stage, which will get the EAP
489 fake->options &= ~RAD_REQUEST_OPTION_PROXY_EAP;
490 RDEBUG2("Passing reply back for EAP-MS-CHAP-V2");
491 rcode = module_post_proxy(0, fake);
494 * FIXME: If rcode returns fail, do something
497 rcode = rad_postauth(fake);
499 if ((debug_flag > 0) && fr_log_fp) {
500 fprintf(fr_log_fp, "} # server %s\n", fake->server);
502 RDEBUG("Final reply from tunneled session code %d",
505 debug_pair_list(fake->reply->vps);
511 request->proxy = fake->packet;
513 request->proxy_reply = fake->reply;
517 * And we're done with this request.
521 case RLM_MODULE_FAIL:
523 eaptls_fail(handler, 0);
527 default: /* Don't Do Anything */
528 RDEBUG2("Got reply %d", request->proxy_reply->code);
532 request_free(&fake); /* robust if fake == NULL */
535 * If there was no EAP-Message in the reply packet, then
536 * we know that we're supposed to re-run the "authenticate"
537 * stage, in order to get the right kind of handling...
541 * Process the reply from the home server.
544 rcode = process_reply(handler, tls_session, handler->request,
545 handler->request->proxy_reply);
548 * The proxy code uses the reply from the home server as
549 * the basis for the reply to the NAS. We don't want that,
550 * so we toss it, after we've had our way with it.
552 pairfree(&handler->request->proxy_reply->vps);
555 case RLM_MODULE_REJECT:
556 RDEBUG2("Reply was rejected");
557 eaptls_fail(handler, 0);
560 case RLM_MODULE_HANDLED:
561 RDEBUG2("Reply was handled");
562 eaptls_request(handler->eap_ds, tls_session);
566 RDEBUG2("Reply was OK");
569 * Success: Automatically return MPPE keys.
571 return eaptls_success(handler, 0);
574 RDEBUG2("Reply was unknown.");
578 eaptls_fail(handler, 0);
585 static void my_request_free(void *data)
587 REQUEST *request = (REQUEST *)data;
589 request_free(&request);
594 static void print_tunneled_data(uint8_t *data, size_t data_len)
598 if ((debug_flag > 2) && fr_log_fp) {
599 for (i = 0; i < data_len; i++) {
600 if ((i & 0x0f) == 0) fprintf(fr_log_fp, " PEAP tunnel data in %04x: ", i);
602 fprintf(fr_log_fp, "%02x ", data[i]);
604 if ((i & 0x0f) == 0x0f) fprintf(fr_log_fp, "\n");
606 if ((data_len & 0x0f) != 0) fprintf(fr_log_fp, "\n");
612 * Process the pseudo-EAP contents of the tunneled data.
614 int eappeap_process(EAP_HANDLER *handler, tls_session_t *tls_session)
616 peap_tunnel_t *t = tls_session->opaque;
619 int rcode = RLM_MODULE_REJECT;
621 unsigned int data_len;
623 REQUEST *request = handler->request;
624 EAP_DS *eap_ds = handler->eap_ds;
627 * Just look at the buffer directly, without doing
628 * record_minus. This lets us avoid another data copy.
630 data_len = tls_session->clean_out.used;
631 tls_session->clean_out.used = 0;
632 data = tls_session->clean_out.data;
634 if (!eapmessage_verify(request, data, data_len)) {
635 RDEBUG2("FAILED processing PEAP: Tunneled data is invalid.");
636 if (debug_flag > 2) print_tunneled_data(data, data_len);
637 return RLM_MODULE_REJECT;
642 * If we authenticated the user, then it's OK.
644 case PEAP_STATUS_SENT_TLV_SUCCESS:
645 if (eappeap_check_tlv(request, data)) {
647 return RLM_MODULE_OK;
651 * Otherwise, the client rejected the session
652 * resumption. If the session is being re-used,
653 * we need to do a full authentication.
655 * We do this by sending an EAP-Identity request
656 * inside of the PEAP tunnel.
658 if ((t->session_resumption_state != PEAP_RESUMPTION_NO) &&
659 SSL_session_reused(tls_session->ssl)) {
660 RDEBUG2("Client rejected session resumption. Re-starting full authentication");
663 * Mark session resumption status.
666 t->session_resumption_state = PEAP_RESUMPTION_NO;
668 eappeap_identity(handler, tls_session);
669 return RLM_MODULE_HANDLED;
672 return RLM_MODULE_REJECT;
675 * Damned if I know why the clients continue sending EAP
676 * packets after we told them to f*ck off.
678 case PEAP_STATUS_SENT_TLV_FAILURE:
679 RDEBUG(" The users session was previously rejected: returning reject (again.)");
680 RDEBUG(" *** This means you need to read the PREVIOUS messages in the debug output");
681 RDEBUG(" *** to find out the reason why the user was rejected.");
682 RDEBUG(" *** Look for \"reject\" or \"fail\". Those earlier messages will tell you.");
683 RDEBUG(" *** what went wrong, and how to fix the problem.");
684 return RLM_MODULE_REJECT;
687 fake = request_alloc_fake(request);
689 rad_assert(fake->packet->vps == NULL);
691 fake->packet->vps = eap2vp(request, eap_ds, data, data_len);
692 if (!fake->packet->vps) {
694 RDEBUG2("Unable to convert tunneled EAP packet to internal server data structures");
695 return PW_AUTHENTICATION_REJECT;
698 if ((debug_flag > 0) && fr_log_fp) {
699 RDEBUG("Got tunneled request");
701 debug_pair_list(fake->packet->vps);
703 fprintf(fr_log_fp, "server %s {\n",
704 (fake->server == NULL) ? "" : fake->server);
708 * Tell the request that it's a fake one.
710 vp = pairmake("Freeradius-Proxied-To", "127.0.0.1", T_OP_EQ);
712 pairadd(&fake->packet->vps, vp);
716 * Update other items in the REQUEST data structure.
720 * There's no User-Name in the tunneled session,
721 * so we add one here, by pulling it out of the
722 * EAP-Identity packet.
724 if ((data[0] == PW_EAP_IDENTITY) && (data_len > 1)) {
725 t->username = pairmake("User-Name", "", T_OP_EQ);
726 rad_assert(t->username != NULL);
728 memcpy(t->username->vp_strvalue, data + 1, data_len - 1);
729 t->username->length = data_len - 1;
730 t->username->vp_strvalue[t->username->length] = 0;
731 DEBUG2(" PEAP: Got tunneled identity of %s", t->username->vp_strvalue);
734 * If there's a default EAP type,
737 if (t->default_eap_type != 0) {
738 DEBUG2(" PEAP: Setting default EAP type for tunneled EAP session.");
739 vp = pairmake("EAP-Type", "0", T_OP_EQ);
740 vp->vp_integer = t->default_eap_type;
741 pairadd(&fake->config_items, vp);
744 } /* else there WAS a t->username */
747 vp = paircopy(t->username);
748 pairadd(&fake->packet->vps, vp);
749 fake->username = pairfind(fake->packet->vps, PW_USER_NAME, 0);
750 DEBUG2(" PEAP: Setting User-Name to %s",
751 fake->username->vp_strvalue);
755 * Add the State attribute, too, if it exists.
758 vp = paircopy(t->state);
759 if (vp) pairadd(&fake->packet->vps, vp);
763 * If this is set, we copy SOME of the request attributes
764 * from outside of the tunnel to inside of the tunnel.
766 * We copy ONLY those attributes which do NOT already
767 * exist in the tunneled request.
769 * This code is copied from ../rlm_eap_ttls/ttls.c
771 if (t->copy_request_to_tunnel) {
774 for (vp = request->packet->vps; vp != NULL; vp = vp->next) {
776 * The attribute is a server-side thingy,
779 if ((vp->attribute > 255) &&
785 * The outside attribute is already in the
786 * tunnel, don't copy it.
788 * This works for BOTH attributes which
789 * are originally in the tunneled request,
790 * AND attributes which are copied there
793 if (pairfind(fake->packet->vps, vp->attribute, vp->vendor)) {
798 * Some attributes are handled specially.
800 switch (vp->attribute) {
802 * NEVER copy Message-Authenticator,
803 * EAP-Message, or State. They're
804 * only for outside of the tunnel.
807 case PW_USER_PASSWORD:
808 case PW_CHAP_PASSWORD:
809 case PW_CHAP_CHALLENGE:
811 case PW_MESSAGE_AUTHENTICATOR:
818 * By default, copy it over.
825 * Don't copy from the head, we've already
828 copy = paircopy2(vp, vp->attribute, vp->vendor);
829 pairadd(&fake->packet->vps, copy);
833 if ((vp = pairfind(request->config_items, PW_VIRTUAL_SERVER, 0)) != NULL) {
834 fake->server = vp->vp_strvalue;
836 } else if (t->virtual_server) {
837 fake->server = t->virtual_server;
839 } /* else fake->server == request->server */
841 if ((debug_flag > 0) && fr_log_fp) {
842 fprintf(fr_log_fp, "Sending tunneled request\n");
844 debug_pair_list(fake->packet->vps);
846 fprintf(fr_log_fp, "server %s {\n",
847 (fake->server == NULL) ? "" : fake->server);
851 * Call authentication recursively, which will
852 * do PAP, CHAP, MS-CHAP, etc.
854 rad_authenticate(fake);
857 * Note that we don't do *anything* with the reply
860 if ((debug_flag > 0) && fr_log_fp) {
861 fprintf(fr_log_fp, "} # server %s\n",
862 (fake->server == NULL) ? "" : fake->server);
864 RDEBUG("Got tunneled reply code %d", fake->reply->code);
866 debug_pair_list(fake->reply->vps);
870 * Decide what to do with the reply.
872 switch (fake->reply->code) {
873 case 0: /* No reply code, must be proxied... */
875 vp = pairfind(fake->config_items, PW_PROXY_TO_REALM, 0);
878 eap_tunnel_data_t *tunnel;
881 * The tunneled request was NOT handled,
882 * it has to be proxied. This means that
883 * the "authenticate" stage was never
886 * If we are told to NOT proxy the
887 * tunneled request as EAP, then this
888 * means that we've got to decode it,
889 * which means that we MUST run the
890 * "authenticate" portion by hand, here.
892 * Once the tunneled EAP session is ALMOST
893 * done, THEN we proxy it...
895 if (!t->proxy_tunneled_request_as_eap) {
896 fake->options |= RAD_REQUEST_OPTION_PROXY_EAP;
899 * Hmm... should we check for
900 * Auth-Type & EAP-Message here?
905 * Run the EAP authentication.
907 DEBUG2(" PEAP: Calling authenticate in order to initiate tunneled EAP session.");
908 rcode = module_authenticate(PW_AUTHTYPE_EAP, fake);
909 if (rcode == RLM_MODULE_OK) {
911 * Authentication succeeded! Rah!
913 fake->reply->code = PW_AUTHENTICATION_ACK;
917 if (rcode != RLM_MODULE_HANDLED) {
918 DEBUG2(" PEAP: Can't handle the return code %d", rcode);
919 rcode = RLM_MODULE_REJECT;
924 * The module decided it wasn't
925 * done. Handle it like normal.
927 if ((fake->options & RAD_REQUEST_OPTION_PROXY_EAP) == 0) {
928 DEBUG2(" PEAP: Cancelling proxy to realm %s until the tunneled EAP session has been established", vp->vp_strvalue);
933 * The module has decoded the
934 * EAP-Message into another set
937 pairdelete(&fake->packet->vps,
941 DEBUG2(" PEAP: Tunneled authentication will be proxied to %s", vp->vp_strvalue);
944 * Tell the original request that it's going
947 pairmove2(&(request->config_items),
948 &(fake->config_items),
949 PW_PROXY_TO_REALM, 0);
952 * Seed the proxy packet with the
955 rad_assert(request->proxy == NULL);
956 request->proxy = fake->packet;
957 memset(&request->proxy->src_ipaddr, 0,
958 sizeof(request->proxy->src_ipaddr));
959 memset(&request->proxy->src_ipaddr, 0,
960 sizeof(request->proxy->src_ipaddr));
961 request->proxy->src_port = 0;
962 request->proxy->dst_port = 0;
964 rad_free(&fake->reply);
968 * Set up the callbacks for the tunnel
970 tunnel = rad_malloc(sizeof(*tunnel));
971 memset(tunnel, 0, sizeof(*tunnel));
973 tunnel->tls_session = tls_session;
974 tunnel->callback = eappeap_postproxy;
977 * Associate the callback with the request.
979 rcode = request_data_add(request,
981 REQUEST_DATA_EAP_TUNNEL_CALLBACK,
983 rad_assert(rcode == 0);
986 * We're not proxying it as EAP, so we've got
987 * to do the callback later.
989 if ((fake->options & RAD_REQUEST_OPTION_PROXY_EAP) != 0) {
990 DEBUG2(" PEAP: Remembering to do EAP-MS-CHAP-V2 post-proxy.");
993 * rlm_eap.c has taken care of associating
994 * the handler with the fake request.
996 * So we associate the fake request with
999 rcode = request_data_add(request,
1001 REQUEST_DATA_EAP_MSCHAP_TUNNEL_CALLBACK,
1002 fake, my_request_free);
1003 rad_assert(rcode == 0);
1006 * Do NOT free the fake request!
1008 return RLM_MODULE_UPDATED;
1012 * Didn't authenticate the packet, but
1013 * we're proxying it.
1015 rcode = RLM_MODULE_UPDATED;
1018 #endif /* WITH_PROXY */
1020 DEBUG2(" PEAP: Unknown RADIUS packet type %d: rejecting tunneled user", fake->reply->code);
1021 rcode = RLM_MODULE_REJECT;
1027 rcode = process_reply(handler, tls_session, request,
1033 request_free(&fake);