]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
correct return codes in dict_attr_allow_dup
authorAlan T. DeKok <aland@freeradius.org>
Tue, 17 Feb 2026 00:06:18 +0000 (19:06 -0500)
committerAlan T. DeKok <aland@freeradius.org>
Tue, 17 Feb 2026 00:25:50 +0000 (19:25 -0500)
share/dictionary/radius/dictionary.rfc8045
src/lib/util/dict_tokenize.c

index fe4d0c6486fb7521522bc34cdaeef7fdd9d31d7f..f7d1b8a56460993025445ef655cc6822daffb38e 100644 (file)
@@ -26,9 +26,6 @@ ATTRIBUTE     Range-End                               .10     uint32
 ATTRIBUTE      Local-Id                                .11     string
 
 ATTRIBUTE      IP-Port-Range                           241.6   tlv clone=.IP-Port-Limit-Info
-ATTRIBUTE      Range-Start                             .9      uint32
-ATTRIBUTE      Range-End                               .10     uint32
-ATTRIBUTE      Local-Id                                .11     string
 
 ATTRIBUTE      IP-Port-Forwarding-Map                  241.7   tlv clone=.IP-Port-Range
 
index 9c4603fc9cb334314029eeb534f0a4511bce0a76..f720ca51b73347a0f4a199111ff2dce2650cbed7 100644 (file)
@@ -1059,15 +1059,23 @@ static int dict_attr_allow_dup(fr_dict_attr_t const *da)
 
        switch (da->type) {
        /*
-        *      For certain STRUCTURAL types, we allow strict duplicates
-        *      as if the user wants to add extra children in the custom
+        *      For certain types, we allow strict duplicates as if
+        *      the user wants to add extra children in the custom
         *      dictionary, or wants to avoid ordering issues between
         *      multiple dictionaries, we need to support this.
         */
        case FR_TYPE_VSA:
        case FR_TYPE_VENDOR:
        case FR_TYPE_TLV:
-               if (fr_dict_attr_cmp_fields(da, found) == 0) return -1;
+               if (fr_dict_attr_cmp_fields(da, found) == 0) return 0;
+               break;
+
+       case FR_TYPE_LEAF:
+               /*
+                *      Leaf types can be duplicated if they are identical.
+                */
+               if ((da->type == found->type) &&
+                   (fr_dict_attr_cmp_fields(da, found) == 0)) return 0;
                break;
 
        default:
@@ -1077,12 +1085,12 @@ static int dict_attr_allow_dup(fr_dict_attr_t const *da)
        if (dup_name) {
                fr_strerror_printf("Duplicate attribute name '%s' in namespace '%s'.  Originally defined %s[%d]",
                                   da->name, da->parent->name, dup_name->filename, dup_name->line);
-               return 0;
+               return -1;
        }
 
        fr_strerror_printf("Duplicate attribute number %u in parent '%s'.  Originally defined %s[%d]",
                                da->attr, da->parent->name, dup_num->filename, dup_num->line);
-       return 0;
+       return -1;
 }
 
 static int dict_struct_finalise(dict_tokenize_ctx_t *dctx)