config: skip unknown sections

This would allow future extensibility, by making clients which
don't support a section to skip it.

Signed-off-by: Nikos Mavrogiannopoulos <nmav@gnutls.org>
This commit is contained in:
Nikos Mavrogiannopoulos
2018-01-14 14:57:05 +01:00
parent 1b8079a11a
commit 894cdb7a52
2 changed files with 17 additions and 5 deletions

View File

@@ -411,6 +411,11 @@ static int iroutes_handler(void *_ctx, const char *section, const char *name, co
int ret;
char *value;
if (section != NULL && section[0] != 0) {
fprintf(stderr, WARNSTR"skipping unknown section '%s'\n", section);
return 0;
}
if (strcmp(name, "iroute")!=0)
return 0;
@@ -508,6 +513,12 @@ static int cfg_ini_handler(void *_ctx, const char *section, const char *name, co
unsigned prefix4 = 0;
char *value;
if (section != NULL && section[0] != 0) {
if (reload == 0)
fprintf(stderr, WARNSTR"skipping unknown section '%s'\n", section);
return 0;
}
value = sanitize_config_value(config, _value);
if (value == NULL)
return 0;
@@ -818,10 +829,6 @@ static int cfg_ini_handler(void *_ctx, const char *section, const char *name, co
} else {
if (reload == 0)
fprintf(stderr, WARNSTR"skipping unknown option '%s'\n", name);
#if 0
else
fprintf(stderr, NOTESTR"skipping option '%s'\n", name);
#endif
}
exit: