]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
if we have local dict, look up next by name, too
authorAlan T. DeKok <aland@freeradius.org>
Sun, 24 Sep 2023 13:49:55 +0000 (09:49 -0400)
committerAlan T. DeKok <aland@freeradius.org>
Sun, 24 Sep 2023 13:49:55 +0000 (09:49 -0400)
src/lib/util/dict_util.c

index b9495db8234f27cce26286d92a524cb4d8bab7b2..193976b9e1fdbad095ec237544e1c5d0b59df7b4 100644 (file)
@@ -2773,7 +2773,6 @@ redo:
                                parent = dict->next->root;
                                goto redo;
                        }
-
                }
 
                if (err) *err = FR_DICT_ATTR_NOTFOUND;
@@ -2801,15 +2800,26 @@ fr_dict_attr_t *dict_attr_by_name(fr_dict_attr_err_t *err, fr_dict_attr_t const
 
        DA_VERIFY(parent);
 
+redo:
        namespace = dict_attr_namespace(parent);
        if (!namespace) {
                fr_strerror_printf("Attribute '%s' does not contain a namespace", parent->name);
                if (err) *err = FR_DICT_ATTR_NO_CHILDREN;
+               fprintf(stderr, "FAIL %d\n", __LINE__);
                return NULL;
        }
 
        da = fr_hash_table_find(namespace, &(fr_dict_attr_t) { .name = name });
        if (!da) {
+               if (parent->flags.is_root) {
+                       fr_dict_t const *dict = fr_dict_by_da(parent);
+
+                       if (dict->next) {
+                               parent = dict->next->root;
+                               goto redo;
+                       }
+               }
+
                if (err) *err = FR_DICT_ATTR_NOTFOUND;
                fr_strerror_printf("Attribute '%s' not found in namespace '%s'", name, parent->name);
                return NULL;