From: Alan T. DeKok Date: Tue, 13 Dec 2022 16:08:19 +0000 (-0500) Subject: print full paths in debug mode if we have them X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=ab6eb54d4d4b02d52b6b50b935dca23cd8b5c5d5;p=thirdparty%2Ffreeradius-server.git print full paths in debug mode if we have them so we're printing the tmpl name which created this VP, and not just the name of the VP --- diff --git a/src/lib/unlang/edit.c b/src/lib/unlang/edit.c index 82f09b07489..b1c820de45a 100644 --- a/src/lib/unlang/edit.c +++ b/src/lib/unlang/edit.c @@ -164,45 +164,55 @@ static int tmpl_to_values(TALLOC_CTX *ctx, edit_result_t *out, request_t *reques return -1; } -static void edit_debug_attr_list(request_t *request, fr_pair_list_t const *list); +static void edit_debug_attr_list(request_t *request, fr_pair_list_t const *list, map_t const *map); -static void edit_debug_attr_vp(request_t *request, fr_pair_t *vp, tmpl_t const *vpt) +static void edit_debug_attr_vp(request_t *request, fr_pair_t *vp, map_t const *map) { - switch (vp->da->type) { - case FR_TYPE_STRUCTURAL: - if (vpt) { - RDEBUG2("&%s.%s = {", - fr_table_str_by_value(pair_list_table, tmpl_list(vpt), ""), - vp->da->name); - } else { - RDEBUG2("%s = {", vp->da->name); + fr_assert(vp != NULL); + + if (map) { + switch (vp->da->type) { + case FR_TYPE_STRUCTURAL: + RDEBUG2("%s = {", map->lhs->name); + RINDENT(); + edit_debug_attr_list(request, &vp->vp_group, map_list_head(&map->child)); + REXDENT(); + RDEBUG2("}"); + break; + + default: + RDEBUG2("%s %s %pV", map->lhs->name, fr_tokens[vp->op], &vp->data); + break; } - RINDENT(); - edit_debug_attr_list(request, &vp->vp_group); - REXDENT(); - RDEBUG2("}"); - break; - - default: - if (vpt) { - RDEBUG2("&%s.%s %s %pV", - fr_table_str_by_value(pair_list_table, tmpl_list(vpt), ""), - vp->da->name, fr_tokens[vp->op], - &vp->data); - } else { + } else { + switch (vp->da->type) { + case FR_TYPE_STRUCTURAL: + RDEBUG2("%s = {", vp->da->name); + RINDENT(); + edit_debug_attr_list(request, &vp->vp_group, NULL); + REXDENT(); + RDEBUG2("}"); + break; + + default: RDEBUG2("&%s %s %pV", vp->da->name, fr_tokens[vp->op], &vp->data); + break; } } } -static void edit_debug_attr_list(request_t *request, fr_pair_list_t const *list) +static void edit_debug_attr_list(request_t *request, fr_pair_list_t const *list, map_t const *map) { fr_pair_t *vp; + map_t const *child = NULL; + + if (map) child = map_list_head(&map->child); for (vp = fr_pair_list_next(list, NULL); vp != NULL; vp = fr_pair_list_next(list, vp)) { - edit_debug_attr_vp(request, vp, NULL); + edit_debug_attr_vp(request, vp, child); + if (map) child = map_list_next(&map->child, child); } } @@ -416,7 +426,7 @@ apply_list: RDEBUG2("%s %s {", current->lhs.vpt->name, fr_tokens[map->op]); if (fr_debug_lvl >= L_DBG_LVL_2) { RINDENT(); - edit_debug_attr_list(request, children); + edit_debug_attr_list(request, children, map); REXDENT(); } RDEBUG2("}");