]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
handle the case of internal attributes in protocol structures
authorAlan T. DeKok <aland@freeradius.org>
Thu, 4 Dec 2025 15:12:50 +0000 (10:12 -0500)
committerAlan T. DeKok <aland@freeradius.org>
Thu, 4 Dec 2025 15:13:23 +0000 (10:13 -0500)
src/lib/util/pair_print.c

index 5d865d96c4f4d188a1f63d2001188aac8fcdb8f7..443f7f3dfc1390d803d0c590217ad57d0ed35798 100644 (file)
  *
  *     @todo - parent should _never_ be vp->da.
  */
-#define fr_pair_reset_parent(parent) do { \
-       if (parent && (parent->type == FR_TYPE_GROUP)) { \
-               parent = fr_dict_attr_ref(parent); \
-               if (parent->flags.is_root) parent = NULL; \
-       } \
-       if (parent && (parent == vp->da)) parent = NULL; \
+#define fr_pair_reset_parent(parent) do {              \
+       if (!parent) break;                             \
+       fr_assert(parent != vp->da);                    \
+       fr_assert(fr_type_is_structural(parent->type)); \
+       if (parent->type == FR_TYPE_GROUP) {            \
+               parent = fr_dict_attr_ref(parent);      \
+               if (parent->flags.is_root) {            \
+                       parent = NULL;                  \
+                       break;                          \
+               }                                       \
+       }                                               \
+       if (parent->dict != vp->da->dict) parent = NULL; \
   } while (0)
 
 /** Pair serialisation API