From: Alan T. DeKok Date: Thu, 15 Dec 2022 14:57:44 +0000 (-0500) Subject: always set our_parent X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=524fc99c0e042beb0c197f43735f6c7424a0b64a;p=thirdparty%2Ffreeradius-server.git always set our_parent --- diff --git a/src/lib/server/tmpl_tokenize.c b/src/lib/server/tmpl_tokenize.c index 7cef075db4e..4f8180d427c 100644 --- a/src/lib/server/tmpl_tokenize.c +++ b/src/lib/server/tmpl_tokenize.c @@ -1600,8 +1600,14 @@ static inline int tmpl_attr_afrom_attr_substr(TALLOC_CTX *ctx, tmpl_attr_error_t * attribute will be resolved in, so the * only way of recording what the parent * is by looking at the da. + * + * Else no da reference, the parent is the namespace. */ - if (da) our_parent = da->parent; + if (da) { + our_parent = da->parent; + } else { + our_parent = namespace; + } /* * Otherwise we're resolving in the context of the last component, * or its reference in the case of group attributes. @@ -1639,7 +1645,7 @@ static inline int tmpl_attr_afrom_attr_substr(TALLOC_CTX *ctx, tmpl_attr_error_t */ switch (dict_err) { case FR_DICT_ATTR_NO_CHILDREN: - if (our_parent && our_parent->flags.is_unknown) break; + if (our_parent->flags.is_unknown) break; goto error; case FR_DICT_ATTR_NOT_DESCENDENT: @@ -1652,8 +1658,6 @@ static inline int tmpl_attr_afrom_attr_substr(TALLOC_CTX *ctx, tmpl_attr_error_t * reference. */ if (da) { - fr_assert(our_parent != NULL); - MEM(ar = talloc(ctx, tmpl_attr_t)); *ar = (tmpl_attr_t){ .ar_num = NUM_UNSPEC, @@ -1688,8 +1692,6 @@ static inline int tmpl_attr_afrom_attr_substr(TALLOC_CTX *ctx, tmpl_attr_error_t goto error; } - fr_assert(our_parent != NULL); - /* * See if the ref begins with an unsigned integer * if it does it's probably an OID component