]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
always set our_parent
authorAlan T. DeKok <aland@freeradius.org>
Thu, 15 Dec 2022 14:57:44 +0000 (09:57 -0500)
committerAlan T. DeKok <aland@freeradius.org>
Thu, 15 Dec 2022 14:57:44 +0000 (09:57 -0500)
src/lib/server/tmpl_tokenize.c

index 7cef075db4ef996a5d73b19bc746f111e0ff3aac..4f8180d427c37a8155ef7a90cedbc28fd7a4dab1 100644 (file)
@@ -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