From: Rob Neal Date: Tue, 29 May 2007 19:46:00 +0000 (-0400) Subject: ntp_config.c: X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=c69221aca3a9a93059011dd3f7aa09c1b93a3dd4;p=thirdparty%2Fntp.git ntp_config.c: [Bug 825] Correct logconfig -/+ keyword processing. ntp_scanner.c: [Bug 828] Correct parsing of " delimited strings. bk: 465c82f88iwXdTtSmbxUz2076gugEg --- diff --git a/ntpd/ntp_config.c b/ntpd/ntp_config.c index a125d154ed..57aed65edb 100644 --- a/ntpd/ntp_config.c +++ b/ntpd/ntp_config.c @@ -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; } diff --git a/ntpd/ntp_scanner.c b/ntpd/ntp_scanner.c index 597b09bf86..a07ffca3d3 100644 --- a/ntpd/ntp_scanner.c +++ b/ntpd/ntp_scanner.c @@ -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