]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
Verify the relationship between the pair to encode and the root ctx
authorNick Porter <nick@portercomputing.co.uk>
Wed, 15 Oct 2025 18:51:31 +0000 (19:51 +0100)
committerNick Porter <nick@portercomputing.co.uk>
Thu, 16 Oct 2025 17:26:41 +0000 (18:26 +0100)
src/lib/unlang/xlat_builtin.c

index 0df32d75bca513366acb333c04696e29ac1f5bfd..b7a02053040fafd8351f25ae36a89ac68a96efdd 100644 (file)
@@ -4200,6 +4200,18 @@ static xlat_action_t protocol_encode_xlat(TALLOC_CTX *ctx, fr_dcursor_t *out,
                }
        }
 
+       if (root_da) {
+               if (!fr_type_is_structural(root_da->vb_attr->type)) {
+                       REDEBUG2("Encoding context must be a structural attribute reference");
+                       return XLAT_ACTION_FAIL;
+               }
+               vp = fr_dcursor_current(cursor);
+               if (!fr_dict_attr_common_parent(root_da->vb_attr, vp->da, true) && (root_da->vb_attr != vp->da)) {
+                       REDEBUG2("%s is not a child of %s", vp->da->name, root_da->vb_attr->name);
+                       return XLAT_ACTION_FAIL;
+               }
+       }
+
        /*
         *      Loop over the attributes, encoding them.
         */