From: Arran Cudbard-Bell Date: Sun, 1 Jun 2025 15:39:32 +0000 (-0600) Subject: Notes on how subrequests are handled in peap.c X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=fc07d6221cf6c5ebe54ad4e8388422ee85375177;p=thirdparty%2Ffreeradius-server.git Notes on how subrequests are handled in peap.c --- diff --git a/src/modules/rlm_eap/types/rlm_eap_peap/peap.c b/src/modules/rlm_eap/types/rlm_eap_peap/peap.c index 2b409d33998..07df095ae61 100644 --- a/src/modules/rlm_eap/types/rlm_eap_peap/peap.c +++ b/src/modules/rlm_eap/types/rlm_eap_peap/peap.c @@ -583,6 +583,10 @@ unlang_action_t eap_peap_process(unlang_result_t *p_result, request_t *request, RDEBUG2("No tunnel username (SSL resumption?)"); } + /* + * Set the child up for execution. This represents + * a pseudo protocol inside of PEAPs inner EAP method. + */ if (unlang_subrequest_child_push(&eap_session->submodule_result, child, child, false, UNLANG_SUB_FRAME) < 0) goto finish; @@ -591,13 +595,22 @@ unlang_action_t eap_peap_process(unlang_result_t *p_result, request_t *request, * Setup a function in thie child to process the * result of the subrequest. */ - if (unlang_function_push(NULL, child, NULL, process_reply, NULL, 0, + if (unlang_function_push(/* sets priority */ NULL, + child, + NULL, + /* + * Run in the child after the virtual sever executes. + * This sets the rcode for the subrequest, which is + * written to eap_session->submodule_result. + */ + process_reply, + NULL, 0, UNLANG_SUB_FRAME, eap_session) != UNLANG_ACTION_PUSHED_CHILD) goto finish; /* * Run inner tunnel in the context of the child */ - if (eap_virtual_server(child, eap_session, t->server_cs) == UNLANG_ACTION_FAIL) { + if (unlikely(eap_virtual_server(child, eap_session, t->server_cs) == UNLANG_ACTION_FAIL)) { rcode = RLM_MODULE_FAIL; goto finish; }