]> git.ipfire.org Git - thirdparty/ntp.git/commitdiff
ntp_config.c:
authorRob Neal <neal@ntp.org>
Tue, 29 May 2007 19:46:00 +0000 (15:46 -0400)
committerRob Neal <neal@ntp.org>
Tue, 29 May 2007 19:46:00 +0000 (15:46 -0400)
  [Bug 825] Correct logconfig -/+ keyword processing.
ntp_scanner.c:
  [Bug 828] Correct parsing of " delimited strings.

bk: 465c82f88iwXdTtSmbxUz2076gugEg

ntpd/ntp_config.c
ntpd/ntp_scanner.c

index a125d154ed37e41ac3456be0430d80bb6738d6cf..57aed65edb13854412d2098e46cfa48d96751b0d 100644 (file)
@@ -329,7 +329,7 @@ struct attr_val *create_attr_sval(int attr, char *s)
     my_val = (struct attr_val *)
         get_node(sizeof(struct attr_val));
     my_val->attr = attr;
-    my_val->value.s = s;
+    my_val->value.s = strdup(s);
     my_val->type = T_String;
     return my_val;
 }
index 597b09bf860fcc89c96f543af989c5aa57b52613..a07ffca3d39f900d40a65457dc65e06d9c59fef2 100644 (file)
@@ -536,8 +536,9 @@ int yylex()
                  (yytext[i] = get_next_char()) != EOF; ++i) {
         
             /* Break on reading in whitespace or a special character */
-            if (isspace(yytext[i]) || is_special(yytext[i]) || is_EOC(ch))
-                break;
+            if (isspace(yytext[i]) || is_special(yytext[i]) || is_EOC(ch)
+                       || yytext[i] == '"')
+               break;
         
             /* Read the rest of the line on reading a start of comment 
                character */
@@ -548,6 +549,17 @@ int yylex()
                 break;
             }   
         }
+       /* Pick up all of the string inside between " marks, to end of line.
+        * If we make it to EOL without a terminating " assume it for them.
+        */
+        if (yytext[i] == '"') {
+             while ((yytext[i] = get_next_char()) != EOF &&
+                     yytext[i] != '"' && yytext[i] != '\n') {
+                       i++;
+               }
+             if (yytext[i] == '"')
+                yytext[i] =  ' ';
+        }
         /* If the last character read was an EOF, pushback a newline
          * character. This is to prevent a parse error when there is
          * no newline at the end of a file