]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
hoist the attr_ref_set() to before calling attr_valid()
authorAlan T. DeKok <aland@freeradius.org>
Wed, 26 Feb 2025 18:30:26 +0000 (13:30 -0500)
committerAlan T. DeKok <aland@freeradius.org>
Wed, 26 Feb 2025 19:40:41 +0000 (14:40 -0500)
so that the validation routine can check the refs

src/lib/util/dict_tokenize.c

index 525bb3bc08cdaa1ba39a4e5d32c0eb44c4daa940..3386e2431f4685e73a99824329d80776a7d77c9d 100644 (file)
@@ -847,24 +847,21 @@ static int dict_attr_add_or_fixup(dict_fixup_ctx_t *fixup, fr_dict_attr_t **da_p
 
                switch (fr_dict_attr_ref_type(ref->type)) {
                case FR_DICT_ATTR_REF_ALIAS:
-                       if (fr_dict_attr_add_initialised(da) < 0) {
-                       error:
-                               talloc_free(da);
-                               *da_p = NULL;
-                               return -1;
-                       }
-
                        /*
                         *      IF the ref exists, we can always add it.  The ref won't be changed later.
                         */
                        if (dict_protocol_reference(&src, da->parent, ref->unresolved) < 0) return -1;
 
-                       if (src) {
-                               if (dict_attr_ref_set(*da_p, src, FR_DICT_ATTR_REF_ALIAS) < 0) return -1;
-                               break;
+                       if (src && (dict_attr_ref_set(*da_p, src, FR_DICT_ATTR_REF_ALIAS) < 0)) return -1;
+
+                       if (fr_dict_attr_add_initialised(da) < 0) {
+                       error:
+                               talloc_free(da);
+                               *da_p = NULL;
+                               return -1;
                        }
 
-                       if (dict_fixup_group_enqueue(fixup, da, ref->unresolved) < 0) return -1;
+                       if (!src && (dict_fixup_group_enqueue(fixup, da, ref->unresolved) < 0)) return -1;
                        ret = 1;
                        break;