Skip to content

Commit

Permalink
handle raw / unknown attributes
Browse files Browse the repository at this point in the history
with a "todo" to discover the actual type
  • Loading branch information
alandekok committed Nov 10, 2024
1 parent 9f85522 commit 30ebfe8
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/lib/util/cbor.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down

0 comments on commit 30ebfe8

Please sign in to comment.