]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
allow first member of STRUCT to be variable length
authorAlan T. DeKok <aland@freeradius.org>
Tue, 5 Nov 2019 00:59:44 +0000 (19:59 -0500)
committerAlan T. DeKok <aland@freeradius.org>
Tue, 5 Nov 2019 00:59:44 +0000 (19:59 -0500)
it's stupid, but it's what we need for keyed structures

src/lib/util/dict_validate.c

index e15e08441fec12b27c41c508059219fe1ce370d4..d774acea47a1b58e88ab71c2f7f7f61434a965c4 100644 (file)
@@ -631,17 +631,14 @@ bool dict_attr_flags_valid(fr_dict_t *dict, fr_dict_attr_t const *parent,
 
                if (!attr) break;
 
-               if (*attr == 1) {
-                       /*
-                        *      The first child can't be variable length, that's stupid.
-                        *
-                        *      STRUCTs will have their length filled in later.
-                        */
-                       if ((type != FR_TYPE_STRUCT) && (flags->length == 0)) {
-                               fr_strerror_printf("Children of 'struct' type attributes MUST have fixed length.");
-                               return false;
-                       }
-               } else {
+               /*
+                *      If we have keyed structs, then the first
+                *      member can be variable length.
+                *
+                *      For subsequent children, have each one check
+                *      the previous child.
+                */
+               if (*attr != 1) {
                        int i;
                        fr_dict_attr_t const *sibling;