]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
allow dict to be NULL when setting the function
authorAlan T. DeKok <aland@freeradius.org>
Mon, 14 Apr 2025 11:23:30 +0000 (07:23 -0400)
committerAlan T. DeKok <aland@freeradius.org>
Mon, 14 Apr 2025 11:31:58 +0000 (07:31 -0400)
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.

src/lib/unlang/xlat_alloc.c
src/lib/unlang/xlat_priv.h

index 2292d0b824e31b3e80fc9056357b99cf1f2e6015..fa20c5fee00fccf54d39bbe8fd0d7bb95ed0fd04 100644 (file)
@@ -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)
index 6672c51bf8b9a4c5bc22219170586ad06600897e..82151f5989555fdb1e35c05e303cae78475c1e49 100644 (file)
@@ -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);
 
 /*