]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
catch the case of key fields
authorAlan T. DeKok <aland@freeradius.org>
Tue, 11 Nov 2025 18:59:59 +0000 (13:59 -0500)
committerAlan T. DeKok <aland@freeradius.org>
Tue, 11 Nov 2025 19:28:23 +0000 (14:28 -0500)
for

reply.Server-ID.DUID := ::UUID

src/lib/unlang/edit.c

index 4b400b6c4f588af6159d45a0d687b496db91a2a9..3150c0ef51ce04a3e6f2d41a0e74bee62399225f 100644 (file)
@@ -66,6 +66,7 @@ typedef int (*unlang_edit_expand_t)(request_t *request, unlang_frame_state_edit_
 struct edit_map_s {
        fr_edit_list_t          *el;                    //!< edit list
 
+       request_t               *request;
        TALLOC_CTX              *ctx;
        edit_map_t              *parent;
        edit_map_t              *child;
@@ -906,6 +907,18 @@ static fr_pair_t *edit_list_pair_build(fr_pair_t *parent, fr_dcursor_t *cursor,
        fr_pair_t *vp;
        edit_map_t *current = uctx;
 
+       if (!fr_type_is_structural(parent->da->type)) {
+               request_t *request = current->request;
+
+               if (fr_dict_attr_is_key_field(parent->da)) {
+                       REDEBUG("Please use nested edits for structures, not 'dotted' path names");
+               } else {
+                       REDEBUG("Cannot create child of leaf data type");
+               }
+
+               return NULL;
+       }
+
        vp = fr_pair_afrom_da(parent, da);
        if (!vp) return NULL;
 
@@ -1654,6 +1667,7 @@ static void edit_state_init_internal(request_t *request, unlang_frame_state_edit
                state->ours = false;
        }
 
+       current->request = request;
        current->ctx = state;
        current->el = state->el;
        current->map_list = map_list;