]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
set the default type size for a dictionary
authorAlan T. DeKok <aland@freeradius.org>
Sat, 6 Dec 2025 16:24:30 +0000 (11:24 -0500)
committerAlan T. DeKok <aland@freeradius.org>
Sat, 6 Dec 2025 16:45:44 +0000 (11:45 -0500)
from the protocol library which we loaded.

src/lib/util/dict_tokenize.c
src/lib/util/dict_util.c

index 7d81e8b050291e7edaa9a3d630f70f69a748d28d..66dd49b1e6e21c51e1ad6d1c507d2fc3afa0ff3a 100644 (file)
@@ -317,8 +317,8 @@ static int dict_root_set(fr_dict_t *dict, char const *name, unsigned int proto_n
 
        fr_dict_attr_flags_t flags = {
                .is_root = 1,
-               .type_size = 1,
-               .length = 1
+               .type_size = dict->proto->default_type_size,
+               .length = dict->proto->default_type_length,
        };
 
        if (!fr_cond_assert(!dict->root)) {
@@ -2836,7 +2836,6 @@ static int dict_read_process_protocol(dict_tokenize_ctx_t *dctx, char **argv, in
        unsigned int    value;
        unsigned int    type_size = 0;
        fr_dict_t       *dict;
-       fr_dict_attr_t  *mutable;
        unsigned int    required_value;
        char const      *required_name;
        bool            require_dl = false;
@@ -2995,12 +2994,11 @@ post_option:
 
        if (dict_protocol_add(dict) < 0) goto error;
 
-       mutable = UNCONST(fr_dict_attr_t *, dict->root);
        dict->string_based = string_based;
-       if (!type_size) {
-               mutable->flags.type_size = dict->proto->default_type_size;
-               mutable->flags.length = dict->proto->default_type_length;
-       } else {
+       if (type_size) {
+               fr_dict_attr_t  *mutable;
+
+               mutable = UNCONST(fr_dict_attr_t *, dict->root);
                mutable->flags.type_size = type_size;
                mutable->flags.length = 1; /* who knows... */
        }
index 791274a7b10909eeb03d0d5ac29e8fb48f462695..8778e758aeeaced4902a14f4b6e9af9b070d4850 100644 (file)
@@ -4281,8 +4281,8 @@ fr_dict_t *fr_dict_protocol_alloc(fr_dict_t const *parent)
                .is_root = true,
                .local = true,
                .internal = true,
-               .type_size = 2,
-               .length = 2
+               .type_size = parent->root->flags.type_size,
+               .length = parent->root->flags.length,
        };
 
        dict = dict_alloc(UNCONST(fr_dict_t *, parent));