]> git.ipfire.org Git - thirdparty/ntp.git/commitdiff
ntp_scanner.c, ChangeLog:
authorRob Neal <neal@ntp.org>
Fri, 1 Jun 2007 22:30:18 +0000 (18:30 -0400)
committerRob Neal <neal@ntp.org>
Fri, 1 Jun 2007 22:30:18 +0000 (18:30 -0400)
  [Bug 828] refid not being parsed correctly.

bk: 46609dfaTw-hTQPPdWihosrdfwQAPw

ChangeLog
ntpd/ntp_scanner.c

index e1b1c99f4f484240fa01ee2fea1c65de4981383f..070b1a5d1809a9c058889dfa4b9b4bc177ff50b8 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,4 @@
+* [Bug 828] refid string not being parsed correctly.
 * [Bug 846] Correct includefile parsing.
 * [Bug 827] New parsing code does not handle "fudge" correctly.
 * Enable debugging capability in the config parser.
index 9e6c9c3be2a473bbb9b6fc892f7430bff9171778..5548e547443ab8545754266d39244cda0442fceb 100644 (file)
@@ -505,7 +505,7 @@ static int is_EOC(char ch)
 
 int yylex()
 {
-    int i;
+    int i, instring = 0;
     int token;                 /* The return value/the recognized token */
     int ch;
     static int expect_string = NO_ARG;
@@ -558,6 +558,7 @@ int yylex()
         * If we make it to EOL without a terminating " assume it for them.
         */
         if (yytext[i] == '"') {
+         instring = 1;
              while ((yytext[i] = get_next_char()) != EOF &&
                      yytext[i] != '"' && yytext[i] != '\n') {
                        i++;
@@ -583,10 +584,10 @@ int yylex()
 #endif
 
     /* Now return the desired token */
-    if ((expect_string == NO_ARG) && 
+    if ((expect_string == NO_ARG) &&  (!instring) &&
         (token = is_keyword(yytext, &expect_string)))
         return token;
-    else if (is_integer(yytext)) {
+    else if (is_integer(yytext) && (!instring) ) {
         errno = 0;
         if ((yylval.Integer = strtol(yytext,(char **) NULL, 10)) == 0
             && ((errno == EINVAL) || (errno == ERANGE))) {
@@ -597,7 +598,7 @@ int yylex()
         else
             return T_Integer;
     }
-    else if (is_double(yytext)) {
+    else if (is_double(yytext) && (!instring)) {
         errno = 0;
         if ((yylval.Double = atof(yytext)) == 0 && errno == ERANGE) {
             fprintf(stderr, "Double too large to represent: %s\n",
@@ -607,7 +608,7 @@ int yylex()
         else
             return T_Double;
     }
-    else if (is_ipv4_address(yytext)) {
+    else if (is_ipv4_address(yytext) && (!instring)) {
         if (expect_string == SINGLE_ARG)
             expect_string = NO_ARG;
         errno = 0;
@@ -620,7 +621,7 @@ int yylex()
         else
             return T_IPv4_address;
     }
-    else if (is_ipv6_address(yytext)) {
+    else if (is_ipv6_address(yytext) && (!instring)) {
         if (expect_string == SINGLE_ARG)
             expect_string = NO_ARG;
         errno = 0;
@@ -634,6 +635,7 @@ int yylex()
             return T_IPv6_address;
     }
     else { /* Default: Everything is a string */
+        instring = 0;
         if (expect_string == SINGLE_ARG)
             expect_string = NO_ARG;
         errno = 0;