28 RCSID(
"$Id: 05389205ff47c86789354e8c9680b06226d150eb $")
30 #include <freeradius-devel/server/base.h>
31 #include <freeradius-devel/util/debug.h>
32 #include <freeradius-devel/unlang/tmpl.h>
97 TALLOC_FREE(frame->
state);
132 switch (update_state->
state) {
139 switch (map->
lhs->type) {
167 TALLOC_FREE(frame->
state);
183 switch (map->
rhs->type) {
189 request, map->
rhs, NULL) < 0) {
219 if (!fr_value_box_list_empty(&update_state->
rhs_result) &&
224 RPEDEBUG(
"Failed concatenating RHS expansion results");
233 fr_value_box_list_talloc_free(&update_state->
rhs_result);
238 fr_value_box_list_talloc_free(&update_state->
lhs_result);
271 (
sizeof(
tmpl_t) * 2) + 128),
275 fr_value_box_list_init(&update_state->
lhs_result);
276 fr_value_box_list_init(&update_state->
rhs_result);
287 #ifdef WITH_VERIFY_PTR
294 #ifdef WITH_VERIFY_PTR
328 fr_value_box_list_init(&map_proc_state->
src_result);
343 request,
inst->src, NULL, NULL) < 0) {
344 REDEBUG(
"Failed expanding map src");
349 fr_value_box_list_insert_head(&map_proc_state->
src_result, src_result);
354 request,
inst->src, NULL) < 0) {
396 .frame_state_type =
"unlang_frame_state_map_proc_t",
unlang_action_t
Returned by unlang_op_t calls, determine the next action of the interpreter.
@ UNLANG_ACTION_PUSHED_CHILD
unlang_t pushed a new child onto the stack, execute it instead of continuing.
@ UNLANG_ACTION_STOP_PROCESSING
Break out of processing the current request (unwind).
@ UNLANG_ACTION_CALCULATE_RESULT
Calculate a new section rlm_rcode_t value.
#define FALL_THROUGH
clang 10 doesn't recognised the FALL-THROUGH comment anymore
#define fr_dcursor_init(_cursor, _head)
Initialise a cursor.
static void * fr_dcursor_next(fr_dcursor_t *cursor)
Advanced the cursor to the next item.
static void * fr_dcursor_current(fr_dcursor_t *cursor)
Return the item the cursor current points to.
#define fr_cond_assert(_x)
Calls panic_action ifndef NDEBUG, else logs error and evaluates to value of _x.
#define fr_dlist_init(_head, _type, _field)
Initialise the head structure of a doubly linked list.
static void * fr_dlist_next(fr_dlist_head_t const *list_head, void const *ptr)
Get the next item in a list.
static bool fr_dlist_empty(fr_dlist_head_t const *list_head)
Check whether a list has any items.
static int fr_dlist_insert_tail(fr_dlist_head_t *list_head, void *ptr)
Insert an item into the tail of a list.
Head of a doubly linked list.
#define RPEDEBUG(fmt,...)
void unlang_register(int type, unlang_op_t *op)
Register an operation with the interpreter.
static unlang_action_t list_mod_create(rlm_rcode_t *p_result, request_t *request, unlang_stack_frame_t *frame)
Create a list of modifications to apply to one or more fr_pair_t lists.
static unlang_action_t map_proc_resume(UNUSED rlm_rcode_t *p_result, UNUSED request_t *request, UNUSED unlang_stack_frame_t *frame)
fr_value_box_list_t lhs_result
Result of expanding the LHS.
unlang_update_state_t state
What we're currently doing.
static unlang_action_t map_proc_apply(rlm_rcode_t *p_result, request_t *request, unlang_stack_frame_t *frame)
static unlang_action_t unlang_update_state_init(rlm_rcode_t *p_result, request_t *request, unlang_stack_frame_t *frame)
Execute an update block.
void unlang_map_init(void)
static unlang_action_t unlang_map_state_init(rlm_rcode_t *p_result, request_t *request, unlang_stack_frame_t *frame)
fr_dlist_head_t vlm_head
Head of list of VP List Mod.
static unlang_action_t list_mod_apply(rlm_rcode_t *p_result, request_t *request)
Apply a list of modifications on one or more fr_pair_t lists.
unlang_update_state_t
map and unlang integration.
@ UNLANG_UPDATE_MAP_EXPANDED_RHS
Expand the RHS xlat or exec (if needed).
@ UNLANG_UPDATE_MAP_INIT
Start processing a map.
@ UNLANG_UPDATE_MAP_EXPANDED_LHS
Expand the LHS xlat or exec (if needed).
fr_dcursor_t maps
Cursor of maps to evaluate.
fr_value_box_list_t rhs_result
Result of expanding the RHS.
fr_value_box_list_t src_result
Result of expanding the map source.
State of an update block.
static char * stack[MAX_STACK]
int map_list_mod_apply(request_t *request, vp_list_mod_t const *vlm)
Apply the output of map_to_list_mod to a request.
int map_to_list_mod(TALLOC_CTX *ctx, vp_list_mod_t **out, request_t *request, map_t const *map, fr_value_box_list_t *lhs_result, fr_value_box_list_t *rhs_result)
Evaluate a map creating a new map with TMPL_TYPE_ATTR LHS and TMPL_TYPE_DATA RHS.
static unlang_map_t * unlang_group_to_map(unlang_group_t *g)
Cast a group structure to the map keyword extension.
map_proc_inst_t * proc_inst
map_list_t map
Head of the map list.
unlang_action_t map_proc(rlm_rcode_t *p_result, request_t *request, map_proc_inst_t const *inst, fr_value_box_list_t *result)
Evaluate a set of maps using the specified map processor.
@ FR_TYPE_STRING
String of printable characters.
rlm_rcode_t
Return codes indicating the result of the module call.
@ RLM_MODULE_FAIL
Module failed, don't reply.
@ RLM_MODULE_NOOP
Module succeeded without doing anything.
@ TMPL_TYPE_REGEX_UNCOMPILED
Regex where compilation is possible but hasn't been performed yet.
@ TMPL_TYPE_XLAT
Pre-parsed xlat expansion.
@ TMPL_TYPE_EXEC
Callout to an external script or program.
@ TMPL_TYPE_REGEX_XLAT_UNRESOLVED
A regular expression with unresolved xlat functions or attribute references.
@ TMPL_TYPE_REGEX
Compiled (and possibly JIT'd) regular expression.
@ TMPL_TYPE_XLAT_UNRESOLVED
A xlat expansion with unresolved xlat functions or attribute references.
@ TMPL_TYPE_REGEX_XLAT
A regex containing xlat expansions.
#define tmpl_aexpand(_ctx, _out, _request, _vpt, _escape, _escape_ctx)
Expand a tmpl to a C type, allocing a new buffer to hold the string.
MEM(pair_append_request(&vp, attr_eap_aka_sim_identity) >=0)
eap_aka_sim_process_conf_t * inst
eap_type_t type
The preferred EAP-Type of this instance of the EAP-SIM/AKA/AKA' state machine.
tmpl_t * lhs
Typically describes the attribute to add, modify or compare.
tmpl_t * rhs
Typically describes a literal value or a src attribute to copy or compare.
#define talloc_zero_pooled_object(_ctx, _type, _num_subobjects, _total_subobjects_size)
int unlang_tmpl_push(TALLOC_CTX *ctx, fr_value_box_list_t *out, request_t *request, tmpl_t const *tmpl, unlang_tmpl_args_t *args)
Push a tmpl onto the stack for evaluation.
VALUE_BOX_LIST_VERIFY(list)
int unlang_xlat_push(TALLOC_CTX *ctx, bool *p_success, fr_value_box_list_t *out, request_t *request, xlat_exp_head_t const *xlat, bool top_frame)
Push a pre-compiled xlat onto the stack for evaluation.
static void repeatable_clear(unlang_stack_frame_t *frame)
void * state
Stack frame specialisations.
static unlang_group_t * unlang_generic_to_group(unlang_t const *p)
@ UNLANG_TYPE_UPDATE
Update block.
@ UNLANG_TYPE_MAP
Mapping section (like UNLANG_TYPE_UPDATE, but uses values from a map_proc_t call).
static void frame_repeat(unlang_stack_frame_t *frame, unlang_process_t process)
Mark the current stack frame up for repeat, and set a new process function.
unlang_t const * instruction
The unlang node we're evaluating.
static void repeatable_set(unlang_stack_frame_t *frame)
unlang_process_t process
function to call for interpreting this stack frame
Generic representation of a grouping.
Our interpreter stack, as distinct from the C stack.
An unlang stack associated with a request.
int fr_value_box_list_concat_in_place(TALLOC_CTX *ctx, fr_value_box_t *out, fr_value_box_list_t *list, fr_type_t type, fr_value_box_list_action_t proc_action, bool flatten, size_t max_size)
Concatenate a list of value boxes.