From: Arran Cudbard-Bell Date: Wed, 18 May 2016 21:08:29 +0000 (-0400) Subject: Fix is_set for subsections X-Git-Tag: branch_3_1_x~363 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=7cdcaa19983a47cf1a68ea66692694747764eec9;p=thirdparty%2Ffreeradius-server.git Fix is_set for subsections --- diff --git a/src/main/conffile.c b/src/main/conffile.c index f48ed641f16..b15908d64ec 100644 --- a/src/main/conffile.c +++ b/src/main/conffile.c @@ -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,