26RCSID(
"$Id: b2fade261716c6c8d240d3994998cc197ead36b2 $")
31#include <freeradius-devel/server/base.h>
32#include <freeradius-devel/server/tmpl_dcursor.h>
33#include <freeradius-devel/server/main_config.h>
34#include <freeradius-devel/unlang/xlat_priv.h>
36#include <freeradius-devel/io/test_point.h>
38#include <freeradius-devel/util/base16.h>
40#ifdef HAVE_OPENSSL_EVP_H
41# include <freeradius-devel/tls/openssl_user_macros.h>
42# include <openssl/evp.h>
48static char const hextab[] =
"0123456789abcdef";
68 fr_value_box_list_remove(
in, vb);
69 if (talloc_parent(vb) != ctx) {
70 (void) talloc_steal(ctx, vb);
105 vb->vb_int8 = request->log.lvl;
111 if (!lvl_vb)
goto done;
113 level = lvl_vb->vb_int8;
118 request->log.lvl = level;
167 if (slen <= 0)
return;
169 switch (
vp->vp_type) {
199 switch (
vp->vp_type) {
236 if ((pad = (11 -
type->name.len)) < 0) pad = 0;
239 RDEBUG4(
"as %s%*s: %pV",
type->name.str, pad,
" ", dst);
297 RDEBUG(
"Attributes matching \"%s\"", in_head->vb_cursor_name);
311#pragma clang diagnostic ignored "-Wgnu-designator"
314#define FR_FILENAME_SAFE_FOR ((uintptr_t) filename_xlat_escape)
319 fr_value_box_entry_t entry;
390 if (vb->vb_strvalue[0] ==
'.') {
435 if (!num_files)
goto fail;
437 for (i = 0; i < num_files; i++) {
443 if (alen > vb->vb_length)
continue;
450 if (alen == vb->vb_length)
return true;
456 if (vb->vb_strvalue[vb->vb_length] !=
'/')
break;
462 REDEBUG(
"Failed accessing file %s - it is outside of 'limit files { ... }'", vb->vb_strvalue);
466#define XLAT_FILE_ALLOWED(_vb) xlat_file_allowed(request, vb)
473 char const *filename;
478 filename = vb->vb_strvalue;
485 dst->vb_bool = (stat(filename, &buf) == 0);
496 char const *filename;
503 filename = vb->vb_strvalue;
507 fd = open(filename, O_RDONLY);
524 if ((*p ==
'\r') || (*p ==
'\n')) {
528 if ((*p <
' ') && (*p !=
'\t')) {
530 REDEBUG(
"Invalid text in file %s", filename);
536 if ((p -
buffer) > len)
goto invalid;
556 char const *filename;
561 filename = vb->vb_strvalue;
565 if (stat(filename, &buf) < 0) {
573 dst->vb_uint64 = buf.st_size;
584 char const *filename;
589 char *p, *end, *found,
buffer[256];
593 filename = vb->vb_strvalue;
597 fd = open(filename, O_RDONLY);
603 offset = lseek(fd, 0, SEEK_END);
615 if (lseek(fd, offset, SEEK_SET) < 0) {
616 REDEBUG3(
"Failed seeking backwards from end of file %s - %s", filename,
fr_syserror(errno));
635 if (len <= 1)
goto done;
645 fr_assert(fr_value_box_list_num_elements(&num->vb_group) == 1);
647 num = fr_value_box_list_head(&num->vb_group);
650 if (!num->vb_uint32) {
653 }
else if (num->vb_uint32 <= 16) {
654 stop = num->vb_uint32;
705 if ((crlf ==
stop) && (*found <
' ')) {
765 { .required =
true, .type =
FR_TYPE_SIZE, .single =
true },
774 char const *filename;
782 filename = vb->vb_strvalue;
786 fd = open(filename, O_RDONLY);
792 if (fstat(fd, &buf) < 0) {
799 if ((
size_t)buf.st_size > max_size->vb_size) {
800 RPERROR(
"File larger than specified maximum (%"PRIu64
" vs %zu)", buf.st_size, max_size->vb_size);
807 len = read(fd,
buffer, buf.st_size);
815 if (len < buf.st_size) {
816 RPERROR(
"Failed reading all of file %s", filename);
831 char const *filename;
835 filename = vb->vb_strvalue;
842 dst->vb_bool = (unlink(filename) == 0);
854 char const *filename;
859 filename = vb->vb_strvalue;
866 fd = open(filename, O_CREAT | O_WRONLY, 0600);
868 dst->vb_bool =
false;
887 dirname = vb->vb_strvalue;
894 dst->vb_bool = (
fr_mkdir(NULL, dirname, -1, 0700, NULL, NULL) == 0);
910 dirname = vb->vb_strvalue;
917 dst->vb_bool = (rmdir(dirname) == 0);
938 while ((vb = fr_value_box_list_pop_head(
in)) != NULL) {
951 while ((vb = fr_value_box_list_pop_head(
in)) != NULL) {
956 while ((child = fr_value_box_list_pop_head(&vb->vb_group)) != NULL) {
957 child->tainted =
true;
994 fr_value_box_list_t *list;
1005 if (delim_vb->vb_length == 0) {
1006 REDEBUG(
"Delimiter must be greater than zero characters");
1010 delim = delim_vb->vb_strvalue;
1011 delim_len = delim_vb->vb_length;
1013 while ((
string = fr_value_box_list_pop_head(list))) {
1025 fr_sbuff_set_to_start(&sbuff);
1026 fr_sbuff_marker(&m_start, &sbuff);
1047 fr_sbuff_set_to_end(&sbuff);
1083 RDEBUG(
"Attributes matching \"%s\"", in_head->vb_cursor_name);
1123 fr_value_box_list_remove(
args, in_vb);
1125 switch (in_vb->type) {
1128 RPEDEBUG(
"Failed converting %pR (%s) to an integer", in_vb,
1138 in_vb->enumv = NULL;
1160 for (p = in_vb->vb_strvalue; *p !=
'\0'; p++) {
1161 if (*p ==
'-')
break;
1172 if (in_vb->vb_length >
sizeof(uint64_t)) {
1173 fr_strerror_printf(
"Expected octets length <= %zu, got %zu",
sizeof(uint64_t), in_vb->vb_length);
1177 if (in_vb->vb_length >
sizeof(
uint32_t)) {
1179 }
else if (in_vb->vb_length >
sizeof(
uint16_t)) {
1181 }
else if (in_vb->vb_length >
sizeof(
uint8_t)) {
1208 memcpy(&ipv6int, &in_vb->vb_ipv6addr,
sizeof(ipv6int));
1249 RINFO(
"%s", vb->vb_strvalue);
1274 RDEBUG(
"%s", vb->vb_strvalue);
1299 REDEBUG(
"%s", vb->vb_strvalue);
1324 RWDEBUG(
"%s", vb->vb_strvalue);
1370 if (!dst || !*dst->vb_strvalue) {
1378 if (lvl) level = lvl->vb_uint32;
1388 MEM(dbg = talloc_memdup(request, log,
sizeof(*log)));
1401 dbg->
fd = open(dbg->
file, O_WRONLY | O_CREAT | O_CLOEXEC, 0600);
1457 vb->vb_bool =
false;
1462 RPEDEBUG(
"Failed parsing \"%s\" as map", fmt_vb->vb_strvalue);
1466 switch (map->
lhs->type) {
1472 REDEBUG(
"Unexpected type %s in left hand side of expression",
1477 switch (map->
rhs->type) {
1487 REDEBUG(
"Unexpected type %s in right hand side of expression",
1553 REDEBUG(
"Unknown module %pV", box);
1559 REDEBUG(
"Virtual module %pV does not have a known dictionary - ignoring", box);
1610 struct tm *local, local_buff;
1622 p = in_head->vb_strvalue;
1624 num = strtoul(p, &q, 10);
1625 if ((num == ULONG_MAX) || !q || *q ==
'\0') {
1626 REDEBUG(
"<int> must be followed by time period (h|d|w|m|y)");
1630 REDEBUG(
"<int> must be greater than zero");
1645 local->tm_hour += num;
1650 local->tm_mday += num;
1655 local->tm_mday += (7 - local->tm_wday) + (7 * (num-1));
1661 local->tm_mon += num;
1668 local->tm_year += num;
1672 REDEBUG(
"Invalid time period '%c', must be h|d|w|m|y", *p);
1677 fr_value_box_uint64(vb, NULL, (uint64_t)(mktime(local) - now),
false);
1747 &(fr_sbuff_parse_rules_t){
1748 .escapes = &escape_rules
1752 .dict_def = request->local_dict,
1753 .list_def = request_attr_request,
1754 .allow_unknown = false,
1755 .allow_unresolved = false,
1756 .allow_foreign = false,
1759 .runtime_el = unlang_interpret_event_list(request),
1763 RPEDEBUG(
"Failed parsing expansion");
1774 if (rctx->ex->flags.needs_resolving &&
1776 RPEDEBUG(
"Unresolved expansion functions in expansion");
1817 fr_value_box_list_t *list;
1821 char const *fill_str = NULL;
1822 size_t fill_len = 0;
1829 list = &values->vb_group;
1831 pad_len = (
size_t)pad->vb_uint64;
1837 fill_str =
fill->vb_strvalue;
1841 if (fill_len == 0) {
1846 while ((
in = fr_value_box_list_pop_head(list))) {
1855 if (len >= pad_len)
continue;
1858 RPEDEBUG(
"Failed reallocing input data");
1863 fr_sbuff_marker(&m_data, &sbuff);
1874 if (fill_len == 1) {
1883 size_t to_copy = remaining >= fill_len ? fill_len : remaining;
1887 fr_sbuff_set_to_end(&sbuff);
1888 fr_sbuff_terminate(&sbuff);
1912 fr_value_box_list_t *list;
1917 char const *fill_str = NULL;
1918 size_t fill_len = 0;
1924 list = &values->vb_group;
1925 pad_len = (
size_t)pad->vb_uint64;
1931 fill_str =
fill->vb_strvalue;
1935 if (fill_len == 0) {
1940 while ((
in = fr_value_box_list_pop_head(list))) {
1948 if (len >= pad_len)
continue;
1952 RPEDEBUG(
"Failed reallocing input data");
1959 if (fill_len == 1) {
1968 if (
fr_sbuff_in_bstrncpy(&sbuff, fill_str, remaining >= fill_len ? fill_len : remaining) < 0) {
2014 RPEDEBUG(
"Base64 encoding failed");
2056 if (
in->vb_length == 0) {
2103 char const *p, *end;
2111 while ((hex = fr_value_box_list_pop_head(&list->vb_group))) {
2112 len = hex->vb_length;
2113 if ((len > 1) && (len & 0x01)) {
2114 REDEBUG(
"Input data length must be >1 and even, got %zu", len);
2118 p = hex->vb_strvalue;
2124 if ((p[0] ==
'0') && (p[1] ==
'x')) {
2132 if (p == end)
continue;
2175 struct timespec ts_in, ts_remain = {};
2181 (void)nanosleep(&ts_in, &ts_remain);
2225 RPEDEBUG(
"Failed parsing '%pV' as a numerical data type",
name);
2233 RPEDEBUG(
"Failed parsing '%pV' as a string data type",
name);
2241 RDEBUG(
"Unknown data type '%s'",
name->vb_strvalue);
2249 (void) fr_value_box_list_pop_head(
args);
2285 RPEDEBUG(
"Failed concatenating string");
2300 while ((arg = fr_value_box_list_next(
args, arg)) != NULL) {
2305 vb = fr_value_box_list_head(&arg->vb_group);
2307 p = fr_value_box_list_remove(&arg->vb_group, vb);
2314 vb = fr_value_box_list_next(&arg->vb_group, p);
2349 fr_value_box_list_t *to_concat;
2355 sep = (separator) ? separator->vb_strvalue :
"";
2356 to_concat = &list->vb_group;
2361 RPEDEBUG(
"Failed concatenating input");
2366 if (!
buff)
goto error;
2401 while ((bin = fr_value_box_list_pop_head(&list->vb_group))) {
2407 MEM(new_buff = talloc_zero_array(bin,
char, (bin->vb_length * 2) + 1));
2408 if (bin->vb_length) {
2525 while ((vb = fr_value_box_list_pop_head(
in)) != NULL) {
2543 while ((arg = fr_value_box_list_next(
in, arg)) != NULL) {
2612 fr_md4_calc(digest, in_head->vb_octets, in_head->vb_length);
2652 fr_md5_calc(digest, in_head->vb_octets, in_head->vb_length);
2740 result = in_head->vb_uint32;
2743 if (result > (1 << 30)) result = (1 << 30);
2749 vb->vb_uint64 = result;
2794 static char randstr_punc[] =
"!\"#$%&'()*+,-./:;<=>?@[\\]^_`{|}~";
2795 static char randstr_salt[] =
"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmopqrstuvwxyz/.";
2801 static char randstr_otp[] =
"469ACGHJKLMNPQRUVWXYabdfhijkprstuvwxyz";
2803 char const *p, *start, *end;
2806 unsigned int result;
2817#define REPETITION_MAX 1024
2819 start = p = in_head->vb_strvalue;
2820 end = p + in_head->vb_length;
2833 reps = strtol(p, &endptr, 10);
2853 reps = strtol(p, &endptr, 10);
2864 for (i = 0; i < reps; i++) {
2871 *buff_p++ =
'a' + (result % 26);
2878 *buff_p++ =
'A' + (result % 26);
2885 *buff_p++ =
'0' + (result % 10);
2892 *buff_p++ = randstr_salt[result % (
sizeof(randstr_salt) - 3)];
2899 *buff_p++ = randstr_punc[result % (
sizeof(randstr_punc) - 1)];
2906 *buff_p++ =
'!' + (result % 95);
2913 *buff_p++ = randstr_salt[result % (
sizeof(randstr_salt) - 1)];
2921 *buff_p++ = randstr_otp[result % (
sizeof(randstr_otp) - 1)];
2929 size_t copy = (reps - i) >
sizeof(result) ?
sizeof(result) : reps - i;
2931 memcpy(buff_p, (
uint8_t *)&result, copy);
2938 REDEBUG(
"Invalid character class '%c'", *p);
2962#define UUID_CHARS(_v, _num) for (i = 0; i < _num; i++) { \
2963 buffer[j++] = fr_base16_alphabet_encode_lc[(uint8_t)((vals[_v] & 0xf0000000) >> 28)]; \
2964 vals[_v] = vals[_v] << 4; \
2986 vals[1] = (vals[1] & 0xffff0fff) | (((
uint32_t)version & 0x0f) << 12);
2997 vals[2] = vals[2] & 0x7fffffff;
3001 vals[2] = (vals[2] & 0x3fffffff) | 0x80000000;
3005 vals[2] = (vals[2] & 0x3fffffff) | 0xc0000000;
3009 vals[2] = vals[2] | 0xe0000000;
3037 for (i = 0; i < 4; i++) vals[i] =
fr_rand();
3078 for (i = 1; i < 4; i++) vals[i] =
fr_rand();
3085 vals[0] = now >> 32;
3086 vals[1] = (vals[1] & 0x0000ffff) | (now & 0xffff0000);
3123 uint64_t i, start, end, step;
3138 REDEBUG(
"Invalid range - 'end' cannot be null when 'step' is provided");
3142 start = fr_value_box_list_head(&start_vb->vb_group)->vb_uint64;
3143 end = fr_value_box_list_head(&end_vb->vb_group)->vb_uint64;
3144 step = fr_value_box_list_head(&step_vb->vb_group)->vb_uint64;
3146 }
else if (end_vb) {
3147 start = fr_value_box_list_head(&start_vb->vb_group)->vb_uint64;
3148 end = fr_value_box_list_head(&end_vb->vb_group)->vb_uint64;
3153 end = fr_value_box_list_head(&start_vb->vb_group)->vb_uint64;
3158 REDEBUG(
"Invalid range - 'start' must be less than 'end'");
3163 REDEBUG(
"Invalid range - 'step' must be greater than zero");
3167 if (step > (end - start)) {
3168 REDEBUG(
"Invalid range - 'step' must allow for at least one result");
3172 if (((end - start) / step) > 1000) {
3173 REDEBUG(
"Invalid range - Too many results");
3177 for (i = start; i < end; i += step) {
3190 fr_value_box_entry_t entry;
3195 if (slen < 0)
return -1;
3232 fr_value_box_t *arg = fr_value_box_list_head(&in_head->vb_group);
3241 if (regex_request_to_sub(vb, vb, request, 0) < 0) {
3242 REDEBUG2(
"No previous regex capture");
3252 switch (arg->type) {
3262 if (fr_value_box_list_next(
in, in_head)) {
3263 REDEBUG(
"Only one subcapture argument allowed");
3273 if (regex_request_to_sub(vb, vb, request, idx.vb_uint32) < 0) {
3274 REDEBUG2(
"No previous numbered regex capture group '%u'", idx.vb_uint32);
3284#if defined(HAVE_REGEX_PCRE) || defined(HAVE_REGEX_PCRE2)
3295 RPEDEBUG(
"Failed concatenating input");
3300 if (regex_request_to_sub_named(vb, vb, request, arg->vb_strvalue) < 0) {
3301 REDEBUG2(
"No previous named regex capture group '%s'", arg->vb_strvalue);
3310 RDEBUG(
"Named regex captures are not supported (they require libpcre2)");
3343 fr_sha1_update(&sha1_ctx, in_head->vb_octets, in_head->vb_length);
3367#ifdef HAVE_OPENSSL_EVP_H
3372 uint8_t digest[EVP_MAX_MD_SIZE];
3373 unsigned int digestlen;
3380 md_ctx = EVP_MD_CTX_create();
3381 EVP_DigestInit_ex(md_ctx, md, NULL);
3383 EVP_DigestUpdate(md_ctx, in_head->vb_octets, in_head->vb_length);
3385 EVP_DigestUpdate(md_ctx, NULL, 0);
3387 EVP_DigestFinal_ex(md_ctx, digest, &digestlen);
3388 EVP_MD_CTX_destroy(md_ctx);
3398# define EVP_MD_XLAT(_md, _md_func) \
3399static xlat_action_t xlat_func_##_md(TALLOC_CTX *ctx, fr_dcursor_t *out,\
3400 xlat_ctx_t const *xctx, \
3401 request_t *request,\
3402 fr_value_box_list_t *in)\
3404 return xlat_evp_md(ctx, out, xctx, request, in, EVP_##_md_func());\
3407EVP_MD_XLAT(sha2_224, sha224)
3408EVP_MD_XLAT(sha2_256, sha256)
3409EVP_MD_XLAT(sha2_384, sha384)
3410EVP_MD_XLAT(sha2_512, sha512)
3415#ifdef HAVE_EVP_BLAKE2S256
3416EVP_MD_XLAT(blake2s_256, blake2s256)
3419#ifdef HAVE_EVP_BLAKE2B512
3420EVP_MD_XLAT(blake2b_512, blake2b512)
3423EVP_MD_XLAT(sha3_224, sha3_224)
3424EVP_MD_XLAT(sha3_256, sha3_256)
3425EVP_MD_XLAT(sha3_384, sha3_384)
3426EVP_MD_XLAT(sha3_512, sha3_512)
3465 vb->vb_size = strlen(in_head->vb_strvalue);
3502 bool relaxed =
false;
3506 if (relaxed_vb) relaxed = relaxed_vb->vb_bool;
3508 p = (
uint8_t const *)str->vb_strvalue;
3509 end = p + str->vb_length;
3513 vb->vb_bool =
false;
3563 in_head->vb_length) >= 0);
3572 { .single =
true, .required =
true, .type =
FR_TYPE_INT32 },
3595 int32_t start, end, len;
3606 RPEDEBUG(
"Failed casting value to string");
3614 if (start_vb->vb_int32 < 0) {
3615 start =
in->vb_length + start_vb->vb_int32;
3616 if (start < 0) start = 0;
3618 start = start_vb->vb_int32;
3622 if (len_vb->vb_int32 < 0) {
3623 end =
in->vb_length + len_vb->vb_int32;
3626 end = start + len_vb->vb_int32;
3627 if (end > (int32_t)
in->vb_length) end =
in->vb_length;
3630 end =
in->vb_length;
3646 memcpy(buf, &
in->vb_octets[start], len);
3660#ifdef HAVE_REGEX_PCRE2
3665 fr_regex_flags_t flags;
3666} xlat_subst_regex_inst_t;
3672 xlat_subst_regex_inst_t *
inst = talloc_get_type_abort(xctx->
inst, xlat_subst_regex_inst_t);
3690 sbuff =
FR_SBUFF_IN(patt_exp->data.vb_strvalue, patt_exp->data.vb_length);
3699 fr_sbuff_marker(&start_m, &sbuff);
3703 fr_sbuff_marker(&end_m, &sbuff);
3704 fr_sbuff_next(&sbuff);
3707 slen = regex_flags_parse(NULL, &
inst->flags,
3711 PERROR(
"Failed parsing regex flags in \"%s\"", patt_exp->data.vb_strvalue);
3716 if (regex_compile(
inst, &
inst->pattern,
3718 &
inst->flags,
true,
false) <= 0) {
3719 PERROR(
"Failed compiling regex \"%s\"", patt_exp->data.vb_strvalue);
3749 fr_value_box_list_t *
args)
3756 regex_t *pattern, *our_pattern = NULL;
3757 fr_regex_flags_t
const *flags;
3758 fr_regex_flags_t our_flags = {};
3769 if (!
inst->pattern) {
3770 sbuff =
FR_SBUFF_IN(regex_vb->vb_strvalue, regex_vb->vb_length);
3772 REDEBUG(
"Regex must not be empty");
3776 fr_sbuff_next(&sbuff);
3777 fr_sbuff_marker(&start_m, &sbuff);
3781 fr_sbuff_marker(&end_m, &sbuff);
3782 fr_sbuff_next(&sbuff);
3784 slen = regex_flags_parse(NULL, &our_flags, &sbuff, NULL,
true);
3786 RPEDEBUG(
"Failed parsing regex flags");
3793 if (regex_compile(NULL, &our_pattern,
3795 &our_flags,
true,
true) <= 0) {
3796 RPEDEBUG(
"Failed compiling regex");
3799 pattern = our_pattern;
3802 pattern =
inst->pattern;
3803 flags = &
inst->flags;
3807 if (regex_substitute(vb, &
buff, 0, pattern, flags,
3808 subject_vb->vb_strvalue, subject_vb->vb_length,
3809 rep_vb->vb_strvalue, rep_vb->vb_length, NULL) < 0) {
3810 RPEDEBUG(
"Failed performing substitution");
3851#ifdef HAVE_REGEX_PCRE2
3858 char const *p, *q, *end;
3861 char const *pattern, *rep;
3862 size_t pattern_len, rep_len;
3871 pattern = pattern_vb->vb_strvalue;
3872 if (*pattern ==
'/') {
3873#ifdef HAVE_REGEX_PCRE2
3874 switch (xlat_func_subst_regex(ctx,
out, xctx, request,
args)) {
3886 if (memchr(pattern,
'/', pattern_vb->vb_length - 1)) {
3887 REDEBUG(
"regex based substitutions require libpcre2. "
3888 "Check ${features.regex-pcre2} to determine support");
3897 pattern_len = pattern_vb->vb_length;
3898 if (pattern_len == 0) {
3903 rep = rep_vb->vb_strvalue;
3904 rep_len = rep_vb->vb_length;
3906 p = subject_vb->vb_strvalue;
3907 end = p + subject_vb->vb_length;
3913 q = memmem(p, end - p, pattern, pattern_len);
3921 p = q + pattern_len;
3925 RPEDEBUG(
"Failed creating output box");
3949 fr_value_box_list_t *
args)
3952 {
L(
"break"), SIGTRAP },
3953 {
L(
"BREAK"), SIGTRAP },
3954 {
L(
"SIGABRT"), SIGABRT },
3955 {
L(
"SIGALRM"), SIGALRM },
3957 {
L(
"SIGBUS"), SIGBUS },
3959 {
L(
"SIGCHLD"), SIGCHLD },
3960 {
L(
"SIGCONT"), SIGCONT },
3961 {
L(
"SIGFPE"), SIGFPE },
3962 {
L(
"SIGHUP"), SIGHUP },
3963 {
L(
"SIGILL"), SIGILL },
3964 {
L(
"SIGINT"), SIGINT },
3965 {
L(
"SIGKILL"), SIGKILL },
3966 {
L(
"SIGPIPE"), SIGPIPE },
3968 {
L(
"SIGPOLL"), SIGPOLL },
3970 {
L(
"SIGPROF"), SIGPROF },
3971 {
L(
"SIGQUIT"), SIGQUIT },
3972 {
L(
"SIGSEGV"), SIGSEGV },
3973 {
L(
"SIGSTOP"), SIGSTOP },
3975 {
L(
"SIGSYS"), SIGSYS },
3977 {
L(
"SIGTERM"), SIGTERM },
3979 {
L(
"SIGTRAP"), SIGTRAP },
3981 {
L(
"SIGTSTP"), SIGTSTP },
3982 {
L(
"SIGTTIN"), SIGTTIN },
3983 {
L(
"SIGTTOU"), SIGTTOU },
3984 {
L(
"SIGURG"), SIGURG },
3985 {
L(
"SIGUSR1"), SIGUSR1 },
3986 {
L(
"SIGUSR2"), SIGUSR2 },
3987 {
L(
"SIGVTALRM"), SIGVTALRM },
3988 {
L(
"SIGXCPU"), SIGXCPU },
3989 {
L(
"SIGXFSZ"), SIGXFSZ }
3991 static size_t signal_table_len =
NUM_ELEMENTS(signal_table);
4000 RERROR(
"Invalid signal \"%pV\"", signal_vb);
4003 if (raise(signal) < 0) {
4004 RERROR(
"Failed raising signal %d: %s", signal, strerror(errno));
4050 if (!arg || (strcmp(arg->vb_strvalue,
"now") == 0)) {
4053 }
else if (strcmp(arg->vb_strvalue,
"request") == 0) {
4056 }
else if (strcmp(arg->vb_strvalue,
"offset") == 0) {
4061 }
else if (strcmp(arg->vb_strvalue,
"dst") == 0) {
4066 }
else if (strcmp(arg->vb_strvalue,
"mday_offset") == 0) {
4074 nsec = (int64_t) 86400 * (tm.tm_mday - 1);
4075 nsec += when % 86400;
4083 }
else if (strcmp(arg->vb_strvalue,
"wday_offset") == 0) {
4091 nsec = (int64_t) 86400 * tm.tm_wday;
4092 nsec += when % 86400;
4101 REDEBUG(
"Invalid time specification '%s'", arg->vb_strvalue);
4106 vb->vb_date =
value;
4228 p =
UNCONST(
char *, vb->vb_strvalue);
4229 end = p + vb->vb_length;
4232 *(p) = upper ? toupper ((
uint8_t) *(p)) : tolower((
uint8_t) *(p));
4303 char const *p, *end;
4311 p = in_head->vb_strvalue;
4312 end = p + in_head->vb_length;
4335 p = in_head->vb_strvalue;
4388 char const *p, *end;
4390 char const *c1, *c2;
4397 p = in_head->vb_strvalue;
4398 end = p + in_head->vb_length;
4405 if (!p[1] || !p[2]) {
4406 REMARKER(in_head->vb_strvalue, p - in_head->vb_strvalue,
"Invalid %% sequence");
4421 p = in_head->vb_strvalue;
4433 REMARKER(in_head->vb_strvalue, p - in_head->vb_strvalue,
"Non-hex char in %% sequence");
4471 void *decode_ctx = NULL;
4475 bool created =
false;
4481 if (decode_uctx->
dict && decode_uctx->
dict != request->proto_dict) {
4482 REDEBUG2(
"Can't call %%%s() when in %s namespace", xctx->
ex->call.func->name,
4490 REDEBUG2(
"Decoding context must be a structural attribute reference");
4495 REDEBUG2(
"Failed creating decoding root pair");
4498 if (ret == 0) created =
true;
4508 root_da ? &
vp->vp_group : &request->request_pairs,
4509 request, decode_ctx, tp_decode->
func, &in_head->vb_group);
4512 RPERROR(
"Protocol decoding failed");
4523 vb->vb_uint32 = decoded;
4552 switch (subnet->vb_ip.prefix) {
4554 vb->vb_ipv4addr = 0;
4558 vb->vb_ipv4addr = 0xffffffff;
4562 vb->vb_ipv4addr = htonl((
uint32_t)0xffffffff << (32 - subnet->vb_ip.prefix));
4587 vb->vb_ipv4addr = htonl( ntohl(subnet->vb_ipv4addr) | ((
uint32_t)0xffffffff >> subnet->vb_ip.prefix));
4595 *(
void **) mctx->
inst = mctx->
uctx;
4622 bool tainted =
false, encode_children =
false;
4635 memcpy(&tp_encode, xctx->
inst,
sizeof(tp_encode));
4650 REDEBUG2(
"Encoding context must be a structural attribute reference");
4658 if (
root_da->vb_attr ==
vp->
da) encode_children =
true;
4664 RDEBUG2(
"Encoding attributes");
4703 if (encode_children) {
4723 RPEDEBUG(
"Protocol encoding failed");
4727 tainted |=
vp->vp_tainted;
4802 for (p =
name; *p !=
'\0'; p++) {
4898#define XLAT_REGISTER_ARGS(_xlat, _func, _return_type, _args) \
4900 if (unlikely((xlat = xlat_func_register(xlat_ctx, _xlat, _func, _return_type)) == NULL)) return -1; \
4901 xlat_func_args_set(xlat, _args); \
4902 xlat_func_flags_set(xlat, XLAT_FUNC_FLAG_PURE | XLAT_FUNC_FLAG_INTERNAL); \
4905#define XLAT_NEW(_x) xlat->replaced_with = _x
4954#undef XLAT_REGISTER_ARGS
4955#define XLAT_REGISTER_ARGS(_xlat, _func, _return_type, _args) \
4957 if (unlikely((xlat = xlat_func_register(xlat_ctx, _xlat, _func, _return_type)) == NULL)) return -1; \
4958 xlat_func_args_set(xlat, _args); \
4959 xlat_func_flags_set(xlat, XLAT_FUNC_FLAG_INTERNAL); \
4962#undef XLAT_REGISTER_VOID
4963#define XLAT_REGISTER_VOID(_xlat, _func, _return_type) \
4965 if (unlikely((xlat = xlat_func_register(xlat_ctx, _xlat, _func, _return_type)) == NULL)) return -1; \
4966 xlat_func_flags_set(xlat, XLAT_FUNC_FLAG_INTERNAL); \
5005#ifdef HAVE_REGEX_PCRE2
5010#ifdef HAVE_REGEX_PCRE2
5050#define XLAT_REGISTER_PURE(_xlat, _func, _return_type, _arg) \
5052 if (unlikely((xlat = xlat_func_register(xlat_ctx, _xlat, _func, _return_type)) == NULL)) return -1; \
5053 xlat_func_args_set(xlat, _arg); \
5054 xlat_func_flags_set(xlat, XLAT_FUNC_FLAG_PURE | XLAT_FUNC_FLAG_INTERNAL); \
5083 .func =
regex_xlat_escape, .safe_for = FR_REGEX_SAFE_FOR, .always_escape =
true,
5084 .variadic =
true, .concat =
true },
5101#define XLAT_REGISTER_HASH(_name, _func) do { \
5102 XLAT_REGISTER_PURE("hash." _name, _func, FR_TYPE_OCTETS, xlat_func_sha_arg); \
5103 XLAT_REGISTER_PURE(_name, _func, FR_TYPE_OCTETS, xlat_func_sha_arg); \
5104 XLAT_NEW("hash." _name); \
5109#ifdef HAVE_OPENSSL_EVP_H
5116# ifdef HAVE_EVP_BLAKE2S256
5119# ifdef HAVE_EVP_BLAKE2B512
static int const char char buffer[256]
static int const char * fmt
#define fr_base16_encode(_out, _in)
#define fr_base16_decode(_err, _out, _in, _no_trailing)
#define fr_base64_encode(_out, _in, _add_padding)
#define fr_base64_decode(_out, _in, _expect_padding, _no_trailing)
#define FR_BASE64_DEC_LENGTH(_inlen)
#define FR_BASE64_ENC_LENGTH(_inlen)
Encode/decode binary data using printable characters (base64 format)
#define UNCONST(_type, _ptr)
Remove const qualification from a pointer.
#define L(_str)
Helper for initialising arrays of string literals.
A section grouping multiple CONF_PAIR.
fr_dict_attr_t const * root_da
#define fr_dbuff_used(_dbuff_or_marker)
Return the number of bytes remaining between the start of the dbuff or marker and the current positio...
#define fr_dbuff_start(_dbuff_or_marker)
Return the 'start' position of a dbuff or marker.
#define FR_DBUFF_TALLOC_THREAD_LOCAL(_out, _init, _max)
Create a function local and thread local extensible dbuff.
#define FR_DBUFF_TMP(_start, _len_or_end)
Creates a compound literal to pass into functions which accept a dbuff.
static void * fr_dcursor_next(fr_dcursor_t *cursor)
Advanced the cursor to the next item.
static int fr_dcursor_append(fr_dcursor_t *cursor, void *v)
Insert a single item at the end of the list.
static void * fr_dcursor_current(fr_dcursor_t *cursor)
Return the item the cursor current points to.
static void * fr_dcursor_head(fr_dcursor_t *cursor)
Rewind cursor to the start of the list.
fr_dict_t * fr_dict_global_ctx_iter_next(fr_dict_global_ctx_iter_t *iter)
char const * name
Vendor name.
fr_dict_attr_t const * fr_dict_attr_common_parent(fr_dict_attr_t const *a, fr_dict_attr_t const *b, bool is_ancestor)
Find a common ancestor that two TLV type attributes share.
bool fr_dict_compatible(fr_dict_t const *dict1, fr_dict_t const *dict2)
See if two dictionaries have the same end parent.
fr_dict_t * fr_dict_global_ctx_iter_init(fr_dict_global_ctx_iter_t *iter)
Iterate protocols by name.
fr_dict_attr_t const * fr_dict_root(fr_dict_t const *dict)
Return the root attribute of a dictionary.
dl_t * fr_dict_dl(fr_dict_t const *dict)
uint32_t pen
Private enterprise number.
fr_dict_t const * fr_dict_internal(void)
fr_dict_vendor_t const * fr_dict_vendor_by_da(fr_dict_attr_t const *da)
Look up a vendor by one of its child attributes.
dl_loader_t * dl_loader_init(TALLOC_CTX *ctx, void *uctx, bool uctx_free, bool defer_symbol_init)
Initialise structures needed by the dynamic linker.
dl_t * dl_by_name(dl_loader_t *dl_loader, char const *name, void *uctx, bool uctx_free)
Search for a dl's shared object in various locations.
void * handle
Handle returned by dlopen.
static void * fr_dlist_head(fr_dlist_head_t const *list_head)
Return the HEAD item of a list or NULL if the list is empty.
static unsigned int fr_dlist_num_elements(fr_dlist_head_t const *head)
Return the number of elements in the dlist.
static void * fr_dlist_next(fr_dlist_head_t const *list_head, void const *ptr)
Get the next item in a list.
void fr_bio_shutdown & my
static xlat_action_t xlat_func_time_now(TALLOC_CTX *ctx, fr_dcursor_t *out, UNUSED xlat_ctx_t const *xctx, UNUSED request_t *request, UNUSED fr_value_box_list_t *args)
Return the current time as a FR_TYPE_DATE.
static xlat_action_t xlat_func_next_time(TALLOC_CTX *ctx, fr_dcursor_t *out, UNUSED xlat_ctx_t const *xctx, request_t *request, fr_value_box_list_t *args)
Calculate number of seconds until the next n hour(s), day(s), week(s), year(s).
static xlat_action_t xlat_func_lpad(UNUSED TALLOC_CTX *ctx, fr_dcursor_t *out, UNUSED xlat_ctx_t const *xctx, request_t *request, fr_value_box_list_t *args)
lpad a string
static xlat_action_t xlat_func_bin(TALLOC_CTX *ctx, fr_dcursor_t *out, UNUSED xlat_ctx_t const *xctx, request_t *request, fr_value_box_list_t *args)
Convert hex string to binary.
static xlat_action_t xlat_func_pairs_debug(UNUSED TALLOC_CTX *ctx, UNUSED fr_dcursor_t *out, UNUSED xlat_ctx_t const *xctx, request_t *request, fr_value_box_list_t *args)
Print out attribute info.
static xlat_action_t xlat_func_subst(TALLOC_CTX *ctx, fr_dcursor_t *out, UNUSED xlat_ctx_t const *xctx, request_t *request, fr_value_box_list_t *args)
Perform regex substitution.
static xlat_action_t xlat_func_urlunquote(TALLOC_CTX *ctx, fr_dcursor_t *out, UNUSED xlat_ctx_t const *xctx, request_t *request, fr_value_box_list_t *args)
URLdecode special characters.
static xlat_action_t xlat_pair_decode(TALLOC_CTX *ctx, fr_dcursor_t *out, xlat_ctx_t const *xctx, request_t *request, fr_value_box_list_t *in)
Decode any protocol attribute / options.
static xlat_action_t xlat_func_base64_decode(TALLOC_CTX *ctx, fr_dcursor_t *out, UNUSED xlat_ctx_t const *xctx, request_t *request, fr_value_box_list_t *args)
Decode base64 string.
static xlat_action_t xlat_func_hmac_md5(TALLOC_CTX *ctx, fr_dcursor_t *out, UNUSED xlat_ctx_t const *xctx, UNUSED request_t *request, fr_value_box_list_t *in)
Generate the HMAC-MD5 of a string or attribute.
static xlat_action_t xlat_func_base64_encode(TALLOC_CTX *ctx, fr_dcursor_t *out, UNUSED xlat_ctx_t const *xctx, request_t *request, fr_value_box_list_t *args)
Encode string or attribute as base64.
static xlat_action_t xlat_func_log_info(UNUSED TALLOC_CTX *ctx, UNUSED fr_dcursor_t *out, UNUSED xlat_ctx_t const *xctx, request_t *request, fr_value_box_list_t *args)
Log something at INFO level.
static xlat_action_t xlat_func_log_warn(UNUSED TALLOC_CTX *ctx, UNUSED fr_dcursor_t *out, UNUSED xlat_ctx_t const *xctx, request_t *request, fr_value_box_list_t *args)
Log something at WARN level.
static xlat_action_t xlat_func_map(TALLOC_CTX *ctx, fr_dcursor_t *out, UNUSED xlat_ctx_t const *xctx, request_t *request, fr_value_box_list_t *args)
Processes fmt as a map string and applies it to the current request.
static xlat_action_t xlat_func_debug(TALLOC_CTX *ctx, fr_dcursor_t *out, UNUSED xlat_ctx_t const *xctx, request_t *request, fr_value_box_list_t *args)
Dynamically change the debugging level for the current request.
static xlat_action_t xlat_func_log_debug(UNUSED TALLOC_CTX *ctx, UNUSED fr_dcursor_t *out, UNUSED xlat_ctx_t const *xctx, request_t *request, fr_value_box_list_t *args)
Log something at DEBUG level.
static xlat_action_t xlat_func_log_dst(UNUSED TALLOC_CTX *ctx, UNUSED fr_dcursor_t *out, UNUSED xlat_ctx_t const *xctx, request_t *request, fr_value_box_list_t *args)
Change the log destination to the named one.
static xlat_arg_parser_t const xlat_func_string_arg[]
Calculate any digest supported by OpenSSL EVP_MD.
static xlat_action_t xlat_func_module_call(UNUSED TALLOC_CTX *ctx, UNUSED fr_dcursor_t *out, UNUSED xlat_ctx_t const *xctx, request_t *request, fr_value_box_list_t *args)
Calls a named virtual module.
static xlat_action_t xlat_func_block(TALLOC_CTX *ctx, fr_dcursor_t *out, UNUSED xlat_ctx_t const *xctx, UNUSED request_t *request, fr_value_box_list_t *args)
Block for the specified duration.
static xlat_action_t xlat_func_concat(TALLOC_CTX *ctx, fr_dcursor_t *out, UNUSED xlat_ctx_t const *xctx, request_t *request, fr_value_box_list_t *args)
Concatenate string representation of values of given attributes using separator.
static xlat_action_t xlat_func_urlquote(TALLOC_CTX *ctx, fr_dcursor_t *out, UNUSED xlat_ctx_t const *xctx, UNUSED request_t *request, fr_value_box_list_t *args)
URLencode special characters.
static xlat_action_t xlat_func_rpad(UNUSED TALLOC_CTX *ctx, fr_dcursor_t *out, UNUSED xlat_ctx_t const *xctx, request_t *request, fr_value_box_list_t *args)
Right pad a string.
static xlat_action_t xlat_func_md4(TALLOC_CTX *ctx, fr_dcursor_t *out, UNUSED xlat_ctx_t const *xctx, UNUSED request_t *request, fr_value_box_list_t *args)
Calculate the MD4 hash of a string or attribute.
static xlat_action_t xlat_func_explode(TALLOC_CTX *ctx, fr_dcursor_t *out, UNUSED xlat_ctx_t const *xctx, request_t *request, fr_value_box_list_t *args)
Split a string into multiple new strings based on a delimiter.
static xlat_action_t xlat_func_pairs_print(TALLOC_CTX *ctx, fr_dcursor_t *out, UNUSED xlat_ctx_t const *xctx, request_t *request, fr_value_box_list_t *args)
Encode attributes as a series of string attribute/value pairs.
static xlat_action_t xlat_func_time_request(TALLOC_CTX *ctx, fr_dcursor_t *out, UNUSED xlat_ctx_t const *xctx, request_t *request, UNUSED fr_value_box_list_t *args)
Return the request receive time as a FR_TYPE_DATE.
static xlat_action_t xlat_func_regex(TALLOC_CTX *ctx, fr_dcursor_t *out, UNUSED xlat_ctx_t const *xctx, request_t *request, fr_value_box_list_t *in)
Get named subcapture value from previous regex.
static xlat_action_t xlat_func_substr(TALLOC_CTX *ctx, fr_dcursor_t *out, UNUSED xlat_ctx_t const *xctx, request_t *request, fr_value_box_list_t *args)
Extract a substring from string / octets data.
static xlat_action_t xlat_func_length(TALLOC_CTX *ctx, fr_dcursor_t *out, UNUSED xlat_ctx_t const *xctx, UNUSED request_t *request, fr_value_box_list_t *in)
Return the on-the-wire size of the boxes in bytes.
static xlat_action_t xlat_func_immutable_attr(UNUSED TALLOC_CTX *ctx, UNUSED fr_dcursor_t *out, UNUSED xlat_ctx_t const *xctx, request_t *request, fr_value_box_list_t *args)
Mark one or more attributes as immutable.
static xlat_action_t xlat_func_rand(TALLOC_CTX *ctx, fr_dcursor_t *out, UNUSED xlat_ctx_t const *xctx, UNUSED request_t *request, fr_value_box_list_t *in)
Generate a random integer value.
static xlat_action_t xlat_pair_encode(TALLOC_CTX *ctx, fr_dcursor_t *out, xlat_ctx_t const *xctx, request_t *request, fr_value_box_list_t *args)
Encode protocol attributes / options.
static xlat_action_t xlat_func_log_err(UNUSED TALLOC_CTX *ctx, UNUSED fr_dcursor_t *out, UNUSED xlat_ctx_t const *xctx, request_t *request, fr_value_box_list_t *args)
Log something at DEBUG level.
static xlat_action_t xlat_func_hmac_sha1(TALLOC_CTX *ctx, fr_dcursor_t *out, UNUSED xlat_ctx_t const *xctx, UNUSED request_t *request, fr_value_box_list_t *in)
Generate the HMAC-SHA1 of a string or attribute.
static xlat_action_t xlat_func_eval(TALLOC_CTX *ctx, fr_dcursor_t *out, UNUSED xlat_ctx_t const *xctx, request_t *request, fr_value_box_list_t *args)
Dynamically evaluate an expansion string.
static xlat_action_t xlat_func_time_is_dst(TALLOC_CTX *ctx, fr_dcursor_t *out, UNUSED xlat_ctx_t const *xctx, UNUSED request_t *request, UNUSED fr_value_box_list_t *args)
Return whether we are in daylight savings or not.
static xlat_action_t xlat_func_integer(TALLOC_CTX *ctx, fr_dcursor_t *out, UNUSED xlat_ctx_t const *xctx, request_t *request, fr_value_box_list_t *args)
Print data as integer, not as VALUE.
static xlat_action_t xlat_func_time(TALLOC_CTX *ctx, fr_dcursor_t *out, UNUSED xlat_ctx_t const *xctx, request_t *request, fr_value_box_list_t *args)
Return the time as a FR_TYPE_DATE.
static xlat_action_t xlat_func_toupper(TALLOC_CTX *ctx, fr_dcursor_t *out, UNUSED xlat_ctx_t const *xctx, request_t *request, fr_value_box_list_t *in)
Convert a string to uppercase.
static xlat_action_t xlat_func_uuid_v7(TALLOC_CTX *ctx, fr_dcursor_t *out, UNUSED xlat_ctx_t const *xctx, UNUSED request_t *request, UNUSED fr_value_box_list_t *args)
Generate a version 7 UUID.
static xlat_action_t xlat_func_uuid_v4(TALLOC_CTX *ctx, fr_dcursor_t *out, UNUSED xlat_ctx_t const *xctx, UNUSED request_t *request, UNUSED fr_value_box_list_t *args)
Generate a version 4 UUID.
static xlat_action_t xlat_func_cast(TALLOC_CTX *ctx, fr_dcursor_t *out, UNUSED xlat_ctx_t const *xctx, request_t *request, fr_value_box_list_t *args)
Cast one or more output value-boxes to the given type.
static xlat_action_t xlat_func_hex(UNUSED TALLOC_CTX *ctx, fr_dcursor_t *out, UNUSED xlat_ctx_t const *xctx, UNUSED request_t *request, fr_value_box_list_t *args)
Print data as hex, not as VALUE.
static xlat_action_t xlat_func_md5(TALLOC_CTX *ctx, fr_dcursor_t *out, UNUSED xlat_ctx_t const *xctx, UNUSED request_t *request, fr_value_box_list_t *args)
Calculate the MD5 hash of a string or attribute.
static xlat_action_t xlat_func_subnet_netmask(TALLOC_CTX *ctx, fr_dcursor_t *out, UNUSED xlat_ctx_t const *xctx, UNUSED request_t *request, fr_value_box_list_t *args)
Calculate the subnet mask from a IPv4 prefix.
static xlat_action_t xlat_func_sha1(TALLOC_CTX *ctx, fr_dcursor_t *out, UNUSED xlat_ctx_t const *xctx, UNUSED request_t *request, fr_value_box_list_t *args)
Calculate the SHA1 hash of a string or attribute.
static xlat_action_t xlat_func_str_printable(TALLOC_CTX *ctx, fr_dcursor_t *out, UNUSED xlat_ctx_t const *xctx, UNUSED request_t *request, fr_value_box_list_t *args)
Return whether a string has only printable chars.
static xlat_action_t xlat_func_range(TALLOC_CTX *ctx, fr_dcursor_t *out, UNUSED xlat_ctx_t const *xctx, request_t *request, fr_value_box_list_t *args)
Generate a range of uint64 numbers.
static xlat_action_t xlat_func_randstr(TALLOC_CTX *ctx, fr_dcursor_t *out, UNUSED xlat_ctx_t const *xctx, request_t *request, fr_value_box_list_t *args)
Generate a string of random chars.
static xlat_action_t xlat_func_tolower(TALLOC_CTX *ctx, fr_dcursor_t *out, UNUSED xlat_ctx_t const *xctx, request_t *request, fr_value_box_list_t *in)
Convert a string to lowercase.
static xlat_action_t xlat_func_subnet_broadcast(TALLOC_CTX *ctx, fr_dcursor_t *out, UNUSED xlat_ctx_t const *xctx, UNUSED request_t *request, fr_value_box_list_t *args)
Calculate the broadcast address from a IPv4 prefix.
static xlat_action_t xlat_func_str_utf8(TALLOC_CTX *ctx, fr_dcursor_t *out, UNUSED xlat_ctx_t const *xctx, UNUSED request_t *request, fr_value_box_list_t *args)
Return whether a string is valid UTF-8.
static xlat_action_t xlat_func_time_offset(TALLOC_CTX *ctx, fr_dcursor_t *out, UNUSED xlat_ctx_t const *xctx, UNUSED request_t *request, UNUSED fr_value_box_list_t *args)
Return the current time offset from gmt.
static xlat_action_t xlat_func_strlen(TALLOC_CTX *ctx, fr_dcursor_t *out, UNUSED xlat_ctx_t const *xctx, UNUSED request_t *request, fr_value_box_list_t *args)
Print length of given string.
Stores the state of the current iteration operation.
int fr_hmac_md5(uint8_t digest[MD5_DIGEST_LENGTH], uint8_t const *in, size_t inlen, uint8_t const *key, size_t key_len)
Calculate HMAC using internal MD5 implementation.
int fr_hmac_sha1(uint8_t digest[static SHA1_DIGEST_LENGTH], uint8_t const *in, size_t inlen, uint8_t const *key, size_t key_len)
Calculate HMAC using internal SHA1 implementation.
TALLOC_CTX * unlang_interpret_frame_talloc_ctx(request_t *request)
Get a talloc_ctx which is valid only for this frame.
int unlang_interpret_push_section(unlang_result_t *p_result, request_t *request, CONF_SECTION *cs, unlang_frame_conf_t const *conf)
Push a configuration section onto the request stack for later interpretation.
fr_event_list_t * unlang_interpret_event_list(request_t *request)
Get the event list for the current interpreter.
#define FRAME_CONF(_default_rcode, _top_frame)
fr_log_t * log_dst_by_name(char const *name)
Get a logging destination by name.
#define REXDENT()
Exdent (unindent) R* messages by one level.
#define RDEBUG_ENABLED3
True if request debug level 1-3 messages are enabled.
#define REDEBUG3(fmt,...)
#define REMARKER(_str, _marker_idx, _marker,...)
Output string with error marker, showing where format error occurred.
#define RMARKER(_type, _lvl, _str, _marker_idx, _marker,...)
Output string with error marker, showing where format error occurred.
#define RPEDEBUG(fmt,...)
#define RDEBUG_ENABLED4
True if request debug level 1-4 messages are enabled.
#define RIDEBUG2(fmt,...)
#define REDEBUG2(fmt,...)
#define RIDEBUG3(fmt,...)
#define RINDENT()
Indent R* messages by one level.
int map_to_vp(TALLOC_CTX *ctx, fr_pair_list_t *out, request_t *request, map_t const *map, UNUSED void *uctx)
Convert a map to a fr_pair_t.
int map_to_request(request_t *request, map_t const *map, radius_map_getvalue_t func, void *ctx)
Convert map_t to fr_pair_t (s) and add them to a request_t.
int map_afrom_attr_str(TALLOC_CTX *ctx, map_t **out, char const *vp_str, tmpl_rules_t const *lhs_rules, tmpl_rules_t const *rhs_rules)
Convert a value pair string to valuepair map.
ssize_t fr_mkdir(int *fd_out, char const *path, ssize_t len, mode_t mode, fr_mkdir_func_t func, void *uctx)
Create directories that are missing in the specified path.
const fr_sbuff_escape_rules_t fr_filename_escape
const fr_sbuff_escape_rules_t fr_filename_escape_dots
@ L_DST_NULL
Discard log messages.
@ L_DST_FILES
Log to a file on disk.
@ L_DBG_LVL_DISABLE
Don't print messages.
@ L_DBG_LVL_2
2nd highest priority debug messages (-xx | -X).
@ L_DBG_LVL_MAX
Lowest priority debug messages (-xxxxx | -Xxxx).
main_config_t const * main_config
Main server configuration.
char const ** limit_files
where file....() is limited to
void fr_md4_calc(uint8_t out[static MD4_DIGEST_LENGTH], uint8_t const *in, size_t inlen)
Calculate the MD4 hash of the contents of a buffer.
#define MD4_DIGEST_LENGTH
#define MD5_DIGEST_LENGTH
@ FR_TYPE_TIME_DELTA
A period of time measured in nanoseconds.
@ FR_TYPE_FLOAT32
Single precision floating point.
@ FR_TYPE_IPV4_ADDR
32 Bit IPv4 Address.
@ FR_TYPE_INT8
8 Bit signed integer.
@ FR_TYPE_ETHERNET
48 Bit Mac-Address.
@ FR_TYPE_IPV6_PREFIX
IPv6 Prefix.
@ FR_TYPE_STRING
String of printable characters.
@ FR_TYPE_NULL
Invalid (uninitialised) attribute type.
@ FR_TYPE_UINT16
16 Bit unsigned integer.
@ FR_TYPE_INT64
64 Bit signed integer.
@ FR_TYPE_INT16
16 Bit signed integer.
@ FR_TYPE_DATE
Unix time stamp, always has value >2^31.
@ FR_TYPE_COMBO_IP_PREFIX
IPv4 or IPv6 address prefix depending on length.
@ FR_TYPE_UINT8
8 Bit unsigned integer.
@ FR_TYPE_UINT32
32 Bit unsigned integer.
@ FR_TYPE_INT32
32 Bit signed integer.
@ FR_TYPE_UINT64
64 Bit unsigned integer.
@ FR_TYPE_IPV6_ADDR
128 Bit IPv6 Address.
@ FR_TYPE_IPV4_PREFIX
IPv4 Prefix.
@ FR_TYPE_BOOL
A truth value.
@ FR_TYPE_SIZE
Unsigned integer capable of representing any memory address on the local system.
@ FR_TYPE_COMBO_IP_ADDR
IPv4 or IPv6 address depending on length.
@ FR_TYPE_IFID
Interface ID.
@ FR_TYPE_OCTETS
Raw octets.
@ FR_TYPE_GROUP
A grouping of other attributes.
@ FR_TYPE_FLOAT64
Double precision floating point.
void fr_md5_calc(uint8_t out[static MD5_DIGEST_LENGTH], uint8_t const *in, size_t inlen)
Perform a single digest operation on a single input buffer.
size_t fr_snprint_uint128(char *out, size_t outlen, uint128_t const num)
Write 128bit unsigned integer to buffer.
struct tm * gmtime_r(time_t const *l_clock, struct tm *result)
struct tm * localtime_r(time_t const *l_clock, struct tm *result)
CONF_SECTION * module_rlm_virtual_by_name(char const *asked_name)
fr_pair_t * fr_pair_list_parent(fr_pair_list_t const *list)
Return a pointer to the parent pair which contains this list.
int fr_pair_update_by_da_parent(fr_pair_t *parent, fr_pair_t **out, fr_dict_attr_t const *da)
Return the first fr_pair_t matching the fr_dict_attr_t or alloc a new fr_pair_t and its subtree (and ...
int fr_pair_delete(fr_pair_list_t *list, fr_pair_t *vp)
Remove fr_pair_t from a list and free.
fr_slen_t fr_utf8_str(uint8_t const *str, ssize_t inlen)
Validate a complete UTF8 string.
size_t fr_utf8_char(uint8_t const *str, ssize_t inlen)
Checks for utf-8, taken from http://www.w3.org/International/questions/qa-forms-utf-8.
static fr_internal_encode_ctx_t encode_ctx
#define RDEBUG_ENABLED2()
uint32_t fr_rand(void)
Return a 32-bit random number.
@ RLM_MODULE_NOOP
Module succeeded without doing anything.
fr_dict_attr_t const * request_attr_request
void request_log_prepend(request_t *request, fr_log_t *log_dst, fr_log_lvl_t lvl)
Prepend another logging destination to the list.
#define RAD_REQUEST_LVL_NONE
No debug messages should be printed.
char * fr_sbuff_adv_to_str(fr_sbuff_t *sbuff, size_t len, char const *needle, size_t needle_len)
Wind position to the first instance of the specified needle.
char * fr_sbuff_adv_to_chr(fr_sbuff_t *sbuff, size_t len, char c)
Wind position to first instance of specified char.
ssize_t fr_sbuff_in_bstrncpy(fr_sbuff_t *sbuff, char const *str, size_t len)
Copy bytes into the sbuff up to the first \0.
ssize_t fr_sbuff_in_sprintf(fr_sbuff_t *sbuff, char const *fmt,...)
Print using a fmt string to an sbuff.
bool fr_sbuff_next_if_char(fr_sbuff_t *sbuff, char c)
Return true if the current char matches, and if it does, advance.
#define fr_sbuff_start(_sbuff_or_marker)
#define fr_sbuff_set(_dst, _src)
#define FR_SBUFF_IN(_start, _len_or_end)
#define fr_sbuff_adv_past_whitespace(_sbuff, _len, _tt)
#define fr_sbuff_current(_sbuff_or_marker)
char const * name
Name for rule set to aid we debugging.
#define FR_SBUFF(_sbuff_or_marker)
#define fr_sbuff_advance(_sbuff_or_marker, _len)
#define fr_sbuff_init_in(_out, _start, _len_or_end)
#define fr_sbuff_remaining(_sbuff_or_marker)
#define fr_sbuff_len(_sbuff_or_marker)
#define FR_SBUFF_OUT(_start, _len_or_end)
#define fr_sbuff_move(_out, _in, _len)
#define fr_sbuff_used(_sbuff_or_marker)
#define fr_sbuff_behind(_sbuff_or_marker)
#define fr_sbuff_ahead(_sbuff_or_marker)
#define FR_SBUFF_TALLOC_THREAD_LOCAL(_out, _init, _max)
Set of parsing rules for *unescape_until functions.
static char const * tmpl_type_to_str(tmpl_type_t type)
Return a static string containing the type name.
@ TMPL_TYPE_ATTR
Reference to one or more attributes.
@ 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_DATA
Value in native boxed format.
@ TMPL_TYPE_DATA_UNRESOLVED
Unparsed literal string.
tmpl_attr_rules_t attr
Rules/data for parsing attribute references.
Optional arguments passed to vp_tmpl functions.
void fr_sha1_init(fr_sha1_ctx *context)
void fr_sha1_final(uint8_t digest[static SHA1_DIGEST_LENGTH], fr_sha1_ctx *context)
void fr_sha1_update(fr_sha1_ctx *context, uint8_t const *in, size_t len)
#define SHA1_DIGEST_LENGTH
static char buff[sizeof("18446744073709551615")+3]
PUBLIC int snprintf(char *string, size_t length, char *format, va_alist)
eap_aka_sim_process_conf_t * inst
fr_aka_sim_id_type_t type
size_t strlcpy(char *dst, char const *src, size_t siz)
fr_log_t * parent
Log destination this was cloned from.
fr_log_dst_t dst
Log destination.
int fd
File descriptor to write messages to.
char const * file
Path to log file.
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.
fr_dict_t const * dict_def
Default dictionary to use with unqualified attribute references.
Stores an attribute, a value and various bits of other data.
fr_dict_attr_t const *_CONST da
Dictionary attribute defines the attribute number, vendor and type of the pair.
char const * fr_syserror(int num)
Guaranteed to be thread-safe version of strerror.
#define fr_table_value_by_str(_table, _name, _def)
Convert a string to a value using a sorted or ordered table.
#define fr_table_value_by_substr(_table, _name, _name_len, _def)
Convert a partial string to a value using an ordered or sorted table.
An element in an arbitrarily ordered array of name to num mappings.
An element in a lexicographically sorted array of name to num mappings.
char * talloc_bstrndup(TALLOC_CTX *ctx, char const *in, size_t inlen)
Binary safe strndup function.
char * talloc_bstr_append(TALLOC_CTX *ctx, char *to, char const *from, size_t from_len)
Append a bstr to a bstr.
#define talloc_get_type_abort_const
#define talloc_strdup(_ctx, _str)
static size_t talloc_strlen(char const *s)
Returns the length of a talloc array containing a string.
fr_test_point_ctx_alloc_t test_ctx
Allocate a test ctx for the encoder.
fr_test_point_ctx_alloc_t test_ctx
Allocate a test ctx for the encoder.
fr_pair_decode_t func
Decoder for pairs.
fr_pair_encode_t func
Encoder for pairs.
Entry point for pair decoders.
Entry point for pair encoders.
bool fr_time_is_dst(void)
Whether or not we're daylight savings.
int fr_unix_time_from_str(fr_unix_time_t *date, char const *date_str, fr_time_res_t hint)
Convert string in various formats to a fr_unix_time_t.
fr_time_delta_t fr_time_gmtoff(void)
Get the offset to gmt.
#define fr_time_delta_to_timespec(_delta)
Convert a delta to a timespec.
static int64_t fr_time_to_msec(fr_time_t when)
Convert an fr_time_t (internal time) to number of msec since the unix epoch (wallclock time)
static int64_t fr_unix_time_to_sec(fr_unix_time_t delta)
#define fr_time_delta_wrap(_time)
static uint64_t fr_unix_time_unwrap(fr_unix_time_t time)
static fr_time_delta_t fr_time_delta_sub(fr_time_delta_t a, fr_time_delta_t b)
static fr_unix_time_t fr_time_to_unix_time(fr_time_t when)
Convert an fr_time_t (internal time) to our version of unix time (wallclock time)
static fr_time_delta_t fr_time_delta_from_timespec(struct timespec const *ts)
char const * fr_tokens[T_TOKEN_LAST]
xlat_action_t unlang_xlat_yield(request_t *request, xlat_func_t resume, xlat_func_signal_t signal, fr_signal_t sigmask, void *rctx)
Yield a request back to the interpreter from within a module.
int unlang_xlat_push(TALLOC_CTX *ctx, unlang_result_t *p_result, 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.
void unlang_xlat_init(void)
Register xlat operation with the interpreter.
fr_type_t type
Type to cast argument to.
bool xlat_is_literal(xlat_exp_head_t const *head)
Check to see if the expansion consists entirely of value-box elements.
#define XLAT_ARG_PARSER_CURSOR
unsigned int concat
Concat boxes together.
@ XLAT_ARG_VARIADIC_EMPTY_KEEP
Empty argument groups are left alone, and either passed through as empty groups or null boxes.
@ XLAT_ARG_VARIADIC_EMPTY_SQUASH
Empty argument groups are removed.
xlat_arg_parser_variadic_t variadic
All additional boxes should be processed using this definition.
#define XLAT_RESULT_SUCCESS(_p_result)
#define XLAT_ARGS(_list,...)
Populate local variables with value boxes from the input list.
unsigned int required
Argument must be present, and non-empty.
unsigned int single
Argument must only contain a single box.
int xlat_resolve(xlat_exp_head_t *head, xlat_res_rules_t const *xr_rules)
Walk over an xlat tree recursively, resolving any unresolved functions or references.
#define XLAT_ARG_PARSER_TERMINATOR
@ XLAT_ACTION_FAIL
An xlat function failed.
@ XLAT_ACTION_YIELD
An xlat function pushed a resume frame onto the stack.
@ XLAT_ACTION_PUSH_UNLANG
An xlat function pushed an unlang frame onto the unlang stack.
@ XLAT_ACTION_DONE
We're done evaluating this level of nesting.
fr_slen_t xlat_tokenize_expression(TALLOC_CTX *ctx, xlat_exp_head_t **head, fr_sbuff_t *in, fr_sbuff_parse_rules_t const *p_rules, tmpl_rules_t const *t_rules))
Definition for a single argument consumed by an xlat function.
static fr_slen_t fr_pair_aprint(TALLOC_CTX *ctx, char **out, fr_dict_attr_t const *parent, fr_pair_t const *vp) 1(fr_pair_print
fr_pair_t * fr_pair_list_next(fr_pair_list_t const *list, fr_pair_t const *item))
Get the next item in a valuepair list after a specific entry.
static void fr_pair_set_immutable(fr_pair_t *vp)
static fr_slen_t quote ssize_t fr_pair_print_name(fr_sbuff_t *out, fr_dict_attr_t const *parent, fr_pair_t const **vp_p)
Print an attribute name.
#define fr_pair_dcursor_init(_cursor, _list)
Initialises a special dcursor with callbacks that will maintain the attr sublists correctly.
void fr_strerror_clear(void)
Clears all pending messages from the talloc pools.
#define fr_strerror_printf(_fmt,...)
Log to thread local error buffer.
fr_table_num_ordered_t const fr_type_table[]
Map data types to names representing those types.
#define fr_type_is_structural(_x)
@ FR_TYPE_ATTR
A contains an attribute reference.
#define fr_type_is_string(_x)
#define fr_type_is_numeric(_x)
#define FR_TYPE_STRUCTURAL
#define fr_type_is_null(_x)
#define fr_type_is_leaf(_x)
static char const * fr_type_to_str(fr_type_t type)
Return a static string containing the type name.
size_t fr_value_box_network_length(fr_value_box_t const *value)
Get the size of the value held by the fr_value_box_t.
void fr_value_box_mark_unsafe(fr_value_box_t *vb)
Mark a value-box as "unsafe".
ssize_t fr_value_box_list_concat_as_string(fr_value_box_t *safety, fr_sbuff_t *sbuff, fr_value_box_list_t *list, char const *sep, size_t sep_len, fr_sbuff_escape_rules_t const *e_rules, fr_value_box_list_action_t proc_action, fr_value_box_safe_for_t safe_for, bool flatten)
Concatenate a list of value boxes together.
ssize_t fr_value_box_print(fr_sbuff_t *out, fr_value_box_t const *data, fr_sbuff_escape_rules_t const *e_rules)
Print one boxed value to a string.
int fr_value_box_mem_alloc(TALLOC_CTX *ctx, uint8_t **out, fr_value_box_t *dst, fr_dict_attr_t const *enumv, size_t len, bool tainted)
Pre-allocate an octets buffer for filling by the caller.
int fr_value_box_cast(TALLOC_CTX *ctx, fr_value_box_t *dst, fr_type_t dst_type, fr_dict_attr_t const *dst_enumv, fr_value_box_t const *src)
Convert one type of fr_value_box_t to another.
char * fr_value_box_list_aprint(TALLOC_CTX *ctx, fr_value_box_list_t const *list, char const *delim, fr_sbuff_escape_rules_t const *e_rules)
Concatenate the string representations of a list of value boxes together.
int fr_value_box_mem_realloc(TALLOC_CTX *ctx, uint8_t **out, fr_value_box_t *dst, size_t len)
Change the length of a buffer already allocated to a value box.
void fr_value_box_list_untaint(fr_value_box_list_t *head)
Untaint every list member (and their children)
int fr_value_box_cast_in_place(TALLOC_CTX *ctx, fr_value_box_t *vb, fr_type_t dst_type, fr_dict_attr_t const *dst_enumv)
Convert one type of fr_value_box_t to another in place.
void fr_value_box_clear_value(fr_value_box_t *data)
Clear/free any existing value.
int fr_value_box_strdup(TALLOC_CTX *ctx, fr_value_box_t *dst, fr_dict_attr_t const *enumv, char const *src, bool tainted)
Copy a nul terminated string to a fr_value_box_t.
void fr_value_box_safety_copy_changed(fr_value_box_t *out, fr_value_box_t const *in)
Copy the safety values from one box to another.
void fr_value_box_safety_merge(fr_value_box_t *out, fr_value_box_t const *in)
Merge safety results.
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.
void fr_value_box_safety_copy(fr_value_box_t *out, fr_value_box_t const *in)
Copy the safety values from one box to another.
int fr_value_box_bstr_alloc(TALLOC_CTX *ctx, char **out, fr_value_box_t *dst, fr_dict_attr_t const *enumv, size_t len, bool tainted)
Alloc and assign an empty \0 terminated string to a fr_value_box_t.
void fr_value_box_clear(fr_value_box_t *data)
Clear/free any existing value and metadata.
bool fr_value_box_list_tainted(fr_value_box_list_t const *head)
Check to see if any list members (or their children) are tainted.
int fr_value_box_bstr_realloc(TALLOC_CTX *ctx, char **out, fr_value_box_t *dst, size_t len)
Change the length of a buffer already allocated to a value box.
int fr_value_box_bstrndup(TALLOC_CTX *ctx, fr_value_box_t *dst, fr_dict_attr_t const *enumv, char const *src, size_t len, bool tainted)
Copy a string to to a fr_value_box_t.
int fr_value_box_bstrdup_buffer_shallow(TALLOC_CTX *ctx, fr_value_box_t *dst, fr_dict_attr_t const *enumv, char const *src, bool tainted)
Assign a talloced buffer containing a nul terminated string to a box, but don't copy it.
int fr_value_box_memdup(TALLOC_CTX *ctx, fr_value_box_t *dst, fr_dict_attr_t const *enumv, uint8_t const *src, size_t len, bool tainted)
Copy a buffer to a fr_value_box_t.
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.
@ FR_VALUE_BOX_LIST_FREE_BOX
Free each processed box.
#define fr_value_box_alloc(_ctx, _type, _enumv)
Allocate a value box of a specific type.
#define fr_value_box_mark_safe_for(_box, _safe_for)
static fr_value_box_t * fr_value_box_acopy(TALLOC_CTX *ctx, fr_value_box_t const *src)
Copy an existing box, allocating a new box to hold its contents.
#define fr_value_box_is_safe_for(_box, _safe_for)
#define fr_box_is_variable_size(_x)
#define fr_value_box_get_cursor(_dst)
#define VALUE_BOX_VERIFY(_x)
#define VALUE_BOX_LIST_VERIFY(_x)
#define fr_value_box_alloc_null(_ctx)
Allocate a value box for later use with a value assignment function.
#define fr_value_box_list_foreach(_list_head, _iter)
static size_t char ** out
#define fr_box_bool(_val)
#define FR_VALUE_BOX_SAFE_FOR_ANY
fr_dict_t const * virtual_server_dict_by_cs(CONF_SECTION const *cs)
Return the namespace for specified CONF_SECTION.
static xlat_arg_parser_t const xlat_func_bin_arg[]
static int xlat_protocol_register_cbor(void)
static xlat_arg_parser_t const xlat_func_map_arg[]
static xlat_action_t xlat_func_file_tail(TALLOC_CTX *ctx, fr_dcursor_t *out, UNUSED xlat_ctx_t const *xctx, request_t *request, fr_value_box_list_t *args)
#define XLAT_REGISTER_VOID(_xlat, _func, _return_type)
static xlat_arg_parser_t const xlat_func_log_dst_args[]
static xlat_arg_parser_t const xlat_func_taint_args[]
static xlat_arg_parser_t const xlat_func_time_args[]
static xlat_arg_parser_t const xlat_func_base64_encode_arg[]
unlang_result_t last_result
static xlat_action_t xlat_change_case(TALLOC_CTX *ctx, fr_dcursor_t *out, UNUSED request_t *request, fr_value_box_list_t *args, bool upper)
Change case of a string.
static int _log_dst_free(fr_log_t *log)
unlang_result_t last_result
static xlat_arg_parser_t const xlat_pair_encode_args[]
static xlat_action_t xlat_hmac(TALLOC_CTX *ctx, fr_dcursor_t *out, fr_value_box_list_t *args, uint8_t *digest, int digest_len, hmac_type type)
static xlat_arg_parser_t const xlat_func_signal_raise_args[]
static void xlat_debug_attr_vp(request_t *request, fr_pair_t const *vp, fr_dict_attr_t const *da)
static xlat_arg_parser_t const xlat_func_log_arg[]
static xlat_action_t xlat_func_file_mkdir(TALLOC_CTX *ctx, fr_dcursor_t *out, UNUSED xlat_ctx_t const *xctx, request_t *request, fr_value_box_list_t *args)
static xlat_arg_parser_t const xlat_func_sha_arg[]
static xlat_arg_parser_t const xlat_func_cast_args[]
static int xlat_pair_dencode_instantiate(xlat_inst_ctx_t const *mctx)
xlat_action_t xlat_transparent(TALLOC_CTX *ctx, fr_dcursor_t *out, UNUSED xlat_ctx_t const *xctx, UNUSED request_t *request, fr_value_box_list_t *args)
Common function to move boxes from input list to output list.
static xlat_arg_parser_t const xlat_func_hex_arg[]
static xlat_arg_parser_t const xlat_func_substr_args[]
static xlat_action_t xlat_func_file_exists(TALLOC_CTX *ctx, fr_dcursor_t *out, UNUSED xlat_ctx_t const *xctx, UNUSED request_t *request, fr_value_box_list_t *args)
static xlat_action_t xlat_func_file_head(TALLOC_CTX *ctx, fr_dcursor_t *out, UNUSED xlat_ctx_t const *xctx, request_t *request, fr_value_box_list_t *args)
static xlat_arg_parser_t const xlat_func_block_args[]
static xlat_arg_parser_t const xlat_func_subnet_args[]
static xlat_arg_parser_t const xlat_func_module_call_arg[]
#define XLAT_REGISTER_PURE(_xlat, _func, _return_type, _arg)
static xlat_arg_parser_t const xlat_func_str_printable_arg[]
static xlat_arg_parser_t const xlat_func_randstr_arg[]
static xlat_arg_parser_t const xlat_func_eval_arg[]
static xlat_arg_parser_t const xlat_func_subst_args[]
static xlat_arg_parser_t const xlat_func_explode_args[]
int xlat_protocols_register(void)
Register xlats for any loaded dictionaries.
static xlat_arg_parser_t const xlat_func_str_utf8_arg[]
static dl_loader_t * cbor_loader
static xlat_arg_parser_t const xlat_change_case_arg[]
static xlat_arg_parser_t const xlat_func_strlen_arg[]
static int xlat_protocol_register(fr_dict_t const *dict)
static xlat_arg_parser_t const xlat_func_md5_arg[]
int xlat_global_init(void)
static xlat_arg_parser_t const xlat_func_urlquote_arg[]
static xlat_arg_parser_t const xlat_pair_cursor_args[]
static xlat_action_t xlat_func_file_size(TALLOC_CTX *ctx, fr_dcursor_t *out, UNUSED xlat_ctx_t const *xctx, request_t *request, fr_value_box_list_t *args)
static void ungroup(fr_dcursor_t *out, fr_value_box_list_t *in)
static xlat_arg_parser_t const xlat_func_md4_arg[]
static int regex_xlat_escape(UNUSED request_t *request, fr_value_box_t *vb, UNUSED void *uctx)
static xlat_arg_parser_t const xlat_func_join_args[]
static xlat_action_t xlat_module_call_resume(UNUSED TALLOC_CTX *ctx, UNUSED fr_dcursor_t *out, xlat_ctx_t const *xctx, UNUSED request_t *request, UNUSED fr_value_box_list_t *in)
Just serves to push the result up the stack.
static xlat_action_t xlat_eval_resume(UNUSED TALLOC_CTX *ctx, UNUSED fr_dcursor_t *out, xlat_ctx_t const *xctx, UNUSED request_t *request, UNUSED fr_value_box_list_t *in)
Just serves to push the result up the stack.
static xlat_action_t xlat_func_taint(UNUSED TALLOC_CTX *ctx, fr_dcursor_t *out, UNUSED xlat_ctx_t const *xctx, UNUSED request_t *request, fr_value_box_list_t *in)
#define XLAT_REGISTER_HASH(_name, _func)
static xlat_arg_parser_t const xlat_func_debug_args[]
static char const hextab[]
#define FR_FILENAME_SAFE_FOR
static xlat_action_t xlat_func_signal_raise(UNUSED TALLOC_CTX *ctx, UNUSED fr_dcursor_t *out, UNUSED xlat_ctx_t const *xctx, request_t *request, fr_value_box_list_t *args)
fr_test_point_pair_decode_t * tp_decode
static bool xlat_file_allowed(request_t *request, fr_value_box_t const *vb)
static xlat_arg_parser_t const xlat_func_pad_args[]
static int uuid_print_vb(fr_value_box_t *vb, uint32_t vals[4])
Convert a UUID in an array of uint32_t to the conventional string representation.
static xlat_arg_parser_t const xlat_func_urlunquote_arg[]
static xlat_action_t xlat_func_file_touch(TALLOC_CTX *ctx, fr_dcursor_t *out, UNUSED xlat_ctx_t const *xctx, request_t *request, fr_value_box_list_t *args)
fr_dict_t const * dict
Restrict xlat to this namespace.
static xlat_arg_parser_t const xlat_pair_decode_args[]
static xlat_arg_parser_t const xlat_func_rand_arg[]
static void uuid_set_variant(uint32_t vals[4], uint8_t variant)
static int filename_xlat_escape(UNUSED request_t *request, fr_value_box_t *vb, UNUSED void *uctx)
static xlat_arg_parser_t const xlat_func_concat_args[]
#define XLAT_FILE_ALLOWED(_vb)
static xlat_action_t xlat_func_join(TALLOC_CTX *ctx, fr_dcursor_t *out, UNUSED xlat_ctx_t const *xctx, UNUSED request_t *request, fr_value_box_list_t *in)
Join a series of arguments to form a single list.
static xlat_arg_parser_t const xlat_func_file_name_count_args[]
void xlat_arg_copy_out(TALLOC_CTX *ctx, fr_dcursor_t *out, fr_value_box_list_t *in, fr_value_box_t *vb)
Copy an argument from the input list to the output cursor.
static xlat_arg_parser_t const xlat_func_range_arg[]
static xlat_arg_parser_t const xlat_func_integer_args[]
static int _xlat_global_init(UNUSED void *uctx)
Global initialisation for xlat.
#define XLAT_REGISTER_ARGS(_xlat, _func, _return_type, _args)
static xlat_action_t xlat_func_untaint(UNUSED TALLOC_CTX *ctx, fr_dcursor_t *out, UNUSED xlat_ctx_t const *xctx, UNUSED request_t *request, fr_value_box_list_t *in)
static xlat_action_t xlat_func_file_cat(TALLOC_CTX *ctx, fr_dcursor_t *out, UNUSED xlat_ctx_t const *xctx, request_t *request, fr_value_box_list_t *args)
static xlat_action_t xlat_func_file_rm(TALLOC_CTX *ctx, fr_dcursor_t *out, UNUSED xlat_ctx_t const *xctx, request_t *request, fr_value_box_list_t *args)
static xlat_arg_parser_t const xlat_func_length_args[]
static xlat_action_t xlat_func_ungroup(UNUSED TALLOC_CTX *ctx, fr_dcursor_t *out, UNUSED xlat_ctx_t const *xctx, UNUSED request_t *request, fr_value_box_list_t *in)
Ungroups all of its arguments into one flat list.
static int xlat_protocol_register_by_name(dl_t *dl, char const *name, fr_dict_t const *dict)
static xlat_arg_parser_t const xlat_func_file_cat_args[]
static void uuid_set_version(uint32_t vals[4], uint8_t version)
static xlat_action_t xlat_func_file_rmdir(TALLOC_CTX *ctx, fr_dcursor_t *out, UNUSED xlat_ctx_t const *xctx, request_t *request, fr_value_box_list_t *args)
#define UUID_CHARS(_v, _num)
static void xlat_debug_attr_list(request_t *request, fr_pair_list_t const *list, fr_dict_attr_t const *parent)
static xlat_arg_parser_t const xlat_func_file_name_args[]
static TALLOC_CTX * xlat_ctx
static xlat_arg_parser_t const xlat_func_next_time_args[]
static int _xlat_global_free(UNUSED void *uctx)
De-register all xlat functions we created.
static xlat_arg_parser_t const xlat_func_base64_decode_arg[]
static xlat_arg_parser_t const xlat_hmac_args[]
static xlat_arg_parser_t const xlat_func_regex_args[]
void * rctx
Resume context.
xlat_exp_t const * ex
Tokenized expression.
xlat_exp_t * ex
Tokenized expression to use in expansion.
void const * inst
xlat instance data.
void * uctx
Passed to the registration function.
void * inst
xlat instance data to populate.
An xlat instantiation ctx.
fr_dict_attr_t const * xlat_time_res_attr(char const *res)
void xlat_eval_free(void)
int xlat_register_expressions(void)
void xlat_func_free(void)
void xlat_func_flags_set(xlat_t *x, xlat_func_flags_t flags)
Specify flags that alter the xlat's behaviour.
int xlat_func_args_set(xlat_t *x, xlat_arg_parser_t const args[])
Register the arguments of an xlat.
xlat_t * xlat_func_register(TALLOC_CTX *ctx, char const *name, xlat_func_t func, fr_type_t return_type)
Register an xlat function.
xlat_t * xlat_func_find(char const *in, ssize_t inlen)
#define xlat_func_instantiate_set(_xlat, _instantiate, _inst_struct, _detach, _uctx)
Set a callback for global instantiation of xlat functions.
#define xlat_func_safe_for_set(_xlat, _escaped)
Set the escaped values for output boxes.
@ XLAT_FUNC_FLAG_INTERNAL
int xlat_decode_value_box_list(TALLOC_CTX *ctx, fr_pair_list_t *out, request_t *request, void *decode_ctx, fr_pair_decode_t decode, fr_value_box_list_t *in)
Decode all of the value boxes into the output cursor.
@ XLAT_GROUP
encapsulated string of xlats
bool deprecated
this function was deprecated
xlat_type_t _CONST type
type of this expansion.