From: Rob Neal Date: Fri, 1 Jun 2007 11:52:58 +0000 (-0400) Subject: ntp_parser.y, ntp_scanner.c, ChangeLog: X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=5be1da485cae577c1788359add8bc4c14c0b93a6;p=thirdparty%2Fntp.git ntp_parser.y, ntp_scanner.c, ChangeLog: [Bug 846] Correct includefile parsing. bk: 4660089a5GU8J6iZ9YpqK7FwtdnTEA --- diff --git a/ChangeLog b/ChangeLog index ed855016cf..4f4f8c79c4 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,4 @@ +* [Bug 846] Correct includefile parsing. * Enable debugging capability in the config parser. * [Bug 839] Crypto password not read from ntp.conf. * Have autogen produce writable output files. diff --git a/ntpd/ntp_parser.y b/ntpd/ntp_parser.y index 1ca442334b..8496ea436f 100644 --- a/ntpd/ntp_parser.y +++ b/ntpd/ntp_parser.y @@ -717,7 +717,7 @@ tinker_option */ miscellaneous_command - : T_Includefile T_String + : T_Includefile T_String command { if (curr_include_level >= MAXINCLUDELEVEL) { fprintf(stderr, "getconfig: Maximum include file level exceeded.\n"); @@ -730,7 +730,7 @@ miscellaneous_command msyslog(LOG_INFO, "getconfig: Couldn't open <%s>", FindConfig($2)); } else - ++curr_include_level; + ip_file = fp[++curr_include_level]; } } | T_End diff --git a/ntpd/ntp_scanner.c b/ntpd/ntp_scanner.c index a07ffca3d3..9e6c9c3be2 100644 --- a/ntpd/ntp_scanner.c +++ b/ntpd/ntp_scanner.c @@ -517,9 +517,14 @@ int yylex() !is_EOC(ch)) ; /* Null Statement */ - if (ch == EOF) + if (ch == EOF) { + if (curr_include_level == 0) { return 0; - else if (is_EOC(ch)) { + } else { + ip_file = fp[--curr_include_level]; + return T_EOC; + } + } else if (is_EOC(ch)) { expect_string = NO_ARG; /* Reset expect_string */ return T_EOC; }