]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
allow FR_TYPE_ATTR to have enums (or not)
authorAlan T. DeKok <aland@freeradius.org>
Wed, 19 Nov 2025 21:41:59 +0000 (16:41 -0500)
committerAlan T. DeKok <aland@freeradius.org>
Wed, 19 Nov 2025 21:47:22 +0000 (16:47 -0500)
so that the code works properly in both cases

src/lib/util/dict_tokenize.c
src/lib/util/value.c

index 8e8c6ff61a4a3969a1299c967ce03c60c331b07f..6822a8ed98a65c7b959308949d3b70f592aa0c7c 100644 (file)
@@ -2909,9 +2909,9 @@ static int dict_read_process_value(dict_tokenize_ctx_t *dctx, char **argv, int a
        }
 
        /*
-        *      Pass in the root for type attr, so that we can find the reference.
+        *      Pass in the DA.  The value-box parsing functions will figure out where the enums are found.
         */
-       if (da->type == FR_TYPE_ATTR) enumv = fr_dict_root(da->dict);
+       if (da->type == FR_TYPE_ATTR) enumv = da;
 
        if (fr_value_box_from_str(NULL, &value, da->type, enumv,
                                  argv[2], strlen(argv[2]),
index d53a86933f3027fda0fa7f338b5ffe957b71aa64..db3349e6fa8c48a38d22878147b9b685269566c7 100644 (file)
@@ -5609,10 +5609,10 @@ parse:
                 *      carry a ref to where their values are taken from.
                 */
                if (dst_enumv->type == FR_TYPE_ATTR) {
-                       dst_enumv = fr_dict_root(dst_enumv->dict);
+                       if (!dst_enumv->flags.has_value) dst_enumv = fr_dict_root(dst_enumv->dict);
 
                } else if (!dst_enumv->flags.is_root) {
-                       fr_strerror_printf("Can only start from dictionary root for data type 'attr', and not from %s", dst_enumv->name);
+                       fr_strerror_printf("Can only start from dictionary root for data type 'attribute', and not from %s", dst_enumv->name);
                        return -1;
                }