From: Dave Hart Date: Thu, 15 Oct 2009 22:09:06 +0000 (+0000) Subject: [Bug 1345] illegal 'grep' option prevents compilation. X-Git-Tag: NTP_4_2_5P234_RC~2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=680eab925e0b1c6170e8596fa7805a0aca0da835;p=thirdparty%2Fntp.git [Bug 1345] illegal 'grep' option prevents compilation. [Bug 1346] keyword scanner broken where char defaults to unsigned. [Bug 1347] ntpd/complete.conf missing multicastclient test case. bk: 4ad79d826ePJSWs2zWr-ExNRVkKF5w --- diff --git a/ChangeLog b/ChangeLog index eacfbcaf9..fb05eed91 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,6 @@ +* [Bug 1345] illegal 'grep' option prevents compilation. +* [Bug 1346] keyword scanner broken where char defaults to unsigned. +* [Bug 1347] ntpd/complete.conf missing multicastclient test case. (4.2.5p233-RC) 2009/10/15 Released by Harlan Stenn * [Bug 1337] cast setsockopt() v4 address pointer to void *. * [Bug 1342] ignore|drop one IPv6 address on an interface blocks all diff --git a/ntpd/Makefile.am b/ntpd/Makefile.am index 56e9ac43a..ee1c10ba5 100644 --- a/ntpd/Makefile.am +++ b/ntpd/Makefile.am @@ -181,8 +181,8 @@ libntpd_a_SOURCES = \ ntp_keyword.out: keyword-gen ./keyword-gen $(srcdir)/ntp_parser.h > $@ - grep -F -v diff_ignore_line < $(srcdir)/ntp_keyword.h > cmp1 - grep -F -v diff_ignore_line < $@ > cmp2 + grep -v diff_ignore_line < $(srcdir)/ntp_keyword.h > cmp1 + grep -v diff_ignore_line < $@ > cmp2 cmp cmp1 cmp2 > /dev/null || cp $@ $(srcdir)/ntp_keyword.h rm cmp1 cmp2 diff --git a/ntpd/complete.conf b/ntpd/complete.conf index c570d2f09..0c06f11a6 100644 --- a/ntpd/complete.conf +++ b/ntpd/complete.conf @@ -36,6 +36,7 @@ broadcast 192.168.192.255 manycastclient 224.0.1.1 manycastclient ff05::101 manycastserver 224.0.1.1 ff05::101 +multicastclient 224.0.1.1 ff05::101 discard minimum 1 average 3 monitor 1 restrict default nomodify limited kod restrict trusted.host.name.example.com. nomodify diff --git a/ntpd/ntp_config.c b/ntpd/ntp_config.c index 114db8512..7439013c4 100644 --- a/ntpd/ntp_config.c +++ b/ntpd/ntp_config.c @@ -912,32 +912,26 @@ dump_config_tree( } } } - + list_ptr = queue_head(ptree->manycastserver); if (list_ptr != NULL) { - addr = (struct address_node *) list_ptr; + addr = list_ptr; fprintf(df, "manycastserver %s", addr->address); - for (list_ptr = next_node(list_ptr); - list_ptr != NULL; - list_ptr = next_node(list_ptr)) { - - addr = (struct address_node *) list_ptr; + for (addr = next_node(addr); + addr != NULL; + addr = next_node(addr)) fprintf(df, " %s", addr->address); - } fprintf(df, "\n"); } list_ptr = queue_head(ptree->multicastclient); if (list_ptr != NULL) { - addr = (struct address_node *) list_ptr; + addr = list_ptr; fprintf(df, "multicastclient %s", addr->address); - for (list_ptr = next_node(list_ptr); - list_ptr != NULL; - list_ptr = next_node(list_ptr)) { - - addr = (struct address_node *) list_ptr; + for (addr = next_node(addr); + addr != NULL; + addr = next_node(addr)) fprintf(df, " %s", addr->address); - } fprintf(df, "\n"); } diff --git a/ntpd/ntp_scanner.c b/ntpd/ntp_scanner.c index d424e0e81..e7da5b05f 100644 --- a/ntpd/ntp_scanner.c +++ b/ntpd/ntp_scanner.c @@ -57,7 +57,7 @@ const char special_chars[] = "{}(),;|="; * --------- */ -char get_next_char(void); +int get_next_char(void); static int is_keyword(char *lexeme, follby *pfollowedby); @@ -176,7 +176,7 @@ FCLOSE( * input_from_file flag. */ -char +int get_next_char( void ) @@ -184,7 +184,7 @@ get_next_char( char ch; if (input_from_file) - return (char)FGETC(ip_file); + return FGETC(ip_file); else { if (remote_config.buffer[remote_config.pos] == '\0') return EOF; @@ -474,20 +474,22 @@ yylex( /* Read in the lexeme */ i = 0; - while (EOF != (yytext[i] = get_next_char())) { + while (EOF != (ch = get_next_char())) { + + yytext[i] = (char)ch; /* Break on whitespace or a special character */ - if (isspace(yytext[i]) || is_EOC(ch) - || '"' == yytext[i] + if (isspace(ch) || is_EOC(ch) + || '"' == ch || (FOLLBY_TOKEN == followedby - && is_special(yytext[i]))) + && is_special(ch))) break; /* Read the rest of the line on reading a start of comment character */ - if ('#' == yytext[i]) { - while (EOF != (yytext[i] = get_next_char()) - && '\n' != yytext[i]) + if ('#' == ch) { + while (EOF != (ch = get_next_char()) + && '\n' != ch) ; /* Null Statement */ break; } @@ -502,11 +504,11 @@ yylex( * * XXX - HMS: I'm not sure we want to assume the closing " */ - if ('"' == yytext[i]) { + if ('"' == ch) { instring = 1; - while (EOF != (yytext[i] = get_next_char()) && - yytext[i] != '"' && yytext[i] != '\n') { - i++; + while (EOF != (ch = get_next_char()) && + ch != '"' && ch != '\n') { + yytext[i++] = (char)ch; if (i >= COUNTOF(yytext)) goto lex_too_long; } @@ -515,8 +517,8 @@ yylex( * this lexeme, but any closing quote should * not be pushed back, so we read another char. */ - if ('"' == yytext[i]) - yytext[i] = get_next_char(); + if ('"' == ch) + ch = get_next_char(); } /* Pushback the last character read that is not a part * of this lexeme. @@ -524,10 +526,10 @@ yylex( * newline character. This is to prevent a parse error * when there is no newline at the end of a file. */ - if (EOF == yytext[i]) + if (EOF == ch) push_back_char('\n'); else - push_back_char(yytext[i]); + push_back_char(ch); yytext[i] = '\0'; } while (i == 0); diff --git a/ntpd/ntp_scanner.h b/ntpd/ntp_scanner.h index 8e53e13fc..7172c8926 100644 --- a/ntpd/ntp_scanner.h +++ b/ntpd/ntp_scanner.h @@ -76,7 +76,6 @@ struct FILE_INFO { /* SCANNER GLOBAL VARIABLES * ------------------------ */ -extern struct state *key_scanner; /* A FSA for recognizing keywords */ extern struct config_tree cfgt; /* Parser output stored here */ extern int curr_include_level; /* The current include level */