]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
rename fr_state_() functions for consistency
authorAlan T. DeKok <aland@freeradius.org>
Thu, 22 Jan 2026 21:28:10 +0000 (16:28 -0500)
committerAlan T. DeKok <aland@freeradius.org>
Thu, 22 Jan 2026 21:49:34 +0000 (16:49 -0500)
src/lib/eap/base.c
src/lib/server/state.c
src/lib/server/state.h
src/lib/unlang/parallel.c
src/lib/unlang/subrequest.c
src/process/radius/base.c
src/process/tacacs/base.c
src/process/ttls/base.c

index 89b8b01b8abfbaa6fbba4706812a943c3cf468af..f585d255a11269858aab3adf234335f6d65d8619 100644 (file)
@@ -436,7 +436,7 @@ unlang_action_t eap_virtual_server(request_t *request, eap_session_t *eap_sessio
        /*
         *      Re-present the previously stored child's session state if there is one
         */
-       fr_state_restore_to_child(request, eap_session->identity, REQUEST_DATA_EAP_SESSION);
+       fr_state_restore_from_parent(request, eap_session->identity, REQUEST_DATA_EAP_SESSION);
 
        if (fr_pair_prepend_by_da(request->request_ctx, &vp, &request->request_pairs,
                                  attr_packet_type) < 0) return UNLANG_ACTION_FAIL;
index 996e0c783f03e68b12e08b277a9466dc7017cf28..5e16d6f44dd6cc93c6c3bd44e2b054b3df9a8d46 100644 (file)
  * entry holds data that should be available during the complete lifecycle
  * of the authentication attempt.
  *
- * When a request is complete, #fr_request_to_state is called to transfer
+ * When a request is complete, #fr_state_store is called to transfer
  * ownership of the state fr_pair_ts and state_ctx (which the fr_pair_ts
  * are allocated in) to a #fr_state_entry_t.  This #fr_state_entry_t holds the
  * value of the State attribute, that will be send out in the response.
  *
- * When the next request is received, #fr_state_to_request is called to transfer
+ * When the next request is received, #fr_state_restore is called to transfer
  * the fr_pair_ts and state ctx to the new request.
  *
  * The ownership of the state_ctx and state fr_pair_ts is transferred as below:
@@ -619,7 +619,7 @@ void fr_state_discard(fr_state_tree_t *state, request_t *request)
        PTHREAD_MUTEX_UNLOCK(&state->mutex);
 
        /*
-        *      If fr_state_to_request was never called, this ensures
+        *      If fr_state_restore was never called, this ensures
         *      the state owned by entry is freed, otherwise this is
         *      mostly a NOOP, other than freeing the memory held by
         *      the entry.
@@ -627,7 +627,7 @@ void fr_state_discard(fr_state_tree_t *state, request_t *request)
        TALLOC_FREE(entry);
 
        /*
-        *      If fr_state_to_request was called, then the request
+        *      If fr_state_restore was called, then the request
         *      holds the existing state data.  We need to destroy it,
         *      and return the request to the state it was in when
         *      it was first allocated, just in case a user does something
@@ -656,7 +656,7 @@ void fr_state_discard(fr_state_tree_t *state, request_t *request)
  *     - 0 on success (state restored)
  *     - -1 if a state entry has already been thawed by a another request.
  */
-int fr_state_to_request(fr_state_tree_t *state, request_t *request)
+int fr_state_restore(fr_state_tree_t *state, request_t *request)
 {
        fr_state_entry_t        *entry;
        fr_pair_t               *vp;
@@ -733,7 +733,7 @@ int fr_state_to_request(fr_state_tree_t *state, request_t *request)
  *
  * Also creates a new state entry.
  */
-int fr_request_to_state(fr_state_tree_t *state, request_t *request)
+int fr_state_store(fr_state_tree_t *state, request_t *request)
 {
        fr_state_entry_t        *entry, *old;
        fr_dlist_head_t         data;
@@ -854,7 +854,7 @@ void fr_state_store_in_parent(request_t *child, void const *unique_ptr, int uniq
  *                             or other facility that spawned the subrequest.
  * @param[in] unique_int       Further identification.
  */
-void fr_state_restore_to_child(request_t *child, void const *unique_ptr, int unique_int)
+void fr_state_restore_from_parent(request_t *child, void const *unique_ptr, int unique_int)
 {
        state_child_entry_t     *child_entry;
        request_t               *request = child; /* Stupid logging */
index 95d54edebf16e37f5c43f8caa9ad79c9b7a352bd..a25e8d49ce742ba72bbc20ca98090ec06bb2d7e8 100644 (file)
@@ -51,11 +51,11 @@ fr_state_tree_t *fr_state_tree_init(TALLOC_CTX *ctx, fr_dict_attr_t const *da, f
 
 void   fr_state_discard(fr_state_tree_t *state, request_t *request);
 
-int    fr_state_to_request(fr_state_tree_t *state, request_t *request);
-int    fr_request_to_state(fr_state_tree_t *state, request_t *request);
+int    fr_state_restore(fr_state_tree_t *state, request_t *request);
+int    fr_state_store(fr_state_tree_t *state, request_t *request);
 
 void   fr_state_store_in_parent(request_t *request, void const *unique_ptr, int unique_int);
-void   fr_state_restore_to_child(request_t *child, void const *unique_ptr, int unique_int);
+void   fr_state_restore_from_parent(request_t *child, void const *unique_ptr, int unique_int);
 void   fr_state_discard_child(request_t *parent, void const *unique_ptr, int unique_int);
 
 /*
index 05b0d28fec3bd95e17224e99c8e2107a444d09cd..f227fd82c8103bd854b736bbbab710862fcd8bfe 100644 (file)
@@ -357,7 +357,7 @@ static unlang_action_t unlang_parallel(unlang_result_t *p_result, request_t *req
                 *      into the child.
                 */
                if (state->children[i].config.session_unique_ptr) {
-                       fr_state_restore_to_child(state->children[i].request,
+                       fr_state_restore_from_parent(state->children[i].request,
                                                  state->children[i].config.session_unique_ptr,
                                                  state->children[i].num);
                }
index 154e10d8139176388d6775f4d5f3badf8884b50d..acb069c7de66a64afb468a24753c734b24a7d885 100644 (file)
@@ -371,7 +371,7 @@ unlang_action_t unlang_subrequest_child_run(UNUSED unlang_result_t *p_result, UN
         *      Ensure we restore the session state information
         *      into the child.
         */
-       if (cr->config.session_unique_ptr) fr_state_restore_to_child(child,
+       if (cr->config.session_unique_ptr) fr_state_restore_from_parent(child,
                                                                     cr->config.session_unique_ptr,
                                                                     cr->num);
        /*
index e82f39d231caa4227edfbd7b6c47ab2552aa3439..b271ba25d9bf17a584d2e923f96cf0c99d1d0911 100644 (file)
@@ -309,7 +309,7 @@ RECV(access_request)
 {
        process_radius_t const          *inst = talloc_get_type_abort_const(mctx->mi->data, process_radius_t);
 
-       if (fr_state_to_request(inst->auth.state_tree, request) < 0) {
+       if (fr_state_restore(inst->auth.state_tree, request) < 0) {
                return CALL_SEND_TYPE(FR_RADIUS_CODE_ACCESS_REJECT);
        }
 
@@ -575,7 +575,7 @@ RESUME(access_challenge)
         *
         *      If this fails, don't respond to the request.
         */
-       if (!request->parent && fr_request_to_state(inst->auth.state_tree, request) < 0) {
+       if (!request->parent && fr_state_store(inst->auth.state_tree, request) < 0) {
                return CALL_SEND_TYPE(FR_RADIUS_CODE_DO_NOT_RESPOND);
        }
 
index a28dffef5c7c09ec594b8556c47f24a5c0979c68..a82692eb56b20dee8ccd3f89176d6a8405bf86e0 100644 (file)
@@ -730,7 +730,7 @@ send_reply:
         *      Cache the session state context.
         */
        if ((state_create(request->reply_ctx, &request->reply_pairs, request, true) < 0) ||
-           (fr_request_to_state(inst->auth.state_tree, request) < 0)) {
+           (fr_state_store(inst->auth.state_tree, request) < 0)) {
                return CALL_SEND_TYPE(FR_TACACS_CODE_AUTH_ERROR);
        }
 
@@ -743,7 +743,7 @@ RECV(auth_cont)
        process_tacacs_session_t        *session;
 
        if ((state_create(request->request_ctx, &request->request_pairs, request, false) < 0) ||
-           (fr_state_to_request(inst->auth.state_tree, request) < 0)) {
+           (fr_state_restore(inst->auth.state_tree, request) < 0)) {
                return CALL_SEND_TYPE(FR_TACACS_CODE_AUTH_ERROR);
        }
 
@@ -810,7 +810,7 @@ RECV(auth_cont_abort)
        process_tacacs_t const          *inst = talloc_get_type_abort_const(mctx->mi->data, process_tacacs_t);
 
        if ((state_create(request->request_ctx, &request->request_pairs, request, false) < 0) ||
-           (fr_state_to_request(inst->auth.state_tree, request) < 0)) {
+           (fr_state_restore(inst->auth.state_tree, request) < 0)) {
                return CALL_SEND_TYPE(FR_TACACS_CODE_AUTH_ERROR);
        }
 
index 95ab527838e3ba16b9c630caf2c0a29bff257dfc..b8c360dffe7acf73f14d4a6f52e031779f2a0614 100644 (file)
@@ -418,7 +418,7 @@ RESUME(access_challenge)
         *
         *      If this fails, don't respond to the request.
         */
-       if (fr_request_to_state(inst->auth.state_tree, request) < 0) {
+       if (fr_state_store(inst->auth.state_tree, request) < 0) {
                request->reply->code = FR_RADIUS_CODE_DO_NOT_RESPOND;
                UPDATE_STATE_CS(reply);
                return CALL_SEND_STATE(state);