From: Alan T. DeKok Date: Mon, 14 Apr 2025 11:23:30 +0000 (-0400) Subject: allow dict to be NULL when setting the function X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=4edc3ec804e60e02899fb0b42278a1859d3bc76e;p=thirdparty%2Ffreeradius-server.git allow dict to be NULL when setting the function if so, also set needs_resolving. Because an xlat can be parsed from a module configuration, where the dictionary is unknown. Until such time as all of the modules are converted to use call_env, this is likely the best approach. --- diff --git a/src/lib/unlang/xlat_alloc.c b/src/lib/unlang/xlat_alloc.c index 2292d0b824e..fa20c5fee00 100644 --- a/src/lib/unlang/xlat_alloc.c +++ b/src/lib/unlang/xlat_alloc.c @@ -280,6 +280,8 @@ void xlat_exp_set_func(xlat_exp_t *node, xlat_t const *func, fr_dict_t const *di node->call.dict = dict; node->flags = func->flags; node->flags.impure_func = !func->flags.pure; + + if (!dict) node->flags.needs_resolving = true; } void xlat_exp_finalize_func(xlat_exp_t *node) diff --git a/src/lib/unlang/xlat_priv.h b/src/lib/unlang/xlat_priv.h index 6672c51bf8b..82151f59895 100644 --- a/src/lib/unlang/xlat_priv.h +++ b/src/lib/unlang/xlat_priv.h @@ -283,7 +283,7 @@ void xlat_exp_set_name_shallow(xlat_exp_t *node, char const *fmt) CC_HINT(nonnu void xlat_exp_set_name_buffer(xlat_exp_t *node, char const *fmt) CC_HINT(nonnull); void xlat_exp_set_vpt(xlat_exp_t *node, tmpl_t *vpt) CC_HINT(nonnull); -void xlat_exp_set_func(xlat_exp_t *node, xlat_t const *func, fr_dict_t const *dict) CC_HINT(nonnull); +void xlat_exp_set_func(xlat_exp_t *node, xlat_t const *func, fr_dict_t const *dict) CC_HINT(nonnull(1,2)); void xlat_exp_finalize_func(xlat_exp_t *node) CC_HINT(nonnull); /*