]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
add tmpl_set_xlat()
authorAlan T. DeKok <aland@freeradius.org>
Fri, 20 Jan 2023 14:35:29 +0000 (09:35 -0500)
committerAlan T. DeKok <aland@freeradius.org>
Fri, 20 Jan 2023 14:36:53 +0000 (09:36 -0500)
for use with edit expressions

src/lib/server/tmpl.h
src/lib/server/tmpl_tokenize.c

index 11c3db373f28a7fa7baf1df61635f256aea6c8f8..b6f254e2d2ea8e20faee9375e1b46b9e1fe2cc12 100644 (file)
@@ -1106,6 +1106,8 @@ void                      tmpl_set_name(tmpl_t *vpt, fr_token_t quote, char const *name, ssize_t le
 
 void                   tmpl_set_dict_def(tmpl_t *vpt, fr_dict_t const *dict) CC_HINT(nonnull);
 
+void                   tmpl_set_xlat(tmpl_t *vpt, xlat_exp_head_t *xlat) CC_HINT(nonnull);
+
 int                    tmpl_afrom_value_box(TALLOC_CTX *ctx, tmpl_t **out, fr_value_box_t *data, bool steal) CC_HINT(nonnull);
 
 void                   tmpl_attr_ref_debug(const tmpl_attr_t *ar, int idx) CC_HINT(nonnull);
index c1234bddafcc6756b94620b475f4c17ff9fb01d5..874b0faa6a59b3a3270c94420ad6aebc621fbc64 100644 (file)
@@ -828,6 +828,19 @@ void tmpl_set_dict_def(tmpl_t *vpt, fr_dict_t const *dict)
        vpt->rules.attr.dict_def = dict;
 }
 
+/** Change the default dictionary in the tmpl's resolution rules
+ *
+ * @param[in] vpt      to alter.
+ * @param[in] xlat     to set.
+ */
+void tmpl_set_xlat(tmpl_t *vpt, xlat_exp_head_t *xlat)
+{
+       fr_assert(vpt->type == TMPL_TYPE_XLAT);
+
+       tmpl_xlat(vpt) = xlat;
+}
+
+
 /** Initialise a tmpl using a format string to create the name
  *
  * @param[in] vpt      to initialise.