From: Harlan Stenn Date: Tue, 16 Aug 2005 09:34:28 +0000 (-0400) Subject: [Bug 478] use "end" keyword to stop config file processing X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=d0534612fbd758d2c0fba0faeb8ed49cf4b5e988;p=thirdparty%2Fntp.git [Bug 478] use "end" keyword to stop config file processing bk: 4301b324MxKYVcZInXRmORosXFe-TA --- diff --git a/include/ntp_config.h b/include/ntp_config.h index 7919bff632..b8f220df75 100644 --- a/include/ntp_config.h +++ b/include/ntp_config.h @@ -56,8 +56,9 @@ #define CONFIG_TTL 35 #define CONFIG_INCLUDEFILE 36 #define CONFIG_KEYSDIR 37 +#define CONFIG_END 38 #ifdef OPENSSL -#define CONFIG_CRYPTO 38 +#define CONFIG_CRYPTO 39 #endif /* OPENSSL */ /* diff --git a/ntpd/ntp_config.c b/ntpd/ntp_config.c index 138344ee8e..31371f11ab 100644 --- a/ntpd/ntp_config.c +++ b/ntpd/ntp_config.c @@ -73,6 +73,7 @@ static struct keyword keywords[] = { { "disable", CONFIG_DISABLE }, { "driftfile", CONFIG_DRIFTFILE }, { "enable", CONFIG_ENABLE }, + { "end", CONFIG_END }, { "filegen", CONFIG_FILEGEN }, { "fudge", CONFIG_FUDGE }, { "includefile", CONFIG_INCLUDEFILE }, @@ -585,6 +586,8 @@ getconfig( } for (;;) { + if (tok == CONFIG_END) + break; if (fp[includelevel]) tok = gettokens(fp[includelevel], line, tokens, &ntokens); #ifdef HAVE_NETINFO @@ -868,6 +871,12 @@ getconfig( stats_config(STATS_PID_FILE, (char *)0); break; + case CONFIG_END: + for ( i = 0; i <= includelevel; i++ ) { + fclose(fp[i]); + } + break; + case CONFIG_INCLUDEFILE: if (ntokens < 2) { msyslog(LOG_ERR, "includefile needs one argument");