]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
tmpl: Print tmpl information at debug level 3 in unit_test_attribute
authorArran Cudbard-Bell <a.cudbardb@freeradius.org>
Sat, 27 Jun 2020 22:41:48 +0000 (17:41 -0500)
committerArran Cudbard-Bell <a.cudbardb@freeradius.org>
Sat, 27 Jun 2020 22:41:48 +0000 (17:41 -0500)
src/bin/unit_test_attribute.c
src/lib/server/tmpl.c

index 787068515a8bb50b8aad156aec3f0158f36fae00..3b096fed02e6a9bf890a2ea7682a9e031843bbb8 100644 (file)
@@ -1183,6 +1183,13 @@ static size_t command_condition_normalise(command_result_t *result, command_file
                RETURN_OK_WITH_ERROR();
        }
 
+       if (fr_debug_lvl > DEBUG_ENABLED3) {
+               if (cond->type == COND_TYPE_MAP) {
+                       if (cond->data.map->lhs) tmpl_attr_debug(cond->data.map->lhs);
+                       if (cond->data.map->rhs) tmpl_attr_debug(cond->data.map->rhs);
+               }
+       }
+
        in += dec_len;
        if (*in != '\0') {
                fr_strerror_printf("ERROR offset %d 'Too much text'", (int) dec_len);
index c28a5b96a14167b127956fb59f5ab9c821524e74..5b8026ef825fc6a98095562a0da16a322fefb775 100644 (file)
@@ -641,16 +641,29 @@ void tmpl_attr_debug(vp_tmpl_t const *vpt)
        unsigned int            i = 0;
        char                    buffer[sizeof(STRINGIFY(INT16_MAX)) + 1];
 
-       INFO("%s (%p)", vpt->name, vpt);
+       switch (vpt->type) {
+       case TMPL_TYPE_ATTR:
+       case TMPL_TYPE_ATTR_UNPARSED:
+       case TMPL_TYPE_LIST:
+               break;
+
+       default:
+               INFO("%s can't print tmpls of type %s", __FUNCTION__,
+                    fr_table_str_by_value(tmpl_type_table, vpt->type, "<INVALID>"));
+               return;
+       }
+
+       INFO("vp_tmpl_t %s %s (%p)", fr_table_str_by_value(tmpl_type_table, vpt->type, "<INVALID>"), vpt->name, vpt);
        INFO("request references:");
 
        /*
         *      Print all the request references
         */
-       while ((ar = fr_dlist_next(&vpt->data.attribute.rr, rr))) {
+       while ((rr = fr_dlist_next(&vpt->data.attribute.rr, rr))) {
                INFO("\t[%u] %s", i, fr_table_str_by_value(request_ref_table, rr->request, "<INVALID>"));
                i++;
        }
+       i = 0;
 
        INFO("attribute references:");
        /*