]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
we need to set our_parent=NULL when switching namespace
authorAlan T. DeKok <aland@freeradius.org>
Sat, 18 Mar 2023 19:15:36 +0000 (15:15 -0400)
committerAlan T. DeKok <aland@freeradius.org>
Sat, 18 Mar 2023 19:15:36 +0000 (15:15 -0400)
src/lib/server/tmpl_tokenize.c

index 47b9f7176b0ac2ba12b5cc2411e38e3af81fa21f..d185187d5c5c54f802bab764f6f00aedd7f7ac88 100644 (file)
@@ -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: