diff options
author | Thomas Markwalder <tmark@isc.org> | 2019-12-17 11:26:05 -0500 |
---|---|---|
committer | Thomas Markwalder <tmark@isc.org> | 2019-12-17 11:26:05 -0500 |
commit | fc029b638bc82eaa6b79a05f73e0ce05fc84dc32 (patch) | |
tree | 38a733df73c581df4a011ebd8ef6e74971ec1865 | |
parent | 3389877243556198ea956f9d9d79e57d3befd70f (diff) | |
download | isc-dhcp-fc029b638bc82eaa6b79a05f73e0ce05fc84dc32.tar.gz |
[#68] Implement and use new format type 'k'
common/options.c
format_has_text(format)
format_min_length(format, oc)
pretty_print_option (option, data, len, emit_commas, emit_quotes)
- all treat new 'k' format same as 't'
common/parse.c
int parse_option_token (rv, cfile, fmt, expr, uniform, lookups)
- added 'k' support, parses value using parse_host_name()
common/tables.c
Documented 'k' format
server/stables.c
Changed:
omapi-key to "k"
ldap-port to "L"
ldap-init-retry to "L"
Updated release notes.
-rw-r--r-- | RELNOTES | 8 | ||||
-rw-r--r-- | common/options.c | 4 | ||||
-rw-r--r-- | common/parse.c | 27 | ||||
-rw-r--r-- | common/tables.c | 8 | ||||
-rw-r--r-- | server/stables.c | 2 |
5 files changed, 41 insertions, 8 deletions
@@ -90,10 +90,10 @@ dhcp-users@lists.isc.org. - Corrected a number of reference counter and zero-length buffer leaks. [Gitlab #57] -- The option format for the server option omapi-key has been changed - from "d" (domain-name) to "t" (text). This option was inadvertantly - broken when the "d" format content was changed to comply with RFC 1035 - wire format (see Gitlab #2). +- The option format for the server option omapi-key was changed to a + format type 'k' (key name); while server options ldap-port and + ldap-init-retry were changed to 'L' (unsigend 32-bit integer). These + three options were inadvertantly broken when the "d" format content [Gitlab #68] Changes since 4.1-ESV-R15 diff --git a/common/options.c b/common/options.c index b9a525c0..42bfb721 100644 --- a/common/options.c +++ b/common/options.c @@ -1607,6 +1607,7 @@ format_has_text(format) while (*p != '\0') { switch (*p++) { case 't': + case 'k': return 1; /* These symbols are arbitrary, not fixed or @@ -1738,6 +1739,7 @@ format_min_length(format, oc) case 'A': /* Array of all that precedes. */ case 'a': /* Array of preceding symbol. */ case 'Z': /* nothing. */ + case 'k': /* key name. */ return min_len; case 'c': /* Compress flag for D atom. */ @@ -1880,6 +1882,7 @@ const char *pretty_print_option (option, data, len, emit_commas, emit_quotes) hunksize += k; break; case 't': + case 'k': fmtbuf[l + 1] = 0; numhunk = -2; break; @@ -2023,6 +2026,7 @@ const char *pretty_print_option (option, data, len, emit_commas, emit_quotes) for (; j < numelem; j++) { switch (fmtbuf [j]) { case 't': + case 'k': /* endbuf-1 leaves room for NULL. */ k = pretty_text(&op, endbuf - 1, &dp, data + len, emit_quotes); diff --git a/common/parse.c b/common/parse.c index eabf3ed2..e78223c2 100644 --- a/common/parse.c +++ b/common/parse.c @@ -5293,7 +5293,32 @@ int parse_option_token (rv, cfile, fmt, expr, uniform, lookups) POST(freeval); } break; - + + case 'k': /* key name */ + token = peek_token (&val, &len, cfile); + if (token == STRING) { + token = next_token (&val, &len, cfile); + } else { + val = parse_host_name(cfile); + if (!val) { + parse_warn(cfile, "not a valid key name."); + skip_to_semi(cfile); + return 0; + } + freeval = ISC_TRUE; + } + + if (!make_const_data (&t, (const unsigned char *)val, + strlen(val), 1, 1, MDL)) { + log_fatal ("No memory key name"); + } + + if (freeval == ISC_TRUE) { + dfree((char *)val, MDL); + freeval = ISC_FALSE; + } + break; + case 'N': f = (*fmt) + 1; g = strchr (*fmt, '.'); diff --git a/common/tables.c b/common/tables.c index 559793ed..80dd2298 100644 --- a/common/tables.c +++ b/common/tables.c @@ -85,10 +85,14 @@ HASH_FUNCTIONS (option_code, const unsigned *, struct option, the name of the set of enumeration values to parse or emit, followed by a '.'. The width of the data is specified in the named enumeration. Named enumerations are tracked in parse.c. - d - Domain name (i.e., FOO or FOO.BAR). - D - Domain list (i.e., example.com eng.example.com) + d - Domain name (e.g., FOO or FOO.BAR) no quotes, + on-wire format is RFC 1035. + D - Domain list (e.g., "example.com eng.example.com") quoted, + on-wire format is RFC 1035. c - When following a 'D' atom, enables compression pointers. Z - Zero-length option + k - Key name, unquoted string (e.g. mykey.com or some-text or abc123) + parsed with parse_host_name(). */ struct universe dhcp_universe; diff --git a/server/stables.c b/server/stables.c index 7e4fbc03..d58b604f 100644 --- a/server/stables.c +++ b/server/stables.c @@ -210,7 +210,7 @@ static struct option server_options[] = { { "limited-broadcast-address", "I", &server_universe, 33, 1 }, { "remote-port", "S", &server_universe, 34, 1 }, { "local-address", "I", &server_universe, 35, 1 }, - { "omapi-key", "t", &server_universe, 36, 1 }, + { "omapi-key", "k", &server_universe, 36, 1 }, { "stash-agent-options", "f", &server_universe, 37, 1 }, { "ddns-ttl", "T", &server_universe, 38, 1 }, { "ddns-update-style", "Nddns-styles.", &server_universe, 39, 1 }, |