From: Alan T. DeKok Date: Thu, 12 Aug 2021 14:42:08 +0000 (-0400) Subject: remove requirements that "clone" be used only for struct/tlv X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=ccd43ae35fa9472651530d905d7d33e71dbb0fa8;p=thirdparty%2Ffreeradius-server.git remove requirements that "clone" be used only for struct/tlv because when we clone structs/TLVs, we clone attributes of many types. So we might as well allow it here, too --- diff --git a/src/lib/util/dict_tokenize.c b/src/lib/util/dict_tokenize.c index 228b486cd19..743078b1bd4 100644 --- a/src/lib/util/dict_tokenize.c +++ b/src/lib/util/dict_tokenize.c @@ -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, "")); - 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) { diff --git a/src/lib/util/dict_util.c b/src/lib/util/dict_util.c index 4b8e985d8f3..df294872fb2 100644 --- a/src/lib/util/dict_util.c +++ b/src/lib/util/dict_util.c @@ -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, "")); - 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));