24 RCSID(
"$Id: d2c9ccc7454fb1d258a48ddcf10d82e26a433328 $")
26 #include <freeradius-devel/server/base.h>
27 #include <freeradius-devel/unlang/xlat.h>
29 #include <freeradius-devel/util/debug.h>
30 #include <freeradius-devel/util/types.h>
33 #include <freeradius-devel/unlang/xlat_priv.h>
42 head->flags.pure =
true;
63 if (node->type ==
type)
return;
68 if (node->type != 0)
switch (node->type) {
70 TALLOC_FREE(node->group);
76 TALLOC_FREE(node->call.args);
141 unsigned int extra_hdrs;
166 (
in != NULL) + extra_hdrs,
170 if (!
in)
return node;
249 node->
quote = p->quote;
250 node->
flags = p->flags;
269 node->call.func = p->call.func;
270 node->call.dict = p->call.dict;
271 node->call.ephemeral = p->call.ephemeral;
285 node->call.func = p->call.func;
286 node->call.dict = p->call.dict;
287 node->call.ephemeral = p->call.ephemeral;
289 node, node->call.args, p->call.args) < 0))
goto error;
298 node->regex_index = p->regex_index;
304 node, node->group, p->group) < 0))
goto error;
327 #ifdef WITH_VERIFY_PTR
332 switch (node->
type) {
334 xlat_exp_head_verify(node->group);
339 xlat_exp_head_verify(node->call.args);
static int const char * fmt
#define NDEBUG_LOCATION_VALS
#define NDEBUG_LOCATION_ARGS
Pass caller information to the function.
#define fr_dlist_init(_head, _type, _field)
Initialise the head structure of a doubly linked list.
tmpl_t * tmpl_copy(TALLOC_CTX *ctx, tmpl_t const *in)
Copy a tmpl.
MEM(pair_append_request(&vp, attr_eap_aka_sim_identity) >=0)
fr_aka_sim_id_type_t type
char * talloc_bstrndup(TALLOC_CTX *ctx, char const *in, size_t inlen)
Binary safe strndup function.
char * talloc_typed_strdup_buffer(TALLOC_CTX *ctx, char const *p)
Call talloc_strndup, setting the type on the new chunk correctly.
#define talloc_get_type_abort_const
#define talloc_zero_pooled_object(_ctx, _type, _num_subobjects, _total_subobjects_size)
static int talloc_const_free(void const *ptr)
Free const'd memory.
#define XLAT_HEAD_VERIFY(_head)
bool pure
has no external side effects, true for BOX, LITERAL, and some functions
#define fr_strerror_printf(_fmt,...)
Log to thread local error buffer.
int fr_value_box_copy(TALLOC_CTX *ctx, fr_value_box_t *dst, const fr_value_box_t *src)
Copy value data verbatim duplicating any buffers.
void fr_value_box_strdup_shallow(fr_value_box_t *dst, fr_dict_attr_t const *enumv, char const *src, bool tainted)
Assign a buffer containing a nul terminated string to a box, but don't copy it.
static size_t char fr_sbuff_t size_t inlen
static size_t char ** out
xlat_exp_t * _xlat_exp_alloc_null(NDEBUG_LOCATION_ARGS TALLOC_CTX *ctx)
Allocate an xlat node with no name, and no type set.
void xlat_exp_set_name(xlat_exp_t *node, char const *fmt, size_t len)
Set the format string for an xlat node.
static xlat_exp_t * xlat_exp_alloc_pool(NDEBUG_LOCATION_ARGS TALLOC_CTX *ctx, unsigned int extra_hdrs, size_t extra)
xlat_exp_t * _xlat_exp_alloc(NDEBUG_LOCATION_ARGS TALLOC_CTX *ctx, xlat_type_t type, char const *in, size_t inlen)
Allocate an xlat node.
xlat_exp_head_t * _xlat_exp_head_alloc(NDEBUG_LOCATION_ARGS TALLOC_CTX *ctx)
void xlat_exp_set_name_buffer(xlat_exp_t *node, char const *fmt)
Set the format string for an xlat node, copying from a talloc'd buffer.
int _xlat_copy(NDEBUG_LOCATION_ARGS TALLOC_CTX *ctx, xlat_exp_head_t *out, xlat_exp_head_t const *in)
void xlat_exp_set_name_buffer_shallow(xlat_exp_t *node, char const *fmt)
Set the format string for an xlat node from a pre-existing buffer.
static int _xlat_copy_internal(NDEBUG_LOCATION_ARGS TALLOC_CTX *ctx, xlat_exp_head_t *out, xlat_exp_head_t const *in)
Copy all nodes in the input list to the output list.
void _xlat_exp_set_type(NDEBUG_LOCATION_ARGS xlat_exp_t *node, xlat_type_t type)
Set the type of an xlat node.
struct xlat_exp_head_s xlat_exp_head_t
xlat_flags_t flags
Flags that control resolution and evaluation.
int line
Line where the xlat was allocated.
fr_token_t quote
Type of quoting around XLAT_GROUP types.
@ XLAT_ONE_LETTER
Special "one-letter" expansion.
@ XLAT_TMPL
xlat attribute
@ XLAT_VIRTUAL_UNRESOLVED
virtual attribute needs resolution during pass2.
@ XLAT_VIRTUAL
virtual attribute
@ XLAT_GROUP
encapsulated string of xlats
@ XLAT_FUNC_UNRESOLVED
func needs resolution during pass2.
@ XLAT_INVALID
Bad expansion.
static void xlat_flags_merge(xlat_flags_t *parent, xlat_flags_t const *child)
Merge flags from child to parent.
char const *_CONST fmt
The original format string (a talloced buffer).
xlat_type_t _CONST type
type of this expansion.
char const *_CONST file
File where the xlat was allocated.
#define xlat_exp_alloc(_ctx, _type, _in, _inlen)
#define xlat_exp_foreach(_list_head, _iter)
Iterate over the contents of a list, only one level.
static int xlat_exp_insert_tail(xlat_exp_head_t *head, xlat_exp_t *node)