From: Francis Dupont Date: Fri, 19 Jun 2015 09:14:36 +0000 (+0200) Subject: [3697] Ported the proposed patch to DHCPv4 X-Git-Tag: trac3910_base~14^2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=5e490e86eb2c93a46ef912e99a3ad2a80231c02b;p=thirdparty%2Fkea.git [3697] Ported the proposed patch to DHCPv4 --- diff --git a/src/bin/dhcp4/kea_controller.cc b/src/bin/dhcp4/kea_controller.cc index 43e5e33011..fc3913dd2c 100644 --- a/src/bin/dhcp4/kea_controller.cc +++ b/src/bin/dhcp4/kea_controller.cc @@ -65,6 +65,17 @@ void configure(const std::string& file_name) { isc_throw(isc::BadValue, "no configuration found"); } + // Let's do sanity check before we call json->get() which + // works only for map. + if (json->getType() != isc::data::Element::map) { + isc_throw(isc::BadValue, "Configuration file is expected to be " + "a map, i.e., start with { and end with } and contain " + "at least an entry called 'Dhcp4' that itself is a map. " + << file_name + << " is a valid JSON, but its top element is not a map." + " Did you forget to add { } around your configuration?"); + } + // If there's no logging element, we'll just pass NULL pointer, // which will be handled by configureLogger(). Daemon::configureLogger(json->get("Logging"),