Skip to content

Commit f5a80c5

Browse files
committed
[v4_1_esv] Implement and use new option format type 'k'
Merges in #68.
1 parent 48e431b commit f5a80c5

File tree

5 files changed

+43
-4
lines changed

5 files changed

+43
-4
lines changed

RELNOTES

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,12 @@ dhcp-users@lists.isc.org.
9090
- Corrected a number of reference counter and zero-length buffer leaks.
9191
[Gitlab #57]
9292

93+
- The option format for the server option omapi-key was changed to a
94+
format type 'k' (key name); while server options ldap-port and
95+
ldap-init-retry were changed to 'L' (unsigned 32-bit integer). These
96+
three options were inadvertantly broken when the 'd' format content
97+
[Gitlab #68]
98+
9399
Changes since 4.1-ESV-R15
94100

95101
- Corrected dhclient command line parsing for --dad-wait-time that causes

common/options.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1607,6 +1607,7 @@ format_has_text(format)
16071607
while (*p != '\0') {
16081608
switch (*p++) {
16091609
case 't':
1610+
case 'k':
16101611
return 1;
16111612

16121613
/* These symbols are arbitrary, not fixed or
@@ -1738,6 +1739,7 @@ format_min_length(format, oc)
17381739
case 'A': /* Array of all that precedes. */
17391740
case 'a': /* Array of preceding symbol. */
17401741
case 'Z': /* nothing. */
1742+
case 'k': /* key name. */
17411743
return min_len;
17421744

17431745
case 'c': /* Compress flag for D atom. */
@@ -1880,6 +1882,7 @@ const char *pretty_print_option (option, data, len, emit_commas, emit_quotes)
18801882
hunksize += k;
18811883
break;
18821884
case 't':
1885+
case 'k':
18831886
fmtbuf[l + 1] = 0;
18841887
numhunk = -2;
18851888
break;
@@ -2023,6 +2026,7 @@ const char *pretty_print_option (option, data, len, emit_commas, emit_quotes)
20232026
for (; j < numelem; j++) {
20242027
switch (fmtbuf [j]) {
20252028
case 't':
2029+
case 'k':
20262030
/* endbuf-1 leaves room for NULL. */
20272031
k = pretty_text(&op, endbuf - 1, &dp,
20282032
data + len, emit_quotes);

common/parse.c

Lines changed: 26 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5293,7 +5293,32 @@ int parse_option_token (rv, cfile, fmt, expr, uniform, lookups)
52935293
POST(freeval);
52945294
}
52955295
break;
5296-
5296+
5297+
case 'k': /* key name */
5298+
token = peek_token (&val, &len, cfile);
5299+
if (token == STRING) {
5300+
token = next_token (&val, &len, cfile);
5301+
} else {
5302+
val = parse_host_name(cfile);
5303+
if (!val) {
5304+
parse_warn(cfile, "not a valid key name.");
5305+
skip_to_semi(cfile);
5306+
return 0;
5307+
}
5308+
freeval = ISC_TRUE;
5309+
}
5310+
5311+
if (!make_const_data (&t, (const unsigned char *)val,
5312+
strlen(val), 1, 1, MDL)) {
5313+
log_fatal ("No memory key name");
5314+
}
5315+
5316+
if (freeval == ISC_TRUE) {
5317+
dfree((char *)val, MDL);
5318+
freeval = ISC_FALSE;
5319+
}
5320+
break;
5321+
52975322
case 'N':
52985323
f = (*fmt) + 1;
52995324
g = strchr (*fmt, '.');

common/tables.c

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -85,10 +85,14 @@ HASH_FUNCTIONS (option_code, const unsigned *, struct option,
8585
the name of the set of enumeration values to parse or emit,
8686
followed by a '.'. The width of the data is specified in the
8787
named enumeration. Named enumerations are tracked in parse.c.
88-
d - Domain name (i.e., FOO or FOO.BAR).
89-
D - Domain list (i.e., example.com eng.example.com)
88+
d - Domain name (e.g., FOO or FOO.BAR) no quotes,
89+
on-wire format is RFC 1035.
90+
D - Domain list (e.g., "example.com eng.example.com") quoted,
91+
on-wire format is RFC 1035.
9092
c - When following a 'D' atom, enables compression pointers.
9193
Z - Zero-length option
94+
k - Key name, unquoted string (e.g. mykey.com or some-text or abc123)
95+
parsed with parse_host_name().
9296
*/
9397

9498
struct universe dhcp_universe;

server/stables.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -210,7 +210,7 @@ static struct option server_options[] = {
210210
{ "limited-broadcast-address", "I", &server_universe, 33, 1 },
211211
{ "remote-port", "S", &server_universe, 34, 1 },
212212
{ "local-address", "I", &server_universe, 35, 1 },
213-
{ "omapi-key", "d", &server_universe, 36, 1 },
213+
{ "omapi-key", "k", &server_universe, 36, 1 },
214214
{ "stash-agent-options", "f", &server_universe, 37, 1 },
215215
{ "ddns-ttl", "T", &server_universe, 38, 1 },
216216
{ "ddns-update-style", "Nddns-styles.", &server_universe, 39, 1 },

0 commit comments

Comments
 (0)