]> git.ipfire.org Git - thirdparty/kea.git/commitdiff
[#27,!138] Guard against null host in cql host data source.
authorMarcin Siodelski <marcin@isc.org>
Tue, 27 Nov 2018 21:00:38 +0000 (22:00 +0100)
committerMarcin Siodelski <marcin@isc.org>
Wed, 28 Nov 2018 08:38:23 +0000 (03:38 -0500)
src/lib/dhcpsrv/cql_host_data_source.cc

index c70055a9dc896c887ee824acc685324454b27504..6f7648ebef3d04c22af35f6741cbafcd7ae7a7e5 100644 (file)
@@ -1621,6 +1621,11 @@ CqlHostDataSourceImpl::~CqlHostDataSourceImpl() {
 
 bool
 CqlHostDataSourceImpl::insertOrDelete(const HostPtr& host, bool insert) {
+    // If there is no host, there is nothing to do.
+    if (!host) {
+        return (false);
+    }
+
     // Get option space names and vendor space names and combine them within a
     // single list.
 
@@ -1859,6 +1864,11 @@ CqlHostDataSourceImpl::insertOrDeleteHostWithOptions(bool insert,
                                                      const IPv6Resrv* const reservation,
                                                      const std::list<std::string>& option_spaces,
                                                      const ConstCfgOptionPtr cfg_option) {
+    // If there is no host, there is nothing to do.
+    if (!host) {
+        return (false);
+    }
+
     bool result = true;
 
     // For each option space retrieve all options and insert them into
@@ -1897,6 +1907,11 @@ CqlHostDataSourceImpl::insertOrDeleteHostWithReservations(bool insert,
                                                           const ConstCfgOptionPtr cfg_option4,
                                                           const std::list<std::string>& option_spaces6,
                                                           const ConstCfgOptionPtr cfg_option6) {
+    // If there is no host, there is nothing to do.
+    if (!host) {
+        return (false);
+    }
+
     bool result = true;
 
     // If host has no reservation, add entries with null reservation.
@@ -1979,6 +1994,11 @@ CqlHostDataSourceImpl::insertOrDeleteHost(bool insert,
                                           const IPv6Resrv* const reservation,
                                           const std::string& option_space,
                                           const OptionDescriptor& option_descriptor) {
+    // If there is no host, there is nothing to do.
+    if (!host) {
+        return (false);
+    }
+
     AnyArray assigned_values;
 
     std::unique_ptr<CqlHostExchange> host_exchange(new CqlHostExchange());