]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
track reference braces.
authorAlan T. DeKok <aland@freeradius.org>
Mon, 25 May 2026 15:24:52 +0000 (11:24 -0400)
committerAlan T. DeKok <aland@freeradius.org>
Mon, 25 May 2026 16:23:37 +0000 (12:23 -0400)
so we can tell the difference between "close the at reference"
and "close the parent section"

src/lib/server/cf_file.c

index 7a832f6de62d91a77c2374bf1c6e3f83e80e8631..76f001b7bb348619e8a59e967733b4774fc34dd9 100644 (file)
@@ -133,6 +133,7 @@ typedef struct {
        CONF_SECTION    *parent;                //!< which started this file
        CONF_SECTION    *current;               //!< sub-section we're reading
        CONF_SECTION    *at_reference;          //!< was this thing an @foo ?
+       int             at_reference_braces;    //!< braces when we found this thing
 
        int             braces;
        bool            from_dir;               //!< this file was read from $include foo/
@@ -2406,7 +2407,7 @@ static int parse_input(cf_stack_t *stack)
                 *      section, before we were parsing the
                 *      @reference.
                 */
-               if (frame->at_reference) {
+               if (frame->at_reference && (frame->braces == frame->at_reference_braces + 1)) {
                        frame->current = frame->parent = frame->at_reference;
                        frame->at_reference = NULL;
 
@@ -2887,6 +2888,7 @@ alloc_section:
                        return -1;
                }
                frame->at_reference = frame->parent;
+               frame->at_reference_braces = frame->braces;
                name2_token = T_BARE_WORD;
 
                css = cf_section_alloc(parent, parent, value, NULL);