mirror of
https://gitlab.isc.org/isc-projects/dhcp
synced 2025-08-22 09:57:20 +00:00
Support for zero-length options in config files.
See RT ticket #17029 for more.
This commit is contained in:
parent
44a67e653f
commit
f800f4f633
4
RELNOTES
4
RELNOTES
@ -76,6 +76,10 @@ suggested fixes to <dhcp-users@isc.org>.
|
|||||||
the DHCPv6 client configuration. 'send dhcp6.oro' is no longer
|
the DHCPv6 client configuration. 'send dhcp6.oro' is no longer
|
||||||
necessary.
|
necessary.
|
||||||
|
|
||||||
|
- Bug fixed where configuration file parsing did not work with
|
||||||
|
zero-length options; this made it impossible to set the
|
||||||
|
rapid-commit option.
|
||||||
|
|
||||||
Changes since 4.0.0a1
|
Changes since 4.0.0a1
|
||||||
|
|
||||||
- Bug in octal parsing fixed. Thanks to Bernd Fuhrmann for the report
|
- Bug in octal parsing fixed. Thanks to Bernd Fuhrmann for the report
|
||||||
|
@ -4825,7 +4825,7 @@ struct option *option;
|
|||||||
* not an array of pairs of IP addresses, or something like
|
* not an array of pairs of IP addresses, or something like
|
||||||
* that.
|
* that.
|
||||||
*/
|
*/
|
||||||
int uniform = option -> format [1] == 'A';
|
int uniform = 0;
|
||||||
|
|
||||||
and_again:
|
and_again:
|
||||||
/* Set fmt to start of format for 'A' and one char back
|
/* Set fmt to start of format for 'A' and one char back
|
||||||
@ -4837,9 +4837,10 @@ struct option *option;
|
|||||||
fmt = option->format;
|
fmt = option->format;
|
||||||
|
|
||||||
/* 'a' means always uniform */
|
/* 'a' means always uniform */
|
||||||
uniform |= (fmt [1] == 'a');
|
if ((fmt[0] != '\0') && (tolower(fmt[1]) == 'a'))
|
||||||
|
uniform = 1;
|
||||||
|
|
||||||
for ( ; *fmt; fmt++) {
|
do {
|
||||||
if ((*fmt == 'A') || (*fmt == 'a'))
|
if ((*fmt == 'A') || (*fmt == 'a'))
|
||||||
break;
|
break;
|
||||||
if (*fmt == 'o')
|
if (*fmt == 'o')
|
||||||
@ -4860,7 +4861,12 @@ struct option *option;
|
|||||||
}
|
}
|
||||||
if (tmp)
|
if (tmp)
|
||||||
expression_dereference (&tmp, MDL);
|
expression_dereference (&tmp, MDL);
|
||||||
}
|
|
||||||
|
if (*fmt != '\0')
|
||||||
|
fmt++;
|
||||||
|
|
||||||
|
} while (*fmt != '\0');
|
||||||
|
|
||||||
if ((*fmt == 'A') || (*fmt == 'a')) {
|
if ((*fmt == 'A') || (*fmt == 'a')) {
|
||||||
token = peek_token (&val, (unsigned *)0, cfile);
|
token = peek_token (&val, (unsigned *)0, cfile);
|
||||||
/* Comma means: continue with next element in array */
|
/* Comma means: continue with next element in array */
|
||||||
@ -4904,13 +4910,16 @@ int parse_option_statement (result, cfile, lookups, option, op)
|
|||||||
int lose;
|
int lose;
|
||||||
|
|
||||||
token = peek_token (&val, (unsigned *)0, cfile);
|
token = peek_token (&val, (unsigned *)0, cfile);
|
||||||
if (token == SEMI) {
|
if ((token == SEMI) && (option->format[0] != '\0')) {
|
||||||
/* Eat the semicolon... */
|
/* Eat the semicolon... */
|
||||||
|
/*
|
||||||
|
* XXXSK: I'm not sure why we should ever get here, but we
|
||||||
|
* do during our startup. This confuses things if
|
||||||
|
* we are parsing a zero-length option, so don't
|
||||||
|
* eat the semicolon token in that case.
|
||||||
|
*/
|
||||||
token = next_token (&val, (unsigned *)0, cfile);
|
token = next_token (&val, (unsigned *)0, cfile);
|
||||||
goto done;
|
} else if (token == EQUAL) {
|
||||||
}
|
|
||||||
|
|
||||||
if (token == EQUAL) {
|
|
||||||
/* Eat the equals sign. */
|
/* Eat the equals sign. */
|
||||||
token = next_token (&val, (unsigned *)0, cfile);
|
token = next_token (&val, (unsigned *)0, cfile);
|
||||||
|
|
||||||
@ -4926,16 +4935,11 @@ int parse_option_statement (result, cfile, lookups, option, op)
|
|||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
/* We got a valid expression, so use it. */
|
if (! parse_option_data(&expr, cfile, lookups, option))
|
||||||
goto done;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Parse the option data... */
|
|
||||||
if (! parse_option_data(&expr, cfile, lookups, option))
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
done:
|
|
||||||
if (!parse_semi (cfile))
|
if (!parse_semi (cfile))
|
||||||
return 0;
|
return 0;
|
||||||
if (!executable_statement_allocate (result, MDL))
|
if (!executable_statement_allocate (result, MDL))
|
||||||
@ -5192,6 +5196,17 @@ int parse_option_token (rv, cfile, fmt, expr, uniform, lookups)
|
|||||||
return 0;
|
return 0;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case '\0': /* Zero-length option. */
|
||||||
|
buf[0] = '\0';
|
||||||
|
if (!make_const_data(&t, /* expression */
|
||||||
|
buf, /* buffer */
|
||||||
|
0, /* length */
|
||||||
|
0, /* terminated */
|
||||||
|
1, /* allocate */
|
||||||
|
MDL))
|
||||||
|
return 0;
|
||||||
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
parse_warn (cfile, "Bad format %c in parse_option_token.",
|
parse_warn (cfile, "Bad format %c in parse_option_token.",
|
||||||
**fmt);
|
**fmt);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user