]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
set internal flags based on attribute number
authorAlan T. DeKok <aland@freeradius.org>
Wed, 24 Mar 2021 15:02:48 +0000 (11:02 -0400)
committerArran Cudbard-Bell <a.cudbardb@freeradius.org>
Wed, 31 Mar 2021 15:10:18 +0000 (16:10 +0100)
not on recommended attribute numbers from 15 years ago

src/lib/util/dict_validate.c

index 4a31f656b736040b6e883a410ebec1dc9294e644..bc698394e55a151bb16358ec93356794245b5b75 100644 (file)
@@ -620,14 +620,13 @@ bool dict_attr_fields_valid(fr_dict_t *dict, fr_dict_attr_t const *parent,
                }
 
                /*
-                *      Auto-set internal flags for raddb/dictionary.
-                *      So that the end user doesn't have to know
-                *      about internal implementation of the server.
+                *      If the attribute is outside of the bounds of
+                *      the type size, then it MUST be an internal
+                *      attribute.  Set the flag in this attribute, so
+                *      that the encoder doesn't have to do complex
+                *      checks.
                 */
-               if ((parent->flags.type_size == 1) &&
-                   (*attr >= 3000) && (*attr < 4000)) {
-                       flags->internal = true;
-               }
+               if (*attr >= (1 << (8 * parent->flags.type_size))) flags->internal = true;
        }
 
        /*