36RCSID(
"$Id: 0ca005614a9b26954ddc1030856b909a59df7af6 $")
38#include <freeradius-devel/build.h>
39#include <freeradius-devel/util/atexit.h>
40#include <freeradius-devel/util/dict.h>
41#include <freeradius-devel/util/dl.h>
42#include <freeradius-devel/util/lsan.h>
43#include <freeradius-devel/util/sbuff.h>
44#include <freeradius-devel/util/strerror.h>
45#include <freeradius-devel/util/syserror.h>
46#include <freeradius-devel/util/talloc.h>
47#include <freeradius-devel/util/types.h>
48#include <freeradius-devel/util/value.h>
49#include <freeradius-devel/server/base.h>
50#include <freeradius-devel/server/request.h>
51#include <freeradius-devel/server/tmpl.h>
52#include <freeradius-devel/unlang/base.h>
53#include <freeradius-devel/unlang/xlat.h>
63 char const *dict_dir = NULL;
64 char const *lib_dir = NULL;
65 char *dict_buf = NULL, *lib_buf = NULL;
69 if (!argc || !argv || !*argv)
return -1;
82 dict_dir = getenv(
"FR_DICTIONARY_DIR");
83 lib_dir = getenv(
"FR_LIBRARY_PATH");
85 p = strrchr((*argv)[0],
'/');
89 (
int)(p - (*argv)[0]), (*argv)[0]);
90 if (!dict_buf)
goto error;
95 (
int)(p - (*argv)[0]), (*argv)[0]);
96 if (!lib_buf)
goto error;
103 if (dict_dir) (void) setenv(
"FR_DICTIONARY_DIR", dict_dir, 1);
132#define POISON_START 64
148 if (size < 2)
return 0;
149 if (size > 4096)
return 0;
151 mode =
data[0] & 0x03;
165 if (!raw_fmt)
goto done;
167 if (fmt_len) memcpy(
fmt,
data + 1, fmt_len);
181 .allow_unresolved =
false,
182 .allow_unknown =
false,
183 .allow_wildcard =
true,
221 .allow_unresolved =
false,
241 char print_buf[1024];
static int const char * fmt
int fr_atexit_global_setup(void)
Setup the atexit handler, should be called at the start of a program's execution.
void fr_talloc_fault_setup(void)
Register talloc fault handlers.
int fr_dict_internal_afrom_file(fr_dict_t **out, char const *dict_subdir, char const *dependent))
(Re-)Initialize the special internal dictionary
fr_dict_gctx_t * fr_dict_global_ctx_init(TALLOC_CTX *ctx, bool free_at_exit, char const *dict_dir))
Initialise the global protocol hashes.
int dl_search_global_path_set(char const *lib_dir)
Set the global library path.
static fr_dict_t * dict_internal
int LLVMFuzzerInitialize(int *argc, char ***argv)
int LLVMFuzzerTestOneInput(const uint8_t *buf, size_t len)
int unlang_global_init(void)
#define ASAN_POISON_MEMORY_REGION(_start, _size)
#define ASAN_UNPOISON_MEMORY_REGION(_start, _size)
fr_dict_attr_t const * request_attr_request
int request_global_init(void)
#define FR_SBUFF_IN(_start, _len_or_end)
#define FR_SBUFF_OUT(_start, _len_or_end)
fr_dict_t const * dict_def
Alternative default dictionary to use if vpt->rules->dict_def is NULL.
tmpl_attr_rules_t attr
Rules/data for parsing attribute references.
struct tmpl_res_rules_s tmpl_res_rules_t
struct tmpl_rules_s tmpl_rules_t
struct tmpl_attr_rules_s tmpl_attr_rules_t
Optional arguments passed to vp_tmpl functions.
fr_dict_t const * dict_def
Default dictionary to use with unqualified attribute references.
static TALLOC_CTX * talloc_init_const(char const *name)
Allocate a top level chunk with a constant name.
tmpl_res_rules_t const * tr_rules
tmpl resolution rules.
fr_slen_t xlat_tokenize_condition(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))
fr_slen_t xlat_print(fr_sbuff_t *in, xlat_exp_head_t const *node, fr_sbuff_escape_rules_t const *e_rules)
Reconstitute an xlat expression from its constituent nodes.
fr_slen_t xlat_tokenize(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)
Tokenize an xlat expansion.
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.
fr_slen_t xlat_tokenize_argv(TALLOC_CTX *ctx, xlat_exp_head_t **head, fr_sbuff_t *in, xlat_arg_parser_t const *xlat_args, fr_sbuff_parse_rules_t const *p_rules, tmpl_rules_t const *t_rules, bool spaces))
Tokenize an xlat expansion into a series of XLAT_TYPE_CHILD arguments.
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))
#define FR_DICTIONARY_INTERNAL_DIR
void fr_perror(char const *fmt,...)
Print the current error to stderr with a prefix.
void fr_strerror_clear(void)
Clears all pending messages from the talloc pools.
#define fr_strerror_const(_msg)
int fr_check_lib_magic(uint64_t magic)
Check if the application linking to the library has the correct magic number.
#define RADIUSD_MAGIC_NUMBER