diff options
author | Shawn Routhier <sar@isc.org> | 2014-04-28 14:56:19 -0700 |
---|---|---|
committer | Shawn Routhier <sar@isc.org> | 2014-04-28 14:56:19 -0700 |
commit | 3820f50b5dd1c31ccd52de926b9f12b1aceb1036 (patch) | |
tree | fe0a337a83dd0229da30f70bb54a5abc55017c14 /common | |
parent | f7ab0b62e9eb22ec80f176533d7a9e26803c2155 (diff) | |
download | isc-dhcp-3820f50b5dd1c31ccd52de926b9f12b1aceb1036.tar.gz |
[v4_2] Add a better warning about multiple key definitions
Diffstat (limited to 'common')
-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 db2e1d0d..5333704f 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 | |