mirror of
https://gitlab.isc.org/isc-projects/dhcp
synced 2025-08-29 13:28:14 +00:00
[master] Corrected right brace detection in parsing
Merges in rt36021
This commit is contained in:
parent
267a248dbb
commit
71d7e9aa4c
5
RELNOTES
5
RELNOTES
@ -54,12 +54,15 @@ by Eric Young (eay@cryptsoft.com).
|
|||||||
|
|
||||||
Changes since 4.3.1
|
Changes since 4.3.1
|
||||||
|
|
||||||
|
- Corrected parser's right brace matching when a statement contains an error.
|
||||||
|
[ISC-Bugs #36021]
|
||||||
|
|
||||||
- TSIG-authenticated dynamic DNS updates now support the use of these
|
- TSIG-authenticated dynamic DNS updates now support the use of these
|
||||||
additional algorithms: hmac-sha1, hmac-sha224, hmac-sha256, hmac-sha384,
|
additional algorithms: hmac-sha1, hmac-sha224, hmac-sha256, hmac-sha384,
|
||||||
and hmac-sha512
|
and hmac-sha512
|
||||||
[ISC-Bugs #36947]
|
[ISC-Bugs #36947]
|
||||||
|
|
||||||
- Corrected rate limiting checks for bad packet logging.
|
- Corrected rate limiting checks for bad packet logging.
|
||||||
[ISC-Bugs #36897]
|
[ISC-Bugs #36897]
|
||||||
|
|
||||||
- Log statements depicting what files will be used by the server now occur
|
- Log statements depicting what files will be used by the server now occur
|
||||||
|
@ -72,11 +72,18 @@ struct enumeration_value *find_enumeration_value (const char *name,
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Skip to the semicolon ending the current statement. If we encounter
|
/* Skip to the semicolon ending the current statement. If we encounter
|
||||||
braces, the matching closing brace terminates the statement. If we
|
braces, the matching closing brace terminates the statement.
|
||||||
encounter a right brace but haven't encountered a left brace, return
|
*/
|
||||||
leaving the brace in the token buffer for the caller. If we see a
|
void skip_to_semi (cfile)
|
||||||
semicolon and haven't seen a left brace, return. This lets us skip
|
struct parse *cfile;
|
||||||
over:
|
{
|
||||||
|
skip_to_rbrace(cfile, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Skips everything from the current point upto (and including) the given
|
||||||
|
number of right braces. If we encounter a semicolon but haven't seen a
|
||||||
|
left brace, consume it and return.
|
||||||
|
This lets us skip over:
|
||||||
|
|
||||||
statement;
|
statement;
|
||||||
statement foo bar { }
|
statement foo bar { }
|
||||||
@ -84,13 +91,6 @@ struct enumeration_value *find_enumeration_value (const char *name,
|
|||||||
statement}
|
statement}
|
||||||
|
|
||||||
...et cetera. */
|
...et cetera. */
|
||||||
|
|
||||||
void skip_to_semi (cfile)
|
|
||||||
struct parse *cfile;
|
|
||||||
{
|
|
||||||
skip_to_rbrace (cfile, 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
void skip_to_rbrace (cfile, brace_count)
|
void skip_to_rbrace (cfile, brace_count)
|
||||||
struct parse *cfile;
|
struct parse *cfile;
|
||||||
int brace_count;
|
int brace_count;
|
||||||
@ -99,30 +99,36 @@ void skip_to_rbrace (cfile, brace_count)
|
|||||||
const char *val;
|
const char *val;
|
||||||
|
|
||||||
#if defined (DEBUG_TOKEN)
|
#if defined (DEBUG_TOKEN)
|
||||||
log_error ("skip_to_rbrace: %d\n", brace_count);
|
log_error("skip_to_rbrace: %d\n", brace_count);
|
||||||
#endif
|
#endif
|
||||||
do {
|
do {
|
||||||
token = peek_token (&val, (unsigned *)0, cfile);
|
token = peek_token(&val, NULL, cfile);
|
||||||
if (token == RBRACE) {
|
if (token == RBRACE) {
|
||||||
skip_token(&val, (unsigned *)0, cfile);
|
if (brace_count > 0) {
|
||||||
if (brace_count) {
|
--brace_count;
|
||||||
if (!--brace_count)
|
}
|
||||||
return;
|
|
||||||
} else
|
if (brace_count == 0) {
|
||||||
|
/* Eat the brace and return. */
|
||||||
|
skip_token(&val, NULL, cfile);
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
} else if (token == LBRACE) {
|
} else if (token == LBRACE) {
|
||||||
brace_count++;
|
brace_count++;
|
||||||
} else if (token == SEMI && !brace_count) {
|
} else if (token == SEMI && (brace_count == 0)) {
|
||||||
skip_token(&val, (unsigned *)0, cfile);
|
/* Eat the semicolon and return. */
|
||||||
|
skip_token(&val, NULL, cfile);
|
||||||
return;
|
return;
|
||||||
} else if (token == EOL) {
|
} else if (token == EOL) {
|
||||||
/* EOL only happens when parsing /etc/resolv.conf,
|
/* EOL only happens when parsing /etc/resolv.conf,
|
||||||
and we treat it like a semicolon because the
|
and we treat it like a semicolon because the
|
||||||
resolv.conf file is line-oriented. */
|
resolv.conf file is line-oriented. */
|
||||||
skip_token(&val, (unsigned *)0, cfile);
|
skip_token(&val, NULL, cfile);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
token = next_token (&val, (unsigned *)0, cfile);
|
|
||||||
|
/* Eat the current token */
|
||||||
|
token = next_token(&val, NULL, cfile);
|
||||||
} while (token != END_OF_FILE);
|
} while (token != END_OF_FILE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user