26RCSID(
"$Id: ca4f748a658c0a82241dbab1a63926e6ba87b9e8 $")
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";
76 fr_value_box_list_remove(
in, vb);
77 if (talloc_parent(vb) != ctx) {
78 (void) talloc_steal(ctx, vb);
113 vb->vb_int8 =
request->log.lvl;
119 if (!lvl_vb)
goto done;
121 level = lvl_vb->vb_int8;
175 if (slen <= 0)
return;
177 switch (
vp->vp_type) {
207 switch (
vp->vp_type) {
244 if ((pad = (11 -
type->name.len)) < 0) pad = 0;
247 RDEBUG4(
"as %s%*s: %pV",
type->name.str, pad,
" ", dst);
305 RDEBUG(
"Attributes matching \"%s\"", in_head->vb_cursor_name);
319#pragma clang diagnostic ignored "-Wgnu-designator"
322#define FR_FILENAME_SAFE_FOR ((uintptr_t) filename_xlat_escape)
327 fr_value_box_entry_t entry;
400 if (vb->vb_strvalue[0] ==
'.') {
405 if (slen < 0)
return -1;
445 if (!
fr_filename_ok(vb->vb_strvalue, vb->vb_strvalue + vb->vb_length, (oflags & O_DIRECTORY) != 0)) {
446 RPEDEBUG(
"Invalid filename %pV", vb);
460 REDEBUG(
"Failed accessing file %pV - all %%file() access is forbidden by the 'limit files { ... }' section", vb);
475 REDEBUG(
"Failed accessing file %pV - it is outside of allowed access for 'limit files { ... }'", vb);
485 if (((oflags & O_ACCMODE) != O_RDONLY) ||
488 REDEBUG(
"Failed accessing file %pV - it is outside of read-only access for 'limit files { ... }'", vb);
496#define XLAT_FILE_ALLOWED(_vb, _p) xlat_file_allowed(request, _vb, _p)
503 char const *filename;
508 filename = vb->vb_strvalue;
515 dst->vb_bool = (stat(filename, &buf) == 0);
526 char const *filename;
533 filename = vb->vb_strvalue;
537 fd = open(filename, O_RDONLY);
554 if ((*p ==
'\r') || (*p ==
'\n')) {
558 if ((*p <
' ') && (*p !=
'\t')) {
560 REDEBUG(
"Invalid text in file %s", filename);
586 char const *filename;
591 filename = vb->vb_strvalue;
595 if (stat(filename, &buf) < 0) {
603 dst->vb_uint64 = buf.st_size;
614 char const *filename;
619 char *p, *end, *found,
buffer[256];
623 filename = vb->vb_strvalue;
627 fd = open(filename, O_RDONLY);
633 offset = lseek(fd, 0, SEEK_END);
645 if (lseek(fd, offset, SEEK_SET) < 0) {
646 REDEBUG3(
"Failed seeking backwards from end of file %s - %s", filename,
fr_syserror(errno));
675 fr_assert(fr_value_box_list_num_elements(&num->vb_group) == 1);
677 num = fr_value_box_list_head(&num->vb_group);
680 if (!num->vb_uint32) {
683 }
else if (num->vb_uint32 <= 16) {
684 stop = num->vb_uint32;
735 if ((crlf ==
stop) && (*found <
' ')) {
800 { .required =
true, .type =
FR_TYPE_SIZE, .single =
true },
809 char const *filename;
817 filename = vb->vb_strvalue;
821 fd = open(filename, O_RDONLY);
827 if (fstat(fd, &buf) < 0) {
834 if ((
size_t)buf.st_size > max_size->vb_size) {
835 RPERROR(
"File larger than specified maximum (%"PRIu64
" vs %zu)", buf.st_size, max_size->vb_size);
850 if (
len < buf.st_size) {
851 RPERROR(
"Failed reading all of file %s", filename);
866 char const *filename;
870 filename = vb->vb_strvalue;
877 dst->vb_bool = (unlink(filename) == 0);
889 char const *filename;
894 filename = vb->vb_strvalue;
901 fd = open(filename, O_CREAT | O_WRONLY, 0600);
903 dst->vb_bool =
false;
922 dirname = vb->vb_strvalue;
929 dst->vb_bool = (
fr_mkdir(NULL, dirname, -1, 0700, NULL, NULL) > 0);
945 dirname = vb->vb_strvalue;
952 dst->vb_bool = (rmdir(dirname) == 0);
985 while ((vb = fr_value_box_list_pop_head(
in)) != NULL) {
990 while ((child = fr_value_box_list_pop_head(&vb->vb_group)) != NULL) {
991 child->tainted =
true;
1028 fr_value_box_list_t *list;
1039 if (delim_vb->vb_length == 0) {
1040 REDEBUG(
"Delimiter must be greater than zero characters");
1044 delim = delim_vb->vb_strvalue;
1045 delim_len = delim_vb->vb_length;
1047 while ((
string = fr_value_box_list_pop_head(list))) {
1059 fr_sbuff_set_to_start(&sbuff);
1060 fr_sbuff_marker(&m_start, &sbuff);
1081 fr_sbuff_set_to_end(&sbuff);
1117 RDEBUG(
"Attributes matching \"%s\"", in_head->vb_cursor_name);
1157 fr_value_box_list_remove(
args, in_vb);
1159 switch (in_vb->type) {
1162 RPEDEBUG(
"Failed converting %pR (%s) to an integer", in_vb,
1172 in_vb->enumv = NULL;
1194 for (p = in_vb->vb_strvalue; *p !=
'\0'; p++) {
1195 if (*p ==
'-')
break;
1206 if (in_vb->vb_length >
sizeof(uint64_t)) {
1207 fr_strerror_printf(
"Expected octets length <= %zu, got %zu",
sizeof(uint64_t), in_vb->vb_length);
1211 if (in_vb->vb_length >
sizeof(
uint32_t)) {
1213 }
else if (in_vb->vb_length >
sizeof(
uint16_t)) {
1215 }
else if (in_vb->vb_length >
sizeof(
uint8_t)) {
1242 memcpy(&ipv6int, &in_vb->vb_ipv6addr,
sizeof(ipv6int));
1283 RINFO(
"%s", vb->vb_strvalue);
1308 RDEBUG(
"%s", vb->vb_strvalue);
1333 REDEBUG(
"%s", vb->vb_strvalue);
1358 RWDEBUG(
"%s", vb->vb_strvalue);
1404 if (!dst || !*dst->vb_strvalue) {
1412 if (lvl) level = lvl->vb_uint32;
1422 MEM(dbg = talloc_memdup(
request, log,
sizeof(*log)));
1435 dbg->
fd = open(dbg->
file, O_WRONLY | O_CREAT | O_CLOEXEC, 0600);
1491 vb->vb_bool =
false;
1496 RPEDEBUG(
"Failed parsing \"%s\" as map", fmt_vb->vb_strvalue);
1500 switch (map->
lhs->type) {
1506 REDEBUG(
"Unexpected type %s in left hand side of expression",
1511 switch (map->
rhs->type) {
1521 REDEBUG(
"Unexpected type %s in right hand side of expression",
1587 REDEBUG(
"Unknown module %pV", box);
1593 REDEBUG(
"Virtual module %pV does not have a known dictionary - ignoring", box);
1644 struct tm *local, local_buff;
1656 p = in_head->vb_strvalue;
1658 num = strtoul(p, &q, 10);
1659 if ((num == ULONG_MAX) || !q || *q ==
'\0') {
1660 REDEBUG(
"<int> must be followed by time period (h|d|w|m|y)");
1664 REDEBUG(
"<int> must be greater than zero");
1679 local->tm_hour += num;
1684 local->tm_mday += num;
1689 local->tm_mday += (7 - local->tm_wday) + (7 * (num-1));
1695 local->tm_mon += num;
1702 local->tm_year += num;
1706 REDEBUG(
"Invalid time period '%c', must be h|d|w|m|y", *p);
1711 fr_value_box_uint64(vb, NULL, (uint64_t)(mktime(local) - now),
false);
1781 &(fr_sbuff_parse_rules_t){
1782 .escapes = &escape_rules
1786 .dict_def = request->local_dict,
1787 .list_def = request_attr_request,
1788 .allow_unknown = false,
1789 .allow_unresolved = false,
1790 .allow_foreign = false,
1793 .runtime_el = unlang_interpret_event_list(request),
1797 RPEDEBUG(
"Failed parsing expansion");
1808 if (rctx->ex->flags.needs_resolving &&
1810 RPEDEBUG(
"Unresolved expansion functions in expansion");
1851 fr_value_box_list_t *list;
1855 char const *fill_str = NULL;
1856 size_t fill_len = 0;
1863 list = &values->vb_group;
1865 pad_len = (
size_t)pad->vb_uint64;
1871 fill_str =
fill->vb_strvalue;
1875 if (fill_len == 0) {
1880 while ((
in = fr_value_box_list_pop_head(list))) {
1889 if (
len >= pad_len)
continue;
1892 RPEDEBUG(
"Failed reallocing input data");
1897 fr_sbuff_marker(&m_data, &sbuff);
1908 if (fill_len == 1) {
1917 size_t to_copy = remaining >= fill_len ? fill_len : remaining;
1921 fr_sbuff_set_to_end(&sbuff);
1922 fr_sbuff_terminate(&sbuff);
1946 fr_value_box_list_t *list;
1951 char const *fill_str = NULL;
1952 size_t fill_len = 0;
1958 list = &values->vb_group;
1959 pad_len = (
size_t)pad->vb_uint64;
1965 fill_str =
fill->vb_strvalue;
1969 if (fill_len == 0) {
1974 while ((
in = fr_value_box_list_pop_head(list))) {
1982 if (
len >= pad_len)
continue;
1986 RPEDEBUG(
"Failed reallocing input data");
1993 if (fill_len == 1) {
2002 if (
fr_sbuff_in_bstrncpy(&sbuff, fill_str, remaining >= fill_len ? fill_len : remaining) < 0) {
2048 RPEDEBUG(
"Base64 encoding failed");
2090 if (
in->vb_length == 0) {
2137 char const *p, *end;
2145 while ((hex = fr_value_box_list_pop_head(&list->vb_group))) {
2146 len = hex->vb_length;
2147 if ((
len > 1) && (
len & 0x01)) {
2148 REDEBUG(
"Input data length must be >1 and even, got %zu",
len);
2152 p = hex->vb_strvalue;
2158 if ((p[0] ==
'0') && (p[1] ==
'x')) {
2166 if (p == end)
continue;
2209 struct timespec ts_in, ts_remain = {};
2215 (void)nanosleep(&ts_in, &ts_remain);
2259 RPEDEBUG(
"Failed parsing '%pV' as a numerical data type",
name);
2267 RPEDEBUG(
"Failed parsing '%pV' as a string data type",
name);
2275 RDEBUG(
"Unknown data type '%s'",
name->vb_strvalue);
2283 (void) fr_value_box_list_pop_head(
args);
2319 RPEDEBUG(
"Failed concatenating string");
2335 while ((arg = fr_value_box_list_next(
args, arg)) != NULL) {
2340 vb = fr_value_box_list_head(&arg->vb_group);
2342 p = fr_value_box_list_remove(&arg->vb_group, vb);
2349 vb = fr_value_box_list_next(&arg->vb_group, p);
2384 fr_value_box_list_t *to_concat;
2390 sep = (separator) ? separator->vb_strvalue :
"";
2391 to_concat = &list->vb_group;
2396 RPEDEBUG(
"Failed concatenating input");
2401 if (!
buff)
goto error;
2436 while ((bin = fr_value_box_list_pop_head(&list->vb_group))) {
2442 MEM(new_buff = talloc_zero_array(bin,
char, (bin->vb_length * 2) + 1));
2443 if (bin->vb_length) {
2560 while ((vb = fr_value_box_list_pop_head(
in)) != NULL) {
2578 while ((arg = fr_value_box_list_next(
in, arg)) != NULL) {
2647 fr_md4_calc(digest, in_head->vb_octets, in_head->vb_length);
2687 fr_md5_calc(digest, in_head->vb_octets, in_head->vb_length);
2775 result = in_head->vb_uint32;
2778 if (result > (1 << 30)) result = (1 << 30);
2784 vb->vb_uint64 = result;
2829 static char randstr_punc[] =
"!\"#$%&'()*+,-./:;<=>?@[\\]^_`{|}~";
2830 static char randstr_salt[] =
"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmopqrstuvwxyz/.";
2836 static char randstr_otp[] =
"469ACGHJKLMNPQRUVWXYabdfhijkprstuvwxyz";
2838 char const *p, *start, *end;
2852#define REPETITION_MAX 1024
2854 start = p = in_head->vb_strvalue;
2855 end = p + in_head->vb_length;
2868 reps = strtol(p, &endptr, 10);
2888 reps = strtol(p, &endptr, 10);
2899 for (i = 0; i < reps; i++) {
2906 *buff_p++ =
'a' + (result % 26);
2913 *buff_p++ =
'A' + (result % 26);
2920 *buff_p++ =
'0' + (result % 10);
2927 *buff_p++ = randstr_salt[result % (
sizeof(randstr_salt) - 3)];
2934 *buff_p++ = randstr_punc[result % (
sizeof(randstr_punc) - 1)];
2941 *buff_p++ =
'!' + (result % 95);
2948 *buff_p++ = randstr_salt[result % (
sizeof(randstr_salt) - 1)];
2956 *buff_p++ = randstr_otp[result % (
sizeof(randstr_otp) - 1)];
2964 size_t copy = (reps - i) >
sizeof(result) ?
sizeof(result) : reps - i;
2966 memcpy(buff_p, (
uint8_t *)&result, copy);
2973 REDEBUG(
"Invalid character class '%c'", *p);
2997#define UUID_CHARS(_v, _num) for (i = 0; i < _num; i++) { \
2998 buffer[j++] = fr_base16_alphabet_encode_lc[(uint8_t)((vals[_v] & 0xf0000000) >> 28)]; \
2999 vals[_v] = vals[_v] << 4; \
3021 vals[1] = (vals[1] & 0xffff0fff) | (((
uint32_t)version & 0x0f) << 12);
3032 vals[2] = vals[2] & 0x7fffffff;
3036 vals[2] = (vals[2] & 0x3fffffff) | 0x80000000;
3040 vals[2] = (vals[2] & 0x3fffffff) | 0xc0000000;
3044 vals[2] = vals[2] | 0xe0000000;
3072 for (i = 0; i < 4; i++) vals[i] =
fr_rand();
3113 for (i = 1; i < 4; i++) vals[i] =
fr_rand();
3120 vals[0] = now >> 32;
3121 vals[1] = (vals[1] & 0x0000ffff) | (now & 0xffff0000);
3158 uint64_t i, start, end, step;
3173 REDEBUG(
"Invalid range - 'end' cannot be null when 'step' is provided");
3177 start = fr_value_box_list_head(&start_vb->vb_group)->vb_uint64;
3178 end = fr_value_box_list_head(&end_vb->vb_group)->vb_uint64;
3179 step = fr_value_box_list_head(&step_vb->vb_group)->vb_uint64;
3181 }
else if (end_vb) {
3182 start = fr_value_box_list_head(&start_vb->vb_group)->vb_uint64;
3183 end = fr_value_box_list_head(&end_vb->vb_group)->vb_uint64;
3188 end = fr_value_box_list_head(&start_vb->vb_group)->vb_uint64;
3193 REDEBUG(
"Invalid range - 'start' must be less than 'end'");
3198 REDEBUG(
"Invalid range - 'step' must be greater than zero");
3202 if (step > (end - start)) {
3203 REDEBUG(
"Invalid range - 'step' must allow for at least one result");
3207 if (((end - start) / step) > 1000) {
3208 REDEBUG(
"Invalid range - Too many results");
3212 for (i = start; i < end; i += step) {
3227 fr_value_box_entry_t entry;
3232 if (slen < 0)
return -1;
3269 fr_value_box_t *arg = fr_value_box_list_head(&in_head->vb_group);
3278 if (regex_request_to_sub(vb, vb,
request, 0) < 0) {
3279 REDEBUG2(
"No previous regex capture");
3289 switch (arg->type) {
3299 if (fr_value_box_list_next(
in, in_head)) {
3300 REDEBUG(
"Only one subcapture argument allowed");
3310 if (regex_request_to_sub(vb, vb,
request, idx.vb_uint32) < 0) {
3311 REDEBUG2(
"No previous numbered regex capture group '%u'", idx.vb_uint32);
3321#if defined(HAVE_REGEX_PCRE) || defined(HAVE_REGEX_PCRE2)
3332 RPEDEBUG(
"Failed concatenating input");
3337 if (regex_request_to_sub_named(vb, vb,
request, arg->vb_strvalue) < 0) {
3338 REDEBUG2(
"No previous named regex capture group '%s'", arg->vb_strvalue);
3347 RDEBUG(
"Named regex captures are not supported (they require libpcre2)");
3380 fr_sha1_update(&sha1_ctx, in_head->vb_octets, in_head->vb_length);
3404#ifdef HAVE_OPENSSL_EVP_H
3409 uint8_t digest[EVP_MAX_MD_SIZE];
3410 unsigned int digestlen;
3417 md_ctx = EVP_MD_CTX_create();
3418 EVP_DigestInit_ex(md_ctx, md, NULL);
3420 EVP_DigestUpdate(md_ctx, in_head->vb_octets, in_head->vb_length);
3422 EVP_DigestUpdate(md_ctx, NULL, 0);
3424 EVP_DigestFinal_ex(md_ctx, digest, &digestlen);
3425 EVP_MD_CTX_destroy(md_ctx);
3435# define EVP_MD_XLAT(_md, _md_func) \
3436static xlat_action_t xlat_func_##_md(TALLOC_CTX *ctx, fr_dcursor_t *out,\
3437 xlat_ctx_t const *xctx, \
3438 request_t *request,\
3439 fr_value_box_list_t *in)\
3441 return xlat_evp_md(ctx, out, xctx, request, in, EVP_##_md_func());\
3444EVP_MD_XLAT(sha2_224, sha224)
3445EVP_MD_XLAT(sha2_256, sha256)
3446EVP_MD_XLAT(sha2_384, sha384)
3447EVP_MD_XLAT(sha2_512, sha512)
3452#ifdef HAVE_EVP_BLAKE2S256
3453EVP_MD_XLAT(blake2s_256, blake2s256)
3456#ifdef HAVE_EVP_BLAKE2B512
3457EVP_MD_XLAT(blake2b_512, blake2b512)
3460EVP_MD_XLAT(sha3_224, sha3_224)
3461EVP_MD_XLAT(sha3_256, sha3_256)
3462EVP_MD_XLAT(sha3_384, sha3_384)
3463EVP_MD_XLAT(sha3_512, sha3_512)
3502 vb->vb_size = strlen(in_head->vb_strvalue);
3539 bool relaxed =
false;
3543 if (relaxed_vb) relaxed = relaxed_vb->vb_bool;
3545 p = (
uint8_t const *)str->vb_strvalue;
3546 end = p + str->vb_length;
3550 vb->vb_bool =
false;
3600 in_head->vb_length) >= 0);
3609 { .single =
true, .required =
true, .type =
FR_TYPE_INT32 },
3632 int32_t start, end,
len;
3643 RPEDEBUG(
"Failed casting value to string");
3651 if (start_vb->vb_int32 < 0) {
3652 start =
in->vb_length + start_vb->vb_int32;
3653 if (start < 0) start = 0;
3655 start = start_vb->vb_int32;
3659 if (len_vb->vb_int32 < 0) {
3660 end =
in->vb_length + len_vb->vb_int32;
3663 end = start + len_vb->vb_int32;
3664 if (end > (int32_t)
in->vb_length) end =
in->vb_length;
3667 end =
in->vb_length;
3683 memcpy(buf, &
in->vb_octets[start],
len);
3697#ifdef HAVE_REGEX_PCRE2
3702 fr_regex_flags_t flags;
3703} xlat_subst_regex_inst_t;
3709 xlat_subst_regex_inst_t *
inst = talloc_get_type_abort(xctx->
inst, xlat_subst_regex_inst_t);
3727 sbuff =
FR_SBUFF_IN(patt_exp->data.vb_strvalue, patt_exp->data.vb_length);
3736 fr_sbuff_marker(&start_m, &sbuff);
3740 fr_sbuff_marker(&end_m, &sbuff);
3741 fr_sbuff_next(&sbuff);
3744 slen = regex_flags_parse(NULL, &
inst->flags,
3748 PERROR(
"Failed parsing regex flags in \"%s\"", patt_exp->data.vb_strvalue);
3753 if (regex_compile(
inst, &
inst->pattern,
3755 &
inst->flags,
true,
false) <= 0) {
3756 PERROR(
"Failed compiling regex \"%s\"", patt_exp->data.vb_strvalue);
3786 fr_value_box_list_t *
args)
3793 regex_t *pattern, *our_pattern = NULL;
3794 fr_regex_flags_t
const *flags;
3795 fr_regex_flags_t our_flags = {};
3806 if (!
inst->pattern) {
3807 sbuff =
FR_SBUFF_IN(regex_vb->vb_strvalue, regex_vb->vb_length);
3809 REDEBUG(
"Regex must not be empty");
3813 fr_sbuff_next(&sbuff);
3814 fr_sbuff_marker(&start_m, &sbuff);
3818 fr_sbuff_marker(&end_m, &sbuff);
3819 fr_sbuff_next(&sbuff);
3821 slen = regex_flags_parse(NULL, &our_flags, &sbuff, NULL,
true);
3823 RPEDEBUG(
"Failed parsing regex flags");
3830 if (regex_compile(NULL, &our_pattern,
3832 &our_flags,
true,
true) <= 0) {
3833 RPEDEBUG(
"Failed compiling regex");
3836 pattern = our_pattern;
3839 pattern =
inst->pattern;
3840 flags = &
inst->flags;
3844 if (regex_substitute(vb, &
buff, 0, pattern, flags,
3845 subject_vb->vb_strvalue, subject_vb->vb_length,
3846 rep_vb->vb_strvalue, rep_vb->vb_length, NULL) < 0) {
3847 RPEDEBUG(
"Failed performing substitution");
3888#ifdef HAVE_REGEX_PCRE2
3895 char const *p, *q, *end;
3898 char const *pattern, *rep;
3899 size_t pattern_len, rep_len;
3908 pattern = pattern_vb->vb_strvalue;
3909 if (*pattern ==
'/') {
3910#ifdef HAVE_REGEX_PCRE2
3923 if (memchr(pattern,
'/', pattern_vb->vb_length - 1)) {
3924 REDEBUG(
"regex based substitutions require libpcre2. "
3925 "Check ${features.regex-pcre2} to determine support");
3934 pattern_len = pattern_vb->vb_length;
3935 if (pattern_len == 0) {
3940 rep = rep_vb->vb_strvalue;
3941 rep_len = rep_vb->vb_length;
3943 p = subject_vb->vb_strvalue;
3944 end = p + subject_vb->vb_length;
3950 q = memmem(p, end - p, pattern, pattern_len);
3958 p = q + pattern_len;
3962 RPEDEBUG(
"Failed creating output box");
3986 fr_value_box_list_t *
args)
3989 {
L(
"break"), SIGTRAP },
3990 {
L(
"BREAK"), SIGTRAP },
3991 {
L(
"SIGABRT"), SIGABRT },
3992 {
L(
"SIGALRM"), SIGALRM },
3994 {
L(
"SIGBUS"), SIGBUS },
3996 {
L(
"SIGCHLD"), SIGCHLD },
3997 {
L(
"SIGCONT"), SIGCONT },
3998 {
L(
"SIGFPE"), SIGFPE },
3999 {
L(
"SIGHUP"), SIGHUP },
4000 {
L(
"SIGILL"), SIGILL },
4001 {
L(
"SIGINT"), SIGINT },
4002 {
L(
"SIGKILL"), SIGKILL },
4003 {
L(
"SIGPIPE"), SIGPIPE },
4005 {
L(
"SIGPOLL"), SIGPOLL },
4007 {
L(
"SIGPROF"), SIGPROF },
4008 {
L(
"SIGQUIT"), SIGQUIT },
4009 {
L(
"SIGSEGV"), SIGSEGV },
4010 {
L(
"SIGSTOP"), SIGSTOP },
4012 {
L(
"SIGSYS"), SIGSYS },
4014 {
L(
"SIGTERM"), SIGTERM },
4016 {
L(
"SIGTRAP"), SIGTRAP },
4018 {
L(
"SIGTSTP"), SIGTSTP },
4019 {
L(
"SIGTTIN"), SIGTTIN },
4020 {
L(
"SIGTTOU"), SIGTTOU },
4021 {
L(
"SIGURG"), SIGURG },
4022 {
L(
"SIGUSR1"), SIGUSR1 },
4023 {
L(
"SIGUSR2"), SIGUSR2 },
4024 {
L(
"SIGVTALRM"), SIGVTALRM },
4025 {
L(
"SIGXCPU"), SIGXCPU },
4026 {
L(
"SIGXFSZ"), SIGXFSZ }
4028 static size_t signal_table_len =
NUM_ELEMENTS(signal_table);
4037 RERROR(
"Invalid signal \"%pV\"", signal_vb);
4040 if (raise(signal) < 0) {
4041 RERROR(
"Failed raising signal %d: %s", signal, strerror(errno));
4087 if (!arg || (strcmp(arg->vb_strvalue,
"now") == 0)) {
4090 }
else if (strcmp(arg->vb_strvalue,
"request") == 0) {
4093 }
else if (strcmp(arg->vb_strvalue,
"offset") == 0) {
4098 }
else if (strcmp(arg->vb_strvalue,
"dst") == 0) {
4103 }
else if (strcmp(arg->vb_strvalue,
"mday_offset") == 0) {
4111 nsec = (int64_t) 86400 * (tm.tm_mday - 1);
4112 nsec += when % 86400;
4120 }
else if (strcmp(arg->vb_strvalue,
"wday_offset") == 0) {
4128 nsec = (int64_t) 86400 * tm.tm_wday;
4129 nsec += when % 86400;
4138 REDEBUG(
"Invalid time specification '%s'", arg->vb_strvalue);
4143 vb->vb_date =
value;
4265 p =
UNCONST(
char *, vb->vb_strvalue);
4266 end = p + vb->vb_length;
4269 *(p) = upper ? toupper ((
uint8_t) *(p)) : tolower((
uint8_t) *(p));
4340 char const *p, *end;
4348 p = in_head->vb_strvalue;
4349 end = p + in_head->vb_length;
4372 p = in_head->vb_strvalue;
4425 char const *p, *end;
4427 char const *c1, *c2;
4434 p = in_head->vb_strvalue;
4435 end = p + in_head->vb_length;
4442 if (!p[1] || !p[2]) {
4443 REMARKER(in_head->vb_strvalue, p - in_head->vb_strvalue,
"Invalid %% sequence");
4458 p = in_head->vb_strvalue;
4470 REMARKER(in_head->vb_strvalue, p - in_head->vb_strvalue,
"Non-hex char in %% sequence");
4508 void *decode_ctx = NULL;
4513 bool created =
false;
4520 REDEBUG2(
"Can't call %%%s() when in %s namespace", xctx->
ex->call.func->name,
4528 REDEBUG2(
"Decoding context must be a structural attribute reference");
4533 REDEBUG2(
"Failed creating decoding root pair");
4536 if (ret == 0) created =
true;
4547 request, decode_ctx, tp_decode->
func, &in_head->vb_group);
4550 RPERROR(
"Protocol decoding failed");
4561 vb->vb_uint32 = decoded;
4590 switch (subnet->vb_ip.prefix) {
4592 vb->vb_ipv4addr = 0;
4596 vb->vb_ipv4addr = 0xffffffff;
4600 vb->vb_ipv4addr = htonl((
uint32_t)0xffffffff << (32 - subnet->vb_ip.prefix));
4625 vb->vb_ipv4addr = htonl( ntohl(subnet->vb_ipv4addr) | ((
uint32_t)0xffffffff >> subnet->vb_ip.prefix));
4670 bool tainted =
false, encode_children =
false;
4697 REDEBUG2(
"Encoding context must be a structural attribute reference");
4706 if (
root_da->vb_attr ==
vp->
da) encode_children =
true;
4713 RDEBUG2(
"Encoding attributes");
4752 if (encode_children) {
4772 RPEDEBUG(
"Protocol encoding failed");
4776 tainted |=
vp->vp_tainted;
4849 for (p =
name; *p !=
'\0'; p++) {
4945#define XLAT_REGISTER_ARGS(_xlat, _func, _return_type, _args) \
4947 if (unlikely((xlat = xlat_func_register(xlat_ctx, _xlat, _func, _return_type)) == NULL)) return -1; \
4948 xlat_func_args_set(xlat, _args); \
4949 xlat_func_flags_set(xlat, XLAT_FUNC_FLAG_PURE | XLAT_FUNC_FLAG_INTERNAL); \
4952#define XLAT_NEW(_x) xlat->replaced_with = _x
5001#undef XLAT_REGISTER_ARGS
5002#define XLAT_REGISTER_ARGS(_xlat, _func, _return_type, _args) \
5004 if (unlikely((xlat = xlat_func_register(xlat_ctx, _xlat, _func, _return_type)) == NULL)) return -1; \
5005 xlat_func_args_set(xlat, _args); \
5006 xlat_func_flags_set(xlat, XLAT_FUNC_FLAG_INTERNAL); \
5009#undef XLAT_REGISTER_VOID
5010#define XLAT_REGISTER_VOID(_xlat, _func, _return_type) \
5012 if (unlikely((xlat = xlat_func_register(xlat_ctx, _xlat, _func, _return_type)) == NULL)) return -1; \
5013 xlat_func_flags_set(xlat, XLAT_FUNC_FLAG_INTERNAL); \
5052#ifdef HAVE_REGEX_PCRE2
5057#ifdef HAVE_REGEX_PCRE2
5093#define XLAT_REGISTER_PURE(_xlat, _func, _return_type, _arg) \
5095 if (unlikely((xlat = xlat_func_register(xlat_ctx, _xlat, _func, _return_type)) == NULL)) return -1; \
5096 xlat_func_args_set(xlat, _arg); \
5097 xlat_func_flags_set(xlat, XLAT_FUNC_FLAG_PURE | XLAT_FUNC_FLAG_INTERNAL); \
5126 .func =
xlat_regex_escape, .safe_for = FR_REGEX_SAFE_FOR, .always_escape =
true,
5127 .variadic =
true, .concat =
true },
5144#define XLAT_REGISTER_HASH(_name, _func) do { \
5145 XLAT_REGISTER_PURE("hash." _name, _func, FR_TYPE_OCTETS, xlat_func_sha_arg); \
5146 XLAT_REGISTER_PURE(_name, _func, FR_TYPE_OCTETS, xlat_func_sha_arg); \
5147 XLAT_NEW("hash." _name); \
5152#ifdef HAVE_OPENSSL_EVP_H
5159# ifdef HAVE_EVP_BLAKE2S256
5162# 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)
static uint8_t request[4]
#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.
#define fr_dcursor_list(_cursor)
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.
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_unsafe(UNUSED TALLOC_CTX *ctx, fr_dcursor_t *out, UNUSED xlat_ctx_t const *xctx, UNUSED request_t *request, fr_value_box_list_t *in)
Mark every argument as safe for nothing.
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 ERROR 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_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.
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_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.
bool fr_filename_ok(char const *filename, char const *end, bool allow_dir)
See if a filename is OK.
const fr_sbuff_escape_rules_t fr_filename_escape
const fr_sbuff_escape_rules_t fr_filename_escape_dots
bool fr_filename_allowed_by_list(char const *filename, char const *end, char const *const *array)
See if a filename is allowed by a list.
@ 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.
main_config_limit_t limit
limit files, exec, etc.
bool files_is_set
if we have a limit { files { ... } } section.
char const ** readonly_files
where file....() is limited to for read
char const ** allowed_files
where file....() is limited to for read / write
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.
@ FR_TYPE_ATTR
A contains an attribute reference.
#define fr_type_is_structural(_x)
#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_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.
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_set(fr_value_box_t *box, fr_value_box_safety_t const *safety)
Replace the safety of a box.
ssize_t fr_value_box_list_concat_as_string(fr_value_box_safety_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.
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.
static fr_sbuff_err_t char size_t fr_sbuff_t * in
fr_value_box_safe_for_t safe_for
A unique value to indicate if that value box is safe for consumption by a particular module for a par...
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)
static fr_sbuff_err_t char ** out
#define fr_box_is_variable_size(_x)
static fr_sbuff_err_t char size_t * len
#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)
#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[]
#define XLAT_FILE_ALLOWED(_vb, _p)
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 int filename_xlat_escape(fr_value_box_t *vb, UNUSED void *uctx)
static xlat_arg_parser_t const xlat_func_unsafe_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[]
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[]
fr_test_point_pair_encode_t const * tp_encode
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)
bool xlat_file_allowed(request_t *request, fr_value_box_t const *vb, int oflags)
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[]
int xlat_regex_escape(fr_value_box_t *vb, UNUSED void *uctx)
Escape a value box so that it is safe to use as a regular expression.
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.
#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 xlat_arg_parser_t const xlat_func_pad_args[]
static int xlat_pair_encode_instantiate(xlat_inst_ctx_t const *xctx)
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 xlat_arg_parser_t const xlat_func_concat_args[]
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_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)
static int xlat_pair_decode_instantiate(xlat_inst_ctx_t const *xctx)
#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)
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[]
xlat_pair_decode_uctx_t const * decode_uctx
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.
int xlat_profiling_init(void)
Register the control functions for every profiler that the build compiled in.
@ XLAT_GROUP
encapsulated string of xlats
bool deprecated
this function was deprecated
xlat_type_t _CONST type
type of this expansion.