From e7d09a09b377e0b778958d156a3047337aefc6f8 Mon Sep 17 00:00:00 2001 From: Guillaume Nault Date: Mon, 7 Jan 2013 20:01:26 +0100 Subject: Fix boolean options parsing in configuration file Explicitely interpret zero values when parsing boolean options. This allows to unset boolean parameters such as "verbose" when reloading the configuration. Signed-off-by: Guillaume Nault --- accel-pppd/ctrl/l2tp/l2tp.c | 8 ++++---- accel-pppd/ctrl/pptp/pptp.c | 6 +++--- 2 files changed, 7 insertions(+), 7 deletions(-) (limited to 'accel-pppd/ctrl') diff --git a/accel-pppd/ctrl/l2tp/l2tp.c b/accel-pppd/ctrl/l2tp/l2tp.c index dd8b81bb..15887972 100644 --- a/accel-pppd/ctrl/l2tp/l2tp.c +++ b/accel-pppd/ctrl/l2tp/l2tp.c @@ -1612,12 +1612,12 @@ static void load_config(void) const char *opt; opt = conf_get_opt("l2tp", "verbose"); - if (opt && atoi(opt) > 0) - conf_verbose = 1; + if (opt && atoi(opt) >= 0) + conf_verbose = atoi(opt) > 0; opt = conf_get_opt("l2tp", "avp_permissive"); - if (opt && atoi(opt) > 0) - conf_avp_permissive = 1; + if (opt && atoi(opt) >= 0) + conf_avp_permissive = atoi(opt) > 0; opt = conf_get_opt("l2tp", "hello-interval"); if (opt && atoi(opt) > 0) diff --git a/accel-pppd/ctrl/pptp/pptp.c b/accel-pppd/ctrl/pptp/pptp.c index c00f29ff..e735c72c 100644 --- a/accel-pppd/ctrl/pptp/pptp.c +++ b/accel-pppd/ctrl/pptp/pptp.c @@ -744,9 +744,9 @@ static void load_config(void) conf_echo_failure = atoi(opt); opt = conf_get_opt("pptp", "verbose"); - if (opt && atoi(opt) > 0) - conf_verbose = 1; - + if (opt && atoi(opt) >= 0) + conf_verbose = atoi(opt) > 0; + conf_mppe = MPPE_UNSET; opt = conf_get_opt("pptp", "mppe"); if (opt) { -- cgit v1.2.3