]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
print out partial names if we have a parent
authorAlan T. DeKok <aland@freeradius.org>
Fri, 9 Apr 2021 11:25:35 +0000 (07:25 -0400)
committerAlan T. DeKok <aland@freeradius.org>
Fri, 9 Apr 2021 11:25:35 +0000 (07:25 -0400)
this is so that the code handles flat and nested names.
Once all of the decoders are converted to using nested names,
AND the unlang interpreter forbids the creation of flat names,
these functions should be updated to just print vp->da->name

src/lib/server/log.c

index 97d9395dfa8eafab8be1d9c12478501e07f5aa56..412243d6c122ab63f203388851a8348c702c9698 100644 (file)
@@ -775,27 +775,28 @@ void log_request_pair_list(fr_log_lvl_t lvl, request_t *request,
        for (vp = fr_pair_list_head(m_vp);
             vp;
             vp = fr_pair_list_next(m_vp, vp)) {
+               fr_sbuff_t *oid_buff = log_request_oid_buff();
+
                VP_VERIFY(vp);
 
+               if (parent && (parent->da->type != FR_TYPE_GROUP)) parent_da = parent->da;
+               if (fr_dict_attr_oid_print(oid_buff, parent_da, vp->da) <= 0) return;
+
                /*
                 *      Recursively print grouped attributes.
                 */
                switch (vp->da->type) {
                case FR_TYPE_STRUCTURAL:
-               {
-                       fr_sbuff_t *oid_buff = log_request_oid_buff();
-
-                       if (parent && (parent->da->type != FR_TYPE_GROUP)) parent_da = parent->da;
-                       if (fr_dict_attr_oid_print(oid_buff, parent_da, vp->da) <= 0) return;
-
                        RDEBUGX(lvl, "%s%pV {", prefix ? prefix : "",
                                fr_box_strvalue_len(fr_sbuff_start(oid_buff), fr_sbuff_used(oid_buff)));
                        log_request_pair_list(lvl, request, vp, &vp->vp_group, prefix);
                        RDEBUGX(lvl, "%s}", prefix ? prefix : "");      /* don't add extra space between closing brace and prefix */
                        continue;
-               }
+
                default:
-                       RDEBUGX(lvl, "%s%pP", prefix ? prefix : "", vp);
+                       RDEBUGX(lvl, "%s%pV = %pV", prefix ? prefix : "",
+                               fr_box_strvalue_len(fr_sbuff_start(oid_buff), fr_sbuff_used(oid_buff)),
+                               &vp->data);
                        break;
                }
        }
@@ -824,30 +825,30 @@ void log_request_proto_pair_list(fr_log_lvl_t lvl, request_t *request,
        for (vp = fr_pair_list_head(vps);
             vp;
             vp = fr_pair_list_next(vps, vp)) {
+               fr_sbuff_t *oid_buff = log_request_oid_buff();
+
                VP_VERIFY(vp);
 
                if (!fr_dict_attr_common_parent(fr_dict_root(request->dict), vp->da, true)) continue;
 
+               if (parent && (parent->da->type != FR_TYPE_GROUP)) parent_da = parent->da;
+               if (fr_dict_attr_oid_print(oid_buff, parent_da, vp->da) <= 0) return;
+
                /*
                 *      Recursively print grouped attributes.
                 */
                switch (vp->da->type) {
                case FR_TYPE_STRUCTURAL:
-               {
-                       fr_sbuff_t *oid_buff = log_request_oid_buff();
-
-                       if (parent && (parent->da->type != FR_TYPE_GROUP)) parent_da = parent->da;
-                       if (fr_dict_attr_oid_print(oid_buff, parent_da, vp->da) <= 0) return;
-
                        RDEBUGX(lvl, "%s%pV {", prefix ? prefix : "",
                                fr_box_strvalue_len(fr_sbuff_start(oid_buff), fr_sbuff_used(oid_buff)));
                        log_request_proto_pair_list(lvl, request, vp, &vp->vp_group, prefix);
                        RDEBUGX(lvl, "%s}", prefix ? prefix : "");
                        continue;
-               }
 
                default:
-                       RDEBUGX(lvl, "%s%pP", prefix ? prefix : "", vp);
+                       RDEBUGX(lvl, "%s%pV = %pV", prefix ? prefix : "",
+                               fr_box_strvalue_len(fr_sbuff_start(oid_buff), fr_sbuff_used(oid_buff)),
+                               &vp->data);
                        break;
                }
        }