]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
eval XLAT_TMPL where node is of type data
authorAlan T. DeKok <aland@freeradius.org>
Wed, 9 Feb 2022 17:03:39 +0000 (12:03 -0500)
committerAlan T. DeKok <aland@freeradius.org>
Wed, 9 Feb 2022 17:03:39 +0000 (12:03 -0500)
src/lib/unlang/xlat_eval.c

index ea6008bbc8dd60d68cf42fe7732debc3580e1e94..206b238c661730278991a67ad73c286e55f41796 100644 (file)
@@ -1246,12 +1246,22 @@ xlat_action_t xlat_frame_eval(TALLOC_CTX *ctx, fr_dcursor_t *out, xlat_exp_t con
                        continue;
 
                case XLAT_TMPL:
-                       XLAT_DEBUG("** [%i] %s(attribute) - %%{%s}", unlang_interpret_stack_depth(request), __FUNCTION__,
-                                  node->fmt);
+                       if (tmpl_is_data(node->vpt)) {
+                               XLAT_DEBUG("** [%i] %s(value) - %s", unlang_interpret_stack_depth(request), __FUNCTION__,
+                                          node->vpt->name);
 
-                       xlat_debug_log_expansion(request, node, NULL);
+                               MEM(value = fr_value_box_alloc(ctx, tmpl_value_type(node->vpt), NULL,
+                                                              tmpl_value(node->vpt)->tainted));
 
-                       if (xlat_eval_pair_real(ctx, &result, request, node->vpt) == XLAT_ACTION_FAIL) goto fail;
+                               fr_value_box_copy(value, value, tmpl_value(node->vpt)); /* Also dups taint */
+                               fr_dlist_insert_tail(&result, value);
+                       } else {
+                               XLAT_DEBUG("** [%i] %s(attribute) - %%{%s}", unlang_interpret_stack_depth(request), __FUNCTION__,
+                                          node->fmt);
+                               xlat_debug_log_expansion(request, node, NULL);
+
+                               if (xlat_eval_pair_real(ctx, &result, request, node->vpt) == XLAT_ACTION_FAIL) goto fail;
+                       }
 
                        xlat_debug_log_list_result(request, &result);
                        fr_dlist_move(out->dlist, &result);