]> git.ipfire.org Git - thirdparty/ntp.git/commitdiff
[Bug 478] use "end" keyword to stop config file processing
authorHarlan Stenn <stenn@ntp.org>
Tue, 16 Aug 2005 09:34:28 +0000 (05:34 -0400)
committerHarlan Stenn <stenn@ntp.org>
Tue, 16 Aug 2005 09:34:28 +0000 (05:34 -0400)
bk: 4301b324MxKYVcZInXRmORosXFe-TA

include/ntp_config.h
ntpd/ntp_config.c

index 7919bff6325a726c1fc5c3ca3482d5f6f71b347a..b8f220df755ee8d3111f444285c2662b6dbff88d 100644 (file)
@@ -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 */
 
 /*
index 138344ee8ef969cc5af87cd9393ae73a77e60b37..31371f11abdbf35ae3a694bb0ff4ed1952979b6c 100644 (file)
@@ -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");