From: Alan T. DeKok Date: Sat, 18 Mar 2023 19:15:36 +0000 (-0400) Subject: we need to set our_parent=NULL when switching namespace X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=4923de91e1bc82168825933e79fdffef024f5bb2;p=thirdparty%2Ffreeradius-server.git we need to set our_parent=NULL when switching namespace --- diff --git a/src/lib/server/tmpl_tokenize.c b/src/lib/server/tmpl_tokenize.c index 47b9f7176b0..d185187d5c5 100644 --- a/src/lib/server/tmpl_tokenize.c +++ b/src/lib/server/tmpl_tokenize.c @@ -1570,7 +1570,7 @@ static inline int tmpl_attr_afrom_attr_substr(TALLOC_CTX *ctx, tmpl_attr_error_t } /* - * No parent means we need to go hunting through all the dictionaries + * No parent means we use the default dictionary. */ if (!our_parent) { (void)fr_dict_attr_search_by_qualified_name_substr(&dict_err, &da, @@ -1596,6 +1596,8 @@ static inline int tmpl_attr_afrom_attr_substr(TALLOC_CTX *ctx, tmpl_attr_error_t * or its reference in the case of group attributes. */ } else { + fr_assert(namespace != NULL); + (void)fr_dict_attr_by_name_substr(&dict_err, &da, namespace, @@ -1679,6 +1681,9 @@ static inline int tmpl_attr_afrom_attr_substr(TALLOC_CTX *ctx, tmpl_attr_error_t goto error; } + fr_assert(our_parent != NULL); + fr_assert(namespace != NULL); + /* * See if the ref begins with an unsigned integer * if it does it's probably an OID component @@ -1873,13 +1878,15 @@ do_suffix: * attribute of type "group". */ if (ref != fr_dict_root(fr_dict_internal())) { - our_parent = namespace = ref; + namespace = ref; - } else { - fr_assert(at_rules->dict_def); + } else if (at_rules->dict_def) { + namespace = fr_dict_root(at_rules->dict_def); - our_parent = namespace = fr_dict_root(at_rules->dict_def); + } else { + namespace = NULL; } + our_parent = NULL; break; case FR_TYPE_STRUCT: