]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
allow children of UNION to be TLV or leaf.
authorAlan T. DeKok <aland@freeradius.org>
Mon, 27 Oct 2025 13:17:33 +0000 (09:17 -0400)
committerAlan T. DeKok <aland@freeradius.org>
Mon, 27 Oct 2025 15:00:57 +0000 (11:00 -0400)
because the struct encoder can be updated to allow that.

Note that the struct encode / decode has not yet been updated

src/lib/util/dict_validate.c
src/tests/unit/protocols/radius/dictionary.test

index 1017550c53496499be4070bdac5c798caa62bccd..7ae276b25d3e06688df4ee45de13f17c1939d5f7 100644 (file)
@@ -608,7 +608,7 @@ bool dict_attr_flags_valid(fr_dict_attr_t *da)
                break;
 
        case FR_TYPE_UNION:
-               if (da->type != FR_TYPE_STRUCT) {
+               if (!((da->type == FR_TYPE_STRUCT) || (da->type == FR_TYPE_TLV) || fr_type_is_leaf(da->type))) {
                        fr_strerror_printf("Attributes of type '%s' cannot be children of the 'union' type",
                                           fr_type_to_str(type));
                        return false;
index 1839b97b04c4eab5a3f9cc167c784fa5fd29efd6..f53b4e447e750cba806b4ec5c411add9b2c47e69 100644 (file)
@@ -50,6 +50,11 @@ MEMBER               Nested-Uint1                            uint8
 MEMBER         Nested-Uint2                            uint8
 END Test-Struct2.Data
 
+BEGIN Test-Struct2.Data
+ATTRIBUTE      Thingy                                  2       tlv
+ATTRIBUTE      Child                                   .1      string
+END Test-Struct2.Data
+
 ATTRIBUTE      Unit-TLV                                254     tlv
 ATTRIBUTE      Milliseconds                            254.1   date precision=milliseconds
 ATTRIBUTE      Delta-MSec                              254.2   time_delta precision=milliseconds