]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
handle raw / unknown attributes
authorAlan T. DeKok <aland@freeradius.org>
Sun, 10 Nov 2024 15:30:38 +0000 (10:30 -0500)
committerAlan T. DeKok <aland@freeradius.org>
Mon, 11 Nov 2024 00:19:05 +0000 (19:19 -0500)
with a "todo" to discover the actual type

src/lib/util/cbor.c

index 91ea0897d17f0153036b25fb7a02d677ecbeeb92..9d126e4b9b4baf6bd218877ceece334e6fbaf9c1 100644 (file)
@@ -1175,11 +1175,19 @@ ssize_t fr_cbor_decode_pair(TALLOC_CTX *ctx, fr_pair_list_t *out, fr_dbuff_t *db
 
        da = fr_dict_attr_child_by_num(parent, value);
        if (!da) {
-               fr_assert(0);   /* @todo - yup! */
+               /*
+                *      @todo - the value here isn't a cbor octets type, but is instead cbor data.  Since cbor
+                *      is typed, we _could_ perhaps instead discover the type from the cbor data, and then
+                *      use that instead.  This would involve creating a function which maps cbor types to our
+                *      data types.
+                */
+               da = fr_dict_attr_unknown_raw_afrom_num(ctx, parent, value);
+               if (!da) goto oom;
        }
 
        vp = fr_pair_afrom_da(ctx, da);
        if (!vp) {
+       oom:
                fr_strerror_const("Out of memory");
                return -fr_dbuff_used(&work_dbuff);
        }