int cf_section_parse(CONF_SECTION *cs, const CONF_PARSER *variables)
{
int i;
+ int rcode;
char **q;
CONF_PAIR *cp;
+ CONF_SECTION *subsection;
uint32_t ipaddr;
char buffer[1024];
const char *value;
switch (variables[i].type)
{
+ case PW_TYPE_SUBSECTION:
+ subsection = cf_section_sub_find(cs,variables[i].name);
+
+ /*
+ * If the configuration section is NOT there,
+ * then ignore it.
+ *
+ * FIXME! This is probably wrong... we should
+ * probably set the items to their default values.
+ */
+ if (!subsection) {
+ break;
+ }
+
+ rcode = cf_section_parse(subsection,
+ (CONF_PARSER *) variables[i].data);
+ if (rcode < 0) {
+ return -1;
+ }
+ break;
+
case PW_TYPE_BOOLEAN:
/*
* Allow yes/no and on/off
}
/*
- * Expand variables while parsing.
+ * Expand variables while parsing,
+ * but ONLY expand ones which haven't already
+ * been expanded.
*/
- if (value) {
- cf_expand_variables(NULL, 0, cs, buffer, value);
- value = buffer;
+ if (value && (value == variables[i].dflt)) {
+ cf_expand_variables(NULL, 0, cs, buffer,value);
+ value = buffer;
}
DEBUG2("Config: %s.%s = \"%s\"",
#endif
/*
+ * Map the proxy server configuration parameters to variables.
+ */
+static CONF_PARSER proxy_config[] = {
+ { "retry_delay", PW_TYPE_INTEGER,
+ &proxy_retry_delay, Stringify(RETRY_DELAY) },
+ { "retry_count", PW_TYPE_INTEGER,
+ &proxy_retry_count, Stringify(RETRY_COUNT) },
+ { "synchronous", PW_TYPE_BOOLEAN, &proxy_synchronous, "yes" },
+
+ { NULL, -1, NULL, NULL }
+};
+
+/*
* A mapping of configuration file names to internal variables
*/
static CONF_PARSER server_config[] = {
{ "log_auth_goodpass", PW_TYPE_BOOLEAN, &mainconfig.log_auth_goodpass, "no" },
{ "pidfile", PW_TYPE_STRING_PTR, &pid_file, "${run_dir}/radiusd.pid"},
{ "bind_address", PW_TYPE_IPADDR, &myip, "*" },
- { "proxy_requests", PW_TYPE_BOOLEAN, &proxy_requests, "yes" },
{ "user", PW_TYPE_STRING_PTR, &uid_name, NULL},
{ "group", PW_TYPE_STRING_PTR, &gid_name, NULL},
+
{ "usercollide", PW_TYPE_BOOLEAN, &mainconfig.do_usercollide, "no" },
{ "lower_user", PW_TYPE_BOOLEAN, &mainconfig.do_lower_user, "no" },
{ "lower_pass", PW_TYPE_BOOLEAN, &mainconfig.do_lower_pass, "no" },
{ "nospace_user", PW_TYPE_BOOLEAN, &mainconfig.do_nospace_user, "no" },
{ "nospace_pass", PW_TYPE_BOOLEAN, &mainconfig.do_nospace_pass, "no" },
{ "nospace_time", PW_TYPE_STRING_PTR, &mainconfig.nospace_time, "before" },
- { NULL, -1, NULL, NULL }
-};
-
-/*
- * Map the proxy server configuration parameters to variables.
- */
-static CONF_PARSER proxy_config[] = {
- { "retry_delay", PW_TYPE_INTEGER,
- &proxy_retry_delay, Stringify(RETRY_DELAY) },
- { "retry_count", PW_TYPE_INTEGER,
- &proxy_retry_count, Stringify(RETRY_COUNT) },
- { "synchronous", PW_TYPE_BOOLEAN, &proxy_synchronous, "yes" },
+ { "proxy_requests", PW_TYPE_BOOLEAN, &proxy_requests, "yes" },
+ { "proxy", PW_TYPE_SUBSECTION, proxy_config, NULL },
{ NULL, -1, NULL, NULL }
};
}
}
-
- /*
- * Parse the server's proxy configuration values.
- */
- if ((proxy_requests) &&
- ((cs = cf_section_find("proxy")) != NULL)) {
- cf_section_parse(cs, proxy_config);
- }
-
return 0;
}