]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
ensure that type_size and length are set for unknown vendors
authorAlan T. DeKok <aland@freeradius.org>
Wed, 21 Dec 2022 17:46:08 +0000 (12:46 -0500)
committerAlan T. DeKok <aland@freeradius.org>
Wed, 21 Dec 2022 17:49:20 +0000 (12:49 -0500)
that information is used to encode attributes.

src/lib/util/dict_unknown.c
src/tests/unit/protocols/radius/vendor.txt

index 2b00d3bd2352571ce331a9a2308eee034854e6ba..0868bdba49ffa20456f323b78ca41a3aace41a8f 100644 (file)
@@ -180,7 +180,12 @@ static fr_dict_attr_t *dict_unknown_alloc(TALLOC_CTX *ctx, fr_dict_attr_t const
        flags.is_unknown = 1;
        flags.array = 0;
        flags.has_value = 0;
-       flags.length = 0;       /* not fixed length */
+       if (type != FR_TYPE_VENDOR) {
+               flags.length = 0;       /* not fixed length */
+       } else {
+               flags.type_size = da->flags.type_size;
+               flags.length = da->flags.length;
+       }
        flags.extra = 0;
 
        /*
index 3cddcf8bd7f19848369df9ee84ec06e5d5f15cc4..703e75cb921059c7e94a15078ef2b943a5d32aab 100644 (file)
@@ -109,5 +109,32 @@ match 1a 0b 00 00 00 09 01 05 66 6f 6f 1a 0b 00 00 00 09 01 05 62 61 72
 encode-pair Cisco-AVPair = "foo", Cisco-AVPair = "bar"
 match 1a 0b 00 00 00 09 01 05 66 6f 6f 1a 0b 00 00 00 09 01 05 62 61 72
 
+#
+#  Unknown attributes with TLVs
+#
+encode-pair 26.6809.1 = 0xabcdef
+match 1a 0b 00 00 1a 99 01 05 ab cd ef
+
+decode-pair -
+match Vendor-Specific.6809.1 = 0xabcdef
+
+encode-pair 26.6809.1.2 = 0xabcdef
+match 1a 0d 00 00 1a 99 01 07 02 05 ab cd ef
+
+#
+#  @todo - This should be Vendor-Specific.6809.1.2 = 0xabcdef
+#
+decode-pair -
+match Vendor-Specific.6809.1 = 0x0205abcdef
+
+encode-pair 26.6809.1.2.3 = 0xabcdef
+match 1a 0f 00 00 1a 99 01 09 02 07 03 05 ab cd ef
+
+#
+#  @todo - This should be Vendor-Specific.6809.1.2.3 = 0xabcdef
+#
+decode-pair -
+match Vendor-Specific.6809.1 = 0x02070305abcdef
+
 count
-match 52
+match 64