From 2178df03e7741c449ec5e49b980ef23300dede82 Mon Sep 17 00:00:00 2001 From: David Hankins Date: Thu, 20 Jul 2006 16:04:03 +0000 Subject: [PATCH] - Host declaration hardware addresses and client identifiers may only be configured once. dhcpd will now fail to load config files that specify multiple identifiers (previous versions would silently over-ride the value with the later configured value). [ISC-Bugs #15533] --- RELNOTES | 5 +++++ server/confpars.c | 16 +++++++++++++++- 2 files changed, 20 insertions(+), 1 deletion(-) diff --git a/RELNOTES b/RELNOTES index a2e377c58..f44dc64e4 100644 --- a/RELNOTES +++ b/RELNOTES @@ -193,6 +193,11 @@ and for prodding me into improving it. encountering non-retryable errors during writing) lease file should no longer result in an infinite recursion. +- Host declaration hardware addresses and client identifiers may only be + configured once. dhcpd will now fail to load config files that specify + multiple identifiers (previous versions would silently over-ride the + value with the later configured value). + Changes since 3.0.4rc1 - The dhcp-options.5 manpage was updated to correct indentation errors diff --git a/server/confpars.c b/server/confpars.c index 06c74cf55..a8907e708 100644 --- a/server/confpars.c +++ b/server/confpars.c @@ -34,7 +34,7 @@ #ifndef lint static char copyright[] = -"$Id: confpars.c,v 1.157 2006/06/16 19:26:44 dhankins Exp $ Copyright (c) 2004-2006 Internet Systems Consortium. All rights reserved.\n"; +"$Id: confpars.c,v 1.158 2006/07/20 16:04:03 dhankins Exp $ Copyright (c) 2004-2006 Internet Systems Consortium. All rights reserved.\n"; #endif /* not lint */ #include "dhcpd.h" @@ -515,6 +515,13 @@ int parse_statement (cfile, group, type, host_decl, declaration) case HARDWARE: next_token (&val, (unsigned *)0, cfile); memset (&hardware, 0, sizeof hardware); + if (host_decl && memcmp(&hardware, &(host_decl->interface), + sizeof(hardware)) != 0) { + parse_warn(cfile, "Host %s hardware address already " + "configured.", host_decl->name); + break; + } + parse_hardware_param (cfile, &hardware); if (host_decl) host_decl -> interface = hardware; @@ -1765,6 +1772,13 @@ void parse_host_declaration (cfile, group) token = next_token (&val, (unsigned *)0, cfile); data_string_forget (&host -> client_identifier, MDL); + if (host->client_identifier.len != 0) { + parse_warn(cfile, "Host %s already has a " + "client identifier.", + host->name); + break; + } + /* See if it's a string or a cshl. */ token = peek_token (&val, (unsigned *)0, cfile); if (token == STRING) { -- 2.47.3