void (*free)(void *); /* free user data function */
};
+extern int check_config;
static int cf_data_add_internal(CONF_SECTION *cs, const char *name,
void *data, void (*data_free)(void *),
* Free up dynamically allocated string pointers.
*/
for (i = 0; variables[i].name != NULL; i++) {
+ int type;
char **p;
- if ((variables[i].type != PW_TYPE_STRING_PTR) &&
- (variables[i].type != PW_TYPE_FILENAME)) {
+ type = variables[i].type & ~PW_TYPE_DEPRECATED;
+
+ if ((type != PW_TYPE_STRING_PTR) &&
+ (type != PW_TYPE_FILENAME)) {
continue;
}
int cf_item_parse(CONF_SECTION *cs, const char *name,
int type, void *data, const char *dflt)
{
- int rcode = 0;
+ int deprecated, rcode = 0;
char **q;
const char *value;
fr_ipaddr_t ipaddr;
const CONF_PAIR *cp = NULL;
char ipbuf[128];
+ deprecated = (type & PW_TYPE_DEPRECATED);
+ type &= ~PW_TYPE_DEPRECATED;
+
if (cs) cp = cf_pair_find(cs, name);
if (cp) {
value = cp->value;
return 0;
}
+ if (deprecated) {
+ cf_log_err(cf_sectiontoitem(cs), "\"%s\" is deprecated. Please replace it with the up-to-date configuration", name);
+ if (check_config) {
+ return -1;
+ }
+ }
+
switch (type) {
case PW_TYPE_BOOLEAN:
/*
* DON'T exist in radiusd.conf, then the previously parsed
* values for "log { foo = bar}" will be used.
*/
- { "log_auth", PW_TYPE_BOOLEAN, 0, &mainconfig.log_auth, NULL },
- { "log_auth_badpass", PW_TYPE_BOOLEAN, 0, &mainconfig.log_auth_badpass, NULL },
- { "log_auth_goodpass", PW_TYPE_BOOLEAN, 0, &mainconfig.log_auth_goodpass, NULL },
- { "log_stripped_names", PW_TYPE_BOOLEAN, 0, &log_stripped_names, NULL },
+ { "log_auth", PW_TYPE_BOOLEAN | PW_TYPE_DEPRECATED, 0, &mainconfig.log_auth, NULL },
+ { "log_auth_badpass", PW_TYPE_BOOLEAN | PW_TYPE_DEPRECATED, 0, &mainconfig.log_auth_badpass, NULL },
+ { "log_auth_goodpass", PW_TYPE_BOOLEAN | PW_TYPE_DEPRECATED, 0, &mainconfig.log_auth_goodpass, NULL },
+ { "log_stripped_names", PW_TYPE_BOOLEAN | PW_TYPE_DEPRECATED, 0, &log_stripped_names, NULL },
{ "security", PW_TYPE_SUBSECTION, 0, NULL, (const void *) security_config },
* For backwards compatibility.
*/
#ifdef HAVE_SETUID
- { "user", PW_TYPE_STRING_PTR, 0, &uid_name, NULL },
- { "group", PW_TYPE_STRING_PTR, 0, &gid_name, NULL },
+ { "user", PW_TYPE_STRING_PTR | PW_TYPE_DEPRECATED, 0, &uid_name, NULL },
+ { "group", PW_TYPE_STRING_PTR | PW_TYPE_DEPRECATED, 0, &gid_name, NULL },
#endif
- { "chroot", PW_TYPE_STRING_PTR, 0, &chroot_dir, NULL },
- { "allow_core_dumps", PW_TYPE_BOOLEAN, 0, &allow_core_dumps, NULL },
+ { "chroot", PW_TYPE_STRING_PTR | PW_TYPE_DEPRECATED, 0, &chroot_dir, NULL },
+ { "allow_core_dumps", PW_TYPE_BOOLEAN | PW_TYPE_DEPRECATED, 0, &allow_core_dumps, NULL },
{ NULL, -1, 0, NULL, NULL }
};
* This allows us to figure out where, relative to
* radiusd.conf, the other configuration files exist.
*/
- cf_section_parse(cs, NULL, server_config);
+ if (cf_section_parse(cs, NULL, server_config) < 0) {
+ return -1;
+ }
if (mainconfig.max_request_time == 0) mainconfig.max_request_time = 100;
if (mainconfig.reject_delay > 5) mainconfig.reject_delay = 5;