]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
use dictionary function to compare two attributes
authorAlan T. DeKok <aland@freeradius.org>
Thu, 31 Jul 2025 17:22:02 +0000 (13:22 -0400)
committerAlan T. DeKok <aland@freeradius.org>
Fri, 1 Aug 2025 11:05:54 +0000 (07:05 -0400)
comparing by only the leaf attr was arguably wrong, as it ignored
any depth or parenting.

we use an fr_dict function to do the comparison.  But that just
compares the pointers, and isn't stable.  Arguably that should
be fixed, too.

The fix depends on whether we want to just sort different attributes,
or whether we want to order them.  If we're just sorting them, then
the current code is OK.

src/lib/util/value.c

index 0f0443f7e6298430a84355eed58bff0e37b95e63..8156fc35b247dd220e1b678714219e4cd2ee434a 100644 (file)
@@ -837,7 +837,7 @@ int8_t fr_value_box_cmp(fr_value_box_t const *a, fr_value_box_t const *b)
                return -2;
 
        case FR_TYPE_ATTR:
-               return CMP(a->vb_attr, b->vb_attr);
+               return fr_dict_attr_cmp(a->vb_attr, b->vb_attr);
 
        /*
         *      These should be handled at some point