From: Alan T. DeKok Date: Sat, 11 Feb 2023 14:01:12 +0000 (-0500) Subject: fix "can contain" for structs && key fields X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=83a7a977f1cb03b4d5cf1ec3c5b8bcf4fcea82a9;p=thirdparty%2Ffreeradius-server.git fix "can contain" for structs && key fields --- diff --git a/src/lib/util/dict_util.c b/src/lib/util/dict_util.c index 9bf38a836f3..0f26edc58a3 100644 --- a/src/lib/util/dict_util.c +++ b/src/lib/util/dict_util.c @@ -4326,8 +4326,6 @@ bool fr_dict_attr_can_contain(fr_dict_attr_t const *parent, fr_dict_attr_t const /* * Only structural types can have children. - * - * @todo - yes, "key" members of FR_TYPE_STRUCT. */ if (!fr_type_structural[parent->type]) return false; @@ -4356,6 +4354,12 @@ bool fr_dict_attr_can_contain(fr_dict_attr_t const *parent, fr_dict_attr_t const return (ref && (ref->dict == child->dict)); } + /* + * Key fields can have children, but everyone else thinks + * that the struct is the parent. + */ + if ((parent->type == FR_TYPE_STRUCT) && child->parent->parent == parent) return true; + /* * We're in the same protocol dictionary, but the child * isn't directly from the parent. Therefore the only