]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
don't allow "foo.bar = baz" to become a subsection in attr definition
authorAlan T. DeKok <aland@freeradius.org>
Fri, 5 Aug 2022 13:11:52 +0000 (09:11 -0400)
committerAlan T. DeKok <aland@freeradius.org>
Fri, 5 Aug 2022 14:19:20 +0000 (10:19 -0400)
src/lib/server/cf_file.c
src/lib/server/cf_priv.h
src/lib/server/cf_util.c

index b1c159d9a5dae0369b349983765aa38d6c9bc3c0..4110f67e5ddb91ef9ba1a3013ae7ad212f3bee89 100644 (file)
@@ -1827,7 +1827,7 @@ static int add_pair(CONF_SECTION *parent, char const *attr, char const *value,
         *      with '&' (or %), so we don't pick up attribute
         *      references.
         */
-       if ((*attr >= 'A') && (name1_token == T_BARE_WORD) && value) {
+       if ((*attr >= 'A') && (name1_token == T_BARE_WORD) && value && !parent->attr) {
                char const *p = strchr(attr, '.');
 
                if (p && (add_section_pair(&parent, &attr, p, buff, talloc_array_length(buff), filename, lineno) < 0)) {
index c6a8432a8801e7e9536e7cbf45488a7715dd48f5..aa2f2ef84779e839a49a4d4ca53c3b5276f9e5ce 100644 (file)
@@ -100,7 +100,8 @@ struct cf_section {
 
        void                    *base;
        int                     depth;
-       int                     allow_unlang;
+       int                     allow_unlang;   //!< depth at which we allow unlang
+       bool                    attr;           //!< is this thing an attribute definition?
 
        CONF_SECTION            *template;
 };
index 1409a3b76e5530a3ace64b3ad8860b111944ae80..5084280bbc32f0c95eeb15f494da2eee39eb7999 100644 (file)
@@ -739,6 +739,8 @@ CONF_SECTION *_cf_section_alloc(TALLOC_CTX *ctx, CONF_SECTION *parent,
        }
        talloc_set_destructor(cs, _cf_section_free);
 
+       cs->attr = (cs->name1[0] == '&') | (parent && parent->attr);
+
        if (parent) {
                CONF_DATA const *cd;
                CONF_PARSER *rule;