summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Markwalder <tmark@isc.org>2019-12-17 13:59:24 -0500
committerThomas Markwalder <tmark@isc.org>2019-12-17 13:59:24 -0500
commit9a2f9db55fc4024f5bc7799161752eea77e8290c (patch)
tree6c5bd2d6588fa34e05d0db0087387478fd180846
parent79cfe1acf3ddc85708f47bb2b6ff031aed7199e3 (diff)
downloadisc-dhcp-9a2f9db55fc4024f5bc7799161752eea77e8290c.tar.gz
[master] Implement and use new option format type 'k'
Merges in #68.
-rw-r--r--RELNOTES7
-rw-r--r--common/options.c5
-rw-r--r--common/parse.c28
-rw-r--r--common/tables.c8
-rwxr-xr-xconfigure2
-rw-r--r--configure.ac2
-rw-r--r--configure.ac+lt2
-rw-r--r--configure.ac-base2
-rw-r--r--configure.ac-lt2
-rw-r--r--server/ldap.c11
-rw-r--r--server/stables.c6
11 files changed, 59 insertions, 16 deletions
diff --git a/RELNOTES b/RELNOTES
index d0b6eb3b..97edb024 100644
--- a/RELNOTES
+++ b/RELNOTES
@@ -225,6 +225,13 @@ by Eric Young (eay@cryptsoft.com).
values (e.g. next-server).
[Gitlab #28]
+- 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
+ was changed to comply with RFC 1035 wire format (see Gitlab #2).
+ [Gitlab #68]
+
Changes since 4.4.0 (New Features)
- none
Changes since 4.4.0 (Bug Fixes)
diff --git a/common/options.c b/common/options.c
index 4e1fe99e..a7ed84c6 100644
--- a/common/options.c
+++ b/common/options.c
@@ -1631,6 +1631,7 @@ format_has_text(format)
while (*p != '\0') {
switch (*p++) {
case 't':
+ case 'k':
return 1;
/* These symbols are arbitrary, not fixed or
@@ -1762,6 +1763,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. */
@@ -1903,7 +1905,9 @@ 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;
@@ -2047,6 +2051,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 8619f852..386a6321 100644
--- a/common/parse.c
+++ b/common/parse.c
@@ -5058,7 +5058,33 @@ 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 c1aa2145..6952bc0f 100644
--- a/common/tables.c
+++ b/common/tables.c
@@ -84,10 +84,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/configure b/configure
index 3e2af118..fb60de60 100755
--- a/configure
+++ b/configure
@@ -5591,7 +5591,7 @@ fi
# Testing section
# Bind Makefile needs to know ATF is not included.
- if 0; then
+ if test "foo" = "barr"; then
BIND_ATF_TRUE=
BIND_ATF_FALSE='#'
else
diff --git a/configure.ac b/configure.ac
index c401d393..c5d88f70 100644
--- a/configure.ac
+++ b/configure.ac
@@ -250,7 +250,7 @@ fi
# Testing section
# Bind Makefile needs to know ATF is not included.
-AM_CONDITIONAL(BIND_ATF, 0)
+AM_CONDITIONAL(BIND_ATF, test "foo" = "barr")
DISTCHECK_ATF_CONFIGURE_FLAG=
atf_path="no"
diff --git a/configure.ac+lt b/configure.ac+lt
index 44e2517d..2dc3231e 100644
--- a/configure.ac+lt
+++ b/configure.ac+lt
@@ -251,7 +251,7 @@ fi
# Testing section
# Bind Makefile needs to know ATF is not included.
-AM_CONDITIONAL(BIND_ATF, 0)
+AM_CONDITIONAL(BIND_ATF, test "foo" = "barr")
DISTCHECK_ATF_CONFIGURE_FLAG=
atf_path="no"
diff --git a/configure.ac-base b/configure.ac-base
index bcc3546a..864c1cdb 100644
--- a/configure.ac-base
+++ b/configure.ac-base
@@ -256,7 +256,7 @@ fi
# Testing section
# Bind Makefile needs to know ATF is not included.
-AM_CONDITIONAL(BIND_ATF, 0)
+AM_CONDITIONAL(BIND_ATF, test "foo" = "barr")
DISTCHECK_ATF_CONFIGURE_FLAG=
atf_path="no"
diff --git a/configure.ac-lt b/configure.ac-lt
index c401d393..c5d88f70 100644
--- a/configure.ac-lt
+++ b/configure.ac-lt
@@ -250,7 +250,7 @@ fi
# Testing section
# Bind Makefile needs to know ATF is not included.
-AM_CONDITIONAL(BIND_ATF, 0)
+AM_CONDITIONAL(BIND_ATF, test "foo" = "barr")
DISTCHECK_ATF_CONFIGURE_FLAG=
atf_path="no"
diff --git a/server/ldap.c b/server/ldap.c
index 46b13d00..8e80d5b5 100644
--- a/server/ldap.c
+++ b/server/ldap.c
@@ -1137,7 +1137,7 @@ _do_lookup_dhcp_int_option (struct option_state *options, int option_name)
{
struct option_cache *oc;
struct data_string db;
- int ret;
+ int ret = 0;
memset (&db, 0, sizeof (db));
oc = lookup_option (&server_universe, options, option_name);
@@ -1147,13 +1147,14 @@ _do_lookup_dhcp_int_option (struct option_state *options, int option_name)
(struct client_state *) NULL, options,
(struct option_state *) NULL,
&global_scope, oc, MDL) &&
- db.data != NULL && *db.data != '\0')
+ db.data != NULL)
{
- ret = strtol ((const char *) db.data, NULL, 10);
+ if (db.len == 4) {
+ ret = getULong(db.data);
+ }
+
data_string_forget (&db, MDL);
}
- else
- ret = 0;
return (ret);
}
diff --git a/server/stables.c b/server/stables.c
index d0d9fc36..43408c55 100644
--- a/server/stables.c
+++ b/server/stables.c
@@ -211,7 +211,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 },
@@ -241,7 +241,7 @@ static struct option server_options[] = {
#endif
#if defined(LDAP_CONFIGURATION)
{ "ldap-server", "t", &server_universe, 60, 1 },
- { "ldap-port", "d", &server_universe, 61, 1 },
+ { "ldap-port", "L", &server_universe, 61, 1 },
{ "ldap-username", "t", &server_universe, 62, 1 },
{ "ldap-password", "t", &server_universe, 63, 1 },
{ "ldap-base-dn", "t", &server_universe, 64, 1 },
@@ -259,7 +259,7 @@ static struct option server_options[] = {
{ "ldap-tls-crlcheck", "Nldap-tls-crlcheck.", &server_universe, 75, 1 },
{ "ldap-tls-ciphers", "t", &server_universe, 76, 1 },
{ "ldap-tls-randfile", "t", &server_universe, 77, 1 },
- { "ldap-init-retry", "d", &server_universe, SV_LDAP_INIT_RETRY, 1 },
+ { "ldap-init-retry", "L", &server_universe, SV_LDAP_INIT_RETRY, 1 },
#endif /* LDAP_USE_SSL */
#if defined(LDAP_USE_GSSAPI)
{ "ldap-gssapi-keytab", "t", &server_universe, SV_LDAP_GSSAPI_KEYTAB, 1},