Alan T. DeKok [Sun, 14 Dec 2025 16:02:24 +0000 (11:02 -0500)]
clean up OSX and DSYMUTIL rules so that they work
for now, we just define "DSYMTUL=touch" on platforms which don't
have it. There isn't enough time right now to fight with GNU make
and inline "if" checks in evaluated rules
Alan T. DeKok [Sun, 14 Dec 2025 13:14:23 +0000 (08:14 -0500)]
disable encoder tests again
they're still showing random failures in CI. It's difficult to
track down the issues when CI stubbornly refuses to show useful
stack traces, and we can't reproduce the issues locally.
Alan T. DeKok [Thu, 11 Dec 2025 01:41:07 +0000 (20:41 -0500)]
Rewrite fr_pair_list_afrom_substr()
and update tests to match.
It now properly handles aliases, groups, etc. The parsing has
been significantly re-worked. All of the old-style strings should
still be allowed, except for ones which had never made sense.
And since aliases, groups, etc. are now handled properly, the
fr_pair_t parenting is also correct. So we can start enabling the
checks on parenting.
Which should help us remove the last vestiges of "flat" attributes
Alan T. DeKok [Wed, 10 Dec 2025 04:14:25 +0000 (23:14 -0500)]
enable encoder in fuzzers
now that we've fixed many (most?) issues with the code, we can
start to automatically test the encoders.
Instead of having a separate fuzzer test for the encoders, we just
use the fuzzer input to decode attributes, and then call the encoder
with the attributes we just found. This should be a reasonable
test of all kinds of odd behavior
Alan T. DeKok [Wed, 10 Dec 2025 19:21:52 +0000 (14:21 -0500)]
manually switch to local / openssl versions of MD4 and MD5.
The fuzzer doesn't call all of the OpenSSL initialization functions,
so if it calls any MD5 routines in RADIUS, it crashes. If we try to
call fr_openssl_fips_mode(), we need to link to libfreeradius-tls,
libfreeradius-server, libfreeradius-unlang, and then call
fr_openssl_init(), which does a ton of other things.
The solution is to manually swap the functions to their local
versions, OR the OpenSSL versions. This is done in fr_openssl_init()
and in fr_openssl_free(). And for good measure, in then also in
fr_openssl_fips_mode().
The previous code could boot with FIPS disabled, set the MD5
pointers, and then at some later point FIPS would be disabled.
The MD5 pointers wouldn't be updated, and bad things could happen.
That case deosn't happen now, because the current code only changes
the FIPs status once at boot. But it's better to fix the APIs to
be more correct.
Alan T. DeKok [Wed, 10 Dec 2025 15:10:32 +0000 (10:10 -0500)]
update fr_pair_verify() with argument to verify the values
so that we can check more often for invalid values. The default
is "true" for the PAIR_VERIFY() and REQUEST_VERIFY() macros.
Update the various parsers to pass "false" if they add a VP to a
list before setting the value. This lets the tests continue to
pass, but also ensures that at normal run-time, we do the full
checks.
Alan T. DeKok [Wed, 10 Dec 2025 14:42:07 +0000 (09:42 -0500)]
string / octets can have length=0 and no pointer
in which case there isn't a need for the actual data. The printing
and encoding routines already ignore the pointer when length=i=0
But we may want to re-visit that decision.
Also add a commented-out assertion that the pointer is NULL when
length==0. This could perhaps be relaxed to check that the pointer
points to a NUL byte (string), or is a zero-length memory region
(octets)
Alan T. DeKok [Tue, 9 Dec 2025 14:27:59 +0000 (09:27 -0500)]
hoist checks for attribute size to next_encodable
so that we don't hit assertions with unknown attributes. The
longer term fix is to allow raw attributes under VSAs, even if
they do break the hierarchy.
Also update the encoder so that when it switches over types, the
"default" case is the error one. This ensures that the functions
only get called with data types that they support.
Alan T. DeKok [Sun, 7 Dec 2025 13:52:05 +0000 (08:52 -0500)]
clean up unknown attributes
print union + child if the child is raw
update the struct encoder/decoder to create raw UNION members
as children of the union, instead of as children of the struct
add and use dict_attr_unknown_init(), which unifies the creation
and checking of unknown attributes. So that we can enforce
common rules and restrictions.
Alan T. DeKok [Sat, 6 Dec 2025 16:26:53 +0000 (11:26 -0500)]
move "set type_size and length" to separate function
and fix its logic so that it's correct for all protocols, and for
the different kinds of VSAs we have in RADIUS.
Previously, if anyone had defined USR VSAs inside of the
Extended-Vendor-Specific-Attribute space, they would have been
encoded in the USR TLV format, and not the standard RADIUS 1/1
format.
While RFC 8044 allows for "vsa" to have any format, it also recommends
that they use the "tlv" format.
RFC 8044 doesn't recommend that the "evs" data type use the "tlv"
format, but it should. If vendors use different formats for
attributes under the "evs" data type, then we will need to extend
the dictionary parser to allow attributes of type 'vendor' to
specify their own data type and length.
Alan T. DeKok [Sat, 6 Dec 2025 15:33:27 +0000 (10:33 -0500)]
enforce correct mapping between protocol name and number
This is necessary because we want to have some protocol-specific
behavior in the core. It doesn't make sense to allow the
administrator to change protocol numbers.
Alan T. DeKok [Wed, 3 Dec 2025 13:46:07 +0000 (08:46 -0500)]
do not allow leaf types to be in the middle of an OID string
specifically, key fields. But the parser actually allowed
anything to be used. The results were accidental, and therefore
wrong.
Update map-xlat-struct input to match. The test actually doesn't
use the input Client-ID, so the value doesn't matter. But the
old input relied on assigning hex values to attributes of type
"group".
And when updated to use UUID inputs, the resulting output created
attributes with incorrect parentage. The issue seems to be the
DHCPv6 protocol decoder (or more likely the struct decoder). But
for now, we avoid the problem and move on.
which is wrong. This output shows that the UUID pair is being
created as a child of Client-ID. Instead, there should be an
intermediate Value created, and then the UUID should be a child
of that.