]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
clean up uses of DEFINE
authorAlan T. DeKok <aland@freeradius.org>
Fri, 17 Feb 2023 14:10:58 +0000 (09:10 -0500)
committerAlan T. DeKok <aland@freeradius.org>
Fri, 17 Feb 2023 14:27:07 +0000 (09:27 -0500)
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.

src/lib/util/dict_util.c
src/lib/util/dict_validate.c

index dea61d76533adad92e9a369c8b4f45642e0a326b..a0182fecf19b95ecdec5d163f07a1f46bac9f91c 100644 (file)
@@ -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.
         */
index 9a0ab84b44066936093161dab7d87700c686251d..da8b83a79c376db2f107e0edaa6dba30ef40ae62 100644 (file)
@@ -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) {