25 #include <freeradius-devel/server/state.h>
57 RDEBUG(
"Reached Request-Lifetime. Forcibly stopping request");
75 if (!
vp || (
vp->vp_uint32 > 0)) {
82 }
else if (
vp->vp_uint32 > 3600) {
83 RWDEBUG(
"Request-Timeout can be no more than 3600 seconds");
86 }
else if (
vp->vp_uint32 < 5) {
87 RWDEBUG(
"Request-Timeout can be no less than 5 seconds");
94 ev_p = talloc_size(request,
sizeof(*ev_p));
95 memset(ev_p, 0,
sizeof(*ev_p));
122 if (!request->parent)
return;
131 case FR_SIGNAL_DETACH:
140 REDEBUG(
"Child could not be detached");
145 case FR_SIGNAL_CANCEL:
146 RDEBUG3(
"Removing subrequest from parent, and marking parent as runnable");
232 ~(FR_SIGNAL_DETACH | FR_SIGNAL_CANCEL),
234 state) < 0)
return -1;
331 bool free_child,
bool top_frame)
355 state->
child = child;
360 "Child stack depth must be 0 (not %u), when subrequest_child_push is called",
383 RPEDEBUG(
"Failed detaching request");
393 PERROR(
"%s", __FUNCTION__);
397 PERROR(
"%s", __FUNCTION__);
411 .name =
"subrequest",
412 .debug_name =
"subrequest",
unlang_action_t
Returned by unlang_op_t calls, determine the next action of the interpreter.
@ UNLANG_ACTION_CALCULATE_RESULT
Calculate a new section rlm_rcode_t value.
@ UNLANG_ACTION_YIELD
Temporarily pause execution until an event occurs.
#define FALL_THROUGH
clang 10 doesn't recognised the FALL-THROUGH comment anymore
fr_dcursor_eval_t void const * uctx
#define fr_cond_assert(_x)
Calls panic_action ifndef NDEBUG, else logs error and evaluates to value of _x.
#define fr_cond_assert_msg(_x, _fmt,...)
Calls panic_action ifndef NDEBUG, else logs error and evaluates to value of _x.
#define fr_dict_autofree(_to_free)
fr_dict_attr_t const ** out
Where to write a pointer to the resolved fr_dict_attr_t.
fr_dict_t const ** out
Where to write a pointer to the loaded/resolved fr_dict_t.
int fr_dict_attr_autoload(fr_dict_attr_autoload_t const *to_load)
Process a dict_attr_autoload element to load/verify a dictionary attribute.
#define fr_dict_autoload(_to_load)
Specifies an attribute which must be present for the module to function.
Specifies a dictionary which must be loaded/loadable for the module to function.
#define fr_event_timer_in(...)
#define unlang_function_push(_request, _func, _repeat, _signal, _sigmask, _top_frame, _uctx)
Push a generic function onto the unlang stack.
fr_event_list_t * unlang_interpret_event_list(request_t *request)
Get the event list for the current interpreter.
void unlang_interpret_mark_runnable(request_t *request)
Mark a request as resumable.
int unlang_interpret_push(request_t *request, unlang_t const *instruction, rlm_rcode_t default_rcode, bool do_next_sibling, bool top_frame)
Push a new frame onto the stack.
void unlang_interpret_signal(request_t *request, fr_signal_t action)
Send a signal (usually stop) to a request.
Private declarations for the unlang interpreter.
static void interpret_child_init(request_t *request)
#define RPEDEBUG(fmt,...)
Stores all information relating to an event list.
@ FR_TYPE_UINT32
32 Bit unsigned integer.
fr_pair_t * fr_pair_find_by_da(fr_pair_list_t const *list, fr_pair_t const *prev, fr_dict_attr_t const *da)
Find the first pair with a matching da.
rlm_rcode_t
Return codes indicating the result of the module call.
@ RLM_MODULE_INVALID
The module considers the request invalid.
@ RLM_MODULE_OK
The module is OK, continue.
@ RLM_MODULE_FAIL
Module failed, don't reply.
@ RLM_MODULE_DISALLOW
Reject the request (user is locked out).
@ RLM_MODULE_REJECT
Immediately reject the request.
@ RLM_MODULE_NOTFOUND
User not found.
@ RLM_MODULE_UPDATED
OK (pairs modified).
@ RLM_MODULE_NOT_SET
Error resolving rcode (should not be returned by modules).
@ RLM_MODULE_NOOP
Module succeeded without doing anything.
@ RLM_MODULE_HANDLED
The module handled the request, so stop.
int request_detach(request_t *child)
Unlink a subrequest from its parent.
void fr_state_restore_to_child(request_t *child, void const *unique_ptr, int unique_int)
Restore subrequest data from a parent request.
void fr_state_store_in_parent(request_t *child, void const *unique_ptr, int unique_int)
Store subrequest's session-state list and persistable request data in its parent.
MEM(pair_append_request(&vp, attr_eap_aka_sim_identity) >=0)
Stores an attribute, a value and various bits of other data.
void unlang_subrequest_detach_and_free(request_t **child)
Free a child request, detaching it from its parent and freeing allocated memory.
int unique_int
Session unique int identifier.
void const * unique_ptr
Session unique ptr identifier.
bool enable
Whether we should store/restore sessions.
void unlang_subrequest_child_op_free(void)
static void unlang_subrequest_child_signal(request_t *request, fr_signal_t action, UNUSED void *uctx)
Process a detach signal in the child.
fr_dict_attr_autoload_t subrequest_dict_attr[]
int unlang_subrequest_lifetime_set(request_t *request)
Initialize a detached child.
int unlang_subrequest_child_push_resume(request_t *child, unlang_frame_state_subrequest_t *state)
Push a resumption frame onto a child's stack.
static void unlang_detached_max_request_time(UNUSED fr_event_list_t *el, UNUSED fr_time_t now, void *uctx)
Event handler to free a detached child.
static fr_dict_t const * dict_freeradius
static unlang_action_t unlang_subrequest_calculate_result(rlm_rcode_t *p_result, UNUSED request_t *request, unlang_stack_frame_t *frame)
Function to run in the context of the parent on resumption.
static unlang_subrequest_t * subrequest_instruction
Holds a synthesised instruction that we insert into the parent request.
static fr_dict_attr_t const * request_attr_request_lifetime
int unlang_subrequest_child_push_and_detach(request_t *request)
fr_dict_autoload_t subrequest_dict[]
int unlang_subrequest_child_op_init(void)
unlang_action_t unlang_subrequest_child_run(UNUSED rlm_rcode_t *p_result, UNUSED request_t *request, unlang_stack_frame_t *frame)
Function called by the unlang interpreter to start the child running.
int unlang_subrequest_child_push(rlm_rcode_t *out, request_t *child, unlang_subrequest_session_t const *session, bool free_child, bool top_frame)
Push a pre-existing child back onto the stack as a subrequest.
static unlang_action_t unlang_subrequest_child_done(rlm_rcode_t *p_result, UNUSED int *p_priority, request_t *request, void *uctx)
When the child is done, tell the parent that we've exited.
bool free_child
Whether we should free the child after it completes.
unlang_subrequest_session_t session
Session configuration.
request_t * child
Pre-allocated child request.
rlm_rcode_t * p_result
Where to store the result.
Parameters for initialising the subrequest (parent's frame state)
static fr_time_delta_t fr_time_delta_add(fr_time_delta_t a, fr_time_delta_t b)
static fr_time_delta_t fr_time_delta_from_sec(int64_t sec)
#define fr_time_delta_wrap(_time)
A time delta, a difference in time measured in nanoseconds.
static fr_event_list_t * el
void * state
Stack frame specialisations.
static void return_point_set(unlang_stack_frame_t *frame)
static int stack_depth_current(request_t *request)
@ UNLANG_TYPE_SUBREQUEST
create a child subrequest
static void repeatable_set(unlang_stack_frame_t *frame)
unlang_process_t process
function to call for interpreting this stack frame
unlang_type_t type
The specialisation of this node.
static unlang_stack_frame_t * frame_current(request_t *request)
Our interpreter stack, as distinct from the C stack.
static size_t char ** out