]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
remove requirements that "clone" be used only for struct/tlv
authorAlan T. DeKok <aland@freeradius.org>
Thu, 12 Aug 2021 14:42:08 +0000 (10:42 -0400)
committerAlan T. DeKok <aland@freeradius.org>
Thu, 12 Aug 2021 14:42:08 +0000 (10:42 -0400)
because when we clone structs/TLVs, we clone attributes of many
types.  So we might as well allow it here, too

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

index 228b486cd195679152ad3e4d95f7a314cfa64066..743078b1bd420682b912179be17f216f3434fe60 100644 (file)
@@ -463,13 +463,10 @@ static int dict_process_flag_field(dict_tokenize_ctx_t *ctx, char *name, fr_type
                                return -1;
                        }
 
-                       if ((type != FR_TYPE_TLV) && (type != FR_TYPE_STRUCT) &&
-                           !(flags->extra && (flags->subtype == FLAG_KEY_FIELD))) {
-                               fr_strerror_printf("The 'clone' flag cannot be used for type '%s'",
-                                                  fr_table_str_by_value(fr_value_box_type_table, type, "<UNKNOWN>"));
-                               return -1;
-                       }
-
+                       /*
+                        *      Allow cloning of any types, so long as
+                        *      the types are the same.  We do the checks later.
+                        */
                        *ref = talloc_strdup(ctx->fixup.pool, value);
 
                } else if (ctx->dict->subtype_table) {
index 4b8e985d8f3b1c601f22442475e5737f6a4e783d..df294872fb20e64fed7c99020f35bdcc6ba137e5 100644 (file)
@@ -719,12 +719,6 @@ int dict_attr_acopy_children(fr_dict_t *dict, fr_dict_attr_t *dst, fr_dict_attr_
        fr_dict_attr_t const *child = NULL;
        fr_dict_attr_t *copy;
 
-       if ((dst->type != FR_TYPE_TLV) && (dst->type != FR_TYPE_STRUCT) && !fr_dict_attr_is_key_field(src)) {
-               fr_strerror_printf_push("Invalid destination type %s",
-                                       fr_table_str_by_value(fr_value_box_type_table, dst->type, "<UNKNOWN>"));
-               return -1;
-       }
-
        fr_assert(fr_dict_attr_has_ext(dst, FR_DICT_ATTR_EXT_CHILDREN));
        fr_assert(dst->type == src->type);
        fr_assert(fr_dict_attr_is_key_field(src) == fr_dict_attr_is_key_field(dst));