From: Alan T. DeKok Date: Fri, 17 Feb 2023 14:10:58 +0000 (-0500) Subject: clean up uses of DEFINE X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=84928bdeebab442f65441e084d377235765a395f;p=thirdparty%2Ffreeradius-server.git clean up uses of DEFINE don't add DEFINEs to "child by num" array, as no one should ever know about the numbers. Don't set the "internal" flag for string-based attributes. --- diff --git a/src/lib/util/dict_util.c b/src/lib/util/dict_util.c index dea61d76533..a0182fecf19 100644 --- a/src/lib/util/dict_util.c +++ b/src/lib/util/dict_util.c @@ -1076,6 +1076,12 @@ int dict_attr_child_add(fr_dict_attr_t *parent, fr_dict_attr_t *child) return -1; } + /* + * The parent has children by name only, not by number. Don't even bother trying to track + * numbers. + */ + if (parent->flags.name_only) return 0; + /* * We only allocate the pointer array *if* the parent has children. */ diff --git a/src/lib/util/dict_validate.c b/src/lib/util/dict_validate.c index 9a0ab84b440..da8b83a79c3 100644 --- a/src/lib/util/dict_validate.c +++ b/src/lib/util/dict_validate.c @@ -654,8 +654,12 @@ bool dict_attr_fields_valid(fr_dict_t *dict, fr_dict_attr_t const *parent, * is. */ if (*attr == -1) { - - flags->internal = 1; + /* + * If we don't care about the number, then this attribute is almost always + * an internal one. Unless it's a "name only" attribute for string-based + * protocols. + */ + flags->internal |= !flags->name_only; v = fr_dict_attr_by_name(NULL, fr_dict_root(dict), name); if (v) {