]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
add tmpl_dump
authorAlan T. DeKok <aland@freeradius.org>
Thu, 10 Jul 2025 16:18:30 +0000 (12:18 -0400)
committerAlan T. DeKok <aland@freeradius.org>
Thu, 10 Jul 2025 19:21:17 +0000 (15:21 -0400)
src/lib/unlang/tmpl.c
src/lib/unlang/tmpl_priv.h

index b47d104d16cbe19bdbaffb934bd4c4ff629841a4..0325958cd4f1d35fc7521ad3270c7e928e28905d 100644 (file)
@@ -326,6 +326,7 @@ int unlang_tmpl_push(TALLOC_CTX *ctx, fr_value_box_list_t *out, request_t *reque
        repeatable_set(frame);
 
        *state = (unlang_frame_state_tmpl_t) {
+               .vpt = tmpl,
                .out = out,
                .ctx = ctx,
        };
@@ -342,6 +343,18 @@ int unlang_tmpl_push(TALLOC_CTX *ctx, fr_value_box_list_t *out, request_t *reque
        return 0;
 }
 
+static void unlang_tmpl_dump(request_t *request, unlang_stack_frame_t *frame)
+{
+       unlang_frame_state_tmpl_t       *state = talloc_get_type_abort(frame->state, unlang_frame_state_tmpl_t);
+
+       if (state->vpt) {
+               RDEBUG("tmpl           %s", state->vpt->name);
+       } else {
+               unlang_tmpl_t *ut = unlang_generic_to_tmpl(frame->instruction);
+               RDEBUG("tmpl           %s", ut->tmpl->name);
+       }
+}
+
 void unlang_tmpl_init(void)
 {
        unlang_register(&(unlang_op_t){
@@ -351,6 +364,7 @@ void unlang_tmpl_init(void)
 
                        .interpret = unlang_tmpl,
                        .signal = unlang_tmpl_signal,
+                       .dump = unlang_tmpl_dump,
 
                        .unlang_size = sizeof(unlang_tmpl_t),
                        .unlang_name = "unlang_tmpl_t",
index 90900e875a2b329716839d1e32021375f85a60e0..940de95182144a37694e592f3ae396ea937ab830 100644 (file)
@@ -36,6 +36,7 @@ extern "C" {
  */
 typedef struct {
        TALLOC_CTX                      *ctx;           //!< for allocating value boxes
+       tmpl_t const                    *vpt;           //!< the thing being expanded
        fr_value_box_list_t             *out;           //!< output list if the exec succeeds
        fr_value_box_list_t             list;           //!< our intermediate working list