summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Markwalder <tmark@isc.org>2019-12-17 19:05:42 +0000
committerThomas Markwalder <tmark@isc.org>2019-12-17 19:05:42 +0000
commitf5a80c510272dc7e9772e2e26d905cb1bbce5cb1 (patch)
treef95d4c646af293240babbe0002ba9ee5c10b35c9
parent48e431b9f0e0058453387810a3878491c6e879ee (diff)
downloadisc-dhcp-f5a80c510272dc7e9772e2e26d905cb1bbce5cb1.tar.gz
[v4_1_esv] Implement and use new option format type 'k'
Merges in #68.
-rw-r--r--RELNOTES6
-rw-r--r--common/options.c4
-rw-r--r--common/parse.c27
-rw-r--r--common/tables.c8
-rw-r--r--server/stables.c2
5 files changed, 43 insertions, 4 deletions
diff --git a/RELNOTES b/RELNOTES
index b1392b5f..c1303d37 100644
--- a/RELNOTES
+++ b/RELNOTES
@@ -90,6 +90,12 @@ 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 was changed to a
+ format type 'k' (key name); while server options ldap-port and
+ ldap-init-retry were changed to 'L' (unsigned 32-bit integer). These
+ three options were inadvertantly broken when the 'd' format content
+ [Gitlab #68]
+
Changes since 4.1-ESV-R15
- Corrected dhclient command line parsing for --dad-wait-time that causes
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 d2bea442..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", "d", &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 },