diff options
author | Shawn Routhier <sar@isc.org> | 2014-04-28 14:52:37 -0700 |
---|---|---|
committer | Shawn Routhier <sar@isc.org> | 2014-04-28 14:52:37 -0700 |
commit | db3f77999c0c4a6a508ab773f004ceda751541a9 (patch) | |
tree | 1d5b8010d6f8af4d42bf1b5ce24084dc34cec09e /common/parse.c | |
parent | fc48033aa181a4a5bdd34fd3efddea0a70058b31 (diff) | |
download | isc-dhcp-db3f77999c0c4a6a508ab773f004ceda751541a9.tar.gz |
[master] Add a better warning about multiple key definitions
Diffstat (limited to 'common/parse.c')
-rw-r--r-- | common/parse.c | 38 |
1 files changed, 21 insertions, 17 deletions
diff --git a/common/parse.c b/common/parse.c index 38d350f4..2e363c2c 100644 --- a/common/parse.c +++ b/common/parse.c @@ -2872,27 +2872,31 @@ int parse_zone (struct dns_zone *zone, struct parse *cfile) break; case KEY: - skip_token(&val, (unsigned *)0, cfile); - token = peek_token (&val, (unsigned *)0, cfile); + skip_token(&val, NULL, cfile); + token = peek_token(&val, NULL, cfile); if (token == STRING) { - skip_token(&val, (unsigned *)0, cfile); - key_name = (char *)0; + skip_token(&val, NULL, cfile); + key_name = NULL; } else { - key_name = parse_host_name (cfile); + key_name = parse_host_name(cfile); if (!key_name) { - parse_warn (cfile, "expecting key name."); - skip_to_semi (cfile); - return 0; + parse_warn(cfile, "expecting key name."); + skip_to_semi(cfile); + return (0); } val = key_name; } - if (omapi_auth_key_lookup_name (&zone -> key, val) != + if (zone->key) { + log_fatal("Multiple key definitions for zone %s.", + zone->name); + } + if (omapi_auth_key_lookup_name(&zone->key, val) != ISC_R_SUCCESS) - parse_warn (cfile, "unknown key %s", val); + parse_warn(cfile, "unknown key %s", val); if (key_name) - dfree (key_name, MDL); - if (!parse_semi (cfile)) - return 0; + dfree(key_name, MDL); + if (!parse_semi(cfile)) + return (0); break; default: @@ -2901,12 +2905,12 @@ int parse_zone (struct dns_zone *zone, struct parse *cfile) } } while (!done); - token = next_token (&val, (unsigned *)0, cfile); + token = next_token(&val, NULL, cfile); if (token != RBRACE) { - parse_warn (cfile, "expecting right brace."); - return 0; + parse_warn(cfile, "expecting right brace."); + return (0); } - return 1; + return (1); } /* key-statements :== key-statement | |