- Accept both option names with and without colon for get_option

and set_option.


git-svn-id: file:///svn/unbound/trunk@4611 be551aaa-1e26-0410-a405-d3ace91eadb9
This commit is contained in:
Wouter Wijngaards 2018-04-09 10:42:48 +00:00
parent 89ad258515
commit fbee729c5b
2 changed files with 14 additions and 1 deletions

View file

@ -4,6 +4,8 @@
- num.query.authzone.up and num.query.authzone.down statistics counters.
- Fix downstream auth zone, only fallback when auth zone fails to
answer and fallback is enabled.
- Accept both option names with and without colon for get_option
and set_option.
5 April 2018: Wouter
- Combine write of tcp length and tcp query for dns over tls.

View file

@ -386,6 +386,12 @@ struct config_file* config_create_forlib(void)
int config_set_option(struct config_file* cfg, const char* opt,
const char* val)
{
char buf[64];
if(!opt) return 0;
if(opt[strlen(opt)-1] != ':' && strlen(opt)+2<sizeof(buf)) {
snprintf(buf, sizeof(buf), "%s:", opt);
opt = buf;
}
S_NUMBER_OR_ZERO("verbosity:", verbosity)
else if(strcmp(opt, "statistics-interval:") == 0) {
if(strcmp(val, "0") == 0 || strcmp(val, "") == 0)
@ -801,8 +807,13 @@ int
config_get_option(struct config_file* cfg, const char* opt,
void (*func)(char*,void*), void* arg)
{
char buf[1024];
char buf[1024], nopt[64];
size_t len = sizeof(buf);
if(opt && opt[strlen(opt)-1] == ':' && strlen(opt)<sizeof(nopt)) {
memmove(nopt, opt, strlen(opt));
nopt[strlen(opt)-1] = 0;
opt = nopt;
}
fptr_ok(fptr_whitelist_print_func(func));
O_DEC(opt, "verbosity", verbosity)
else O_DEC(opt, "statistics-interval", stat_interval)