]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
set name / debug_name
authorAlan T. DeKok <aland@freeradius.org>
Thu, 10 Oct 2019 17:01:36 +0000 (13:01 -0400)
committerAlan T. DeKok <aland@freeradius.org>
Thu, 10 Oct 2019 17:01:36 +0000 (13:01 -0400)
src/lib/unlang/compile.c

index ef1351f0227827aaa539896f45b784956ff2d925..865ae8e6e842032227033dd1ce8dd29aad10aaac 100644 (file)
@@ -2107,9 +2107,10 @@ static unlang_t *compile_switch(unlang_t *parent, unlang_compile_t *unlang_ctx,
 {
        CONF_ITEM *ci;
        FR_TOKEN type;
-       char const *name2;
+       char const *name1, *name2;
        bool had_seen_default = false;
        unlang_group_t *g;
+       unlang_t *c;
        ssize_t slen;
 
        vp_tmpl_rules_t parse_rules;
@@ -2136,6 +2137,9 @@ static unlang_t *compile_switch(unlang_t *parent, unlang_compile_t *unlang_ctx,
        /*
         *      Create the template.  All attributes and xlats are
         *      defined by now.
+        *
+        *      The 'case' statements need g->vpt filled out to ensure
+        *      that the data types match.
         */
        type = cf_section_name2_quote(cs);
        slen = tmpl_afrom_str(g, &g->vpt, name2, strlen(name2), type, &parse_rules, true);
@@ -2163,7 +2167,6 @@ static unlang_t *compile_switch(unlang_t *parent, unlang_compile_t *unlang_ctx,
             ci != NULL;
             ci = cf_item_next(cs, ci)) {
                CONF_SECTION *subcs;
-               char const *name1;
 
                if (!cf_item_is_section(ci)) {
                        if (!cf_item_is_pair(ci)) continue;
@@ -2195,6 +2198,10 @@ static unlang_t *compile_switch(unlang_t *parent, unlang_compile_t *unlang_ctx,
                }
        }
 
+       c = unlang_group_to_generic(g);
+       c->name = "switch";
+       c->debug_name = talloc_typed_asprintf(c, "switch %s", cf_section_name2(cs));
+
        /*
         *      Fixup the template before compiling the children.
         *      This is so that compile_case() can do attribute type
@@ -3013,6 +3020,9 @@ static unlang_t *compile_subrequest(unlang_t *parent, unlang_compile_t *unlang_c
        c = compile_children(g, parent, &unlang_ctx2);
        if (!c) return NULL;
 
+       c->name = "subrequest";
+       c->debug_name = talloc_typed_asprintf(c, "subrequest %s", cf_section_name2(cs));
+
        g->dict = dict;
        g->attr_packet_type = da;
        g->type_enum = type_enum;