]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
ENUMs have values, but no children
authorAlan T. DeKok <aland@freeradius.org>
Sun, 19 Sep 2021 13:40:04 +0000 (09:40 -0400)
committerAlan T. DeKok <aland@freeradius.org>
Mon, 20 Sep 2021 13:01:22 +0000 (09:01 -0400)
and add tests

src/lib/util/dict_fixup.c
src/tests/dict/base.dict

index e7e10001214d5db2967866d744e052d59814184f..ac4865c432cc3735943112ab596bfbae11ab0140 100644 (file)
@@ -493,15 +493,17 @@ static inline CC_HINT(always_inline) int dict_fixup_clone_apply(UNUSED dict_fixu
        /*
         *      Copy children of the DA we're cloning.
         */
-       if (dict_attr_acopy_children(dict, cloned, da) < 0) {
-               fr_strerror_printf("Failed cloning attribute '%s' from children of %s", da->name, fixup->ref);
-               return -1;
-       }
+       if (dict_attr_children(da)) {
+               if (dict_attr_acopy_children(dict, cloned, da) < 0) {
+                       fr_strerror_printf("Failed cloning attribute '%s' from children of %s", da->name, fixup->ref);
+                       return -1;
+               }
 
-       if (dict_attr_child_add(fr_dict_attr_unconst(fixup->parent), cloned) < 0) {
-               fr_strerror_printf("Failed adding cloned attribute %s", da->name);
-               talloc_free(cloned);
-               return -1;
+               if (dict_attr_child_add(fr_dict_attr_unconst(fixup->parent), cloned) < 0) {
+                       fr_strerror_printf("Failed adding cloned attribute %s", da->name);
+                       talloc_free(cloned);
+                       return -1;
+               }
        }
 
        if (dict_attr_add_to_namespace(fixup->parent, cloned) < 0) return -1;
index cdf7796dbe4dd51acfe2a12508f46c1a714aa176..7b4e4fcd7c59a477a080bbb8b9a770314abcae40 100644 (file)
@@ -26,9 +26,18 @@ ATTRIBUTE    Base-TLV                                15      tlv
 
 # Ignore extended and evs
 
-ATTRIBUTE      Base-Integer64                          19      integer64
+#
+#  Define an ENUM
+#
+ENUM base-enum-uint64  uint64
+VALUE base-enum-uint64 one     1
+VALUE base-enum-uint64 two     2
+VALUE base-enum-uint64 three   3
+
+ATTRIBUTE      Base-Integer64                          19      uint64 enum=base-enum-uint64
 ATTRIBUTE      Base-IPv4-Prefix                        20      ipv4prefix
 
 # Ignore VSA, VENDOR, timeval, boolean, combo-ip-prefix, decimal... for now
 
+
 END-PROTOCOL TEST