]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
Fix is_set for subsections
authorArran Cudbard-Bell <a.cudbardb@freeradius.org>
Wed, 18 May 2016 21:08:29 +0000 (17:08 -0400)
committerArran Cudbard-Bell <a.cudbardb@freeradius.org>
Wed, 18 May 2016 21:08:29 +0000 (17:08 -0400)
src/main/conffile.c

index f48ed641f1617b9b0bf82bc889328a8dbd7c3481..b15908d64ec86ec3be01e65e2cd8b922918b67c4 100644 (file)
@@ -2196,9 +2196,11 @@ int cf_pair_parse(CONF_SECTION *cs, char const *name, unsigned int type, void *d
        return 0;
 }
 
-/*
- *     A copy of cf_section_parse that initializes pointers before
- *     parsing them.
+/** Pre-allocate a config section structure to allow defaults to be set
+ *
+ * @param cs           The parent subsection.
+ * @param base         pointer or variable.
+ * @param variables    that may have defaults in this config section.
  */
 static void cf_section_parse_init(CONF_SECTION *cs, void *base, CONF_PARSER const *variables)
 {
@@ -2212,6 +2214,17 @@ static void cf_section_parse_init(CONF_SECTION *cs, void *base, CONF_PARSER cons
 
                        subcs = cf_section_sub_find(cs, variables[i].name);
 
+                       /*
+                        *      Set the is_set field for the subsection.
+                        */
+                       if (variables[i].type & PW_TYPE_IS_SET) {
+                               bool *is_set = NULL;
+
+                               is_set = variables[i].data ? variables[i].is_set_ptr :
+                                                            ((uint8_t *)base) + variables[i].is_set_offset;
+                               *is_set = !!subcs;
+                       }
+
                        /*
                         *      If there's no subsection in the
                         *      config, BUT the CONF_PARSER wants one,