]> git.ipfire.org Git - thirdparty/kea.git/commitdiff
[5009] Addressed review comments.
authorMarcin Siodelski <marcin@isc.org>
Tue, 20 Sep 2016 13:37:11 +0000 (15:37 +0200)
committerMarcin Siodelski <marcin@isc.org>
Tue, 20 Sep 2016 13:37:11 +0000 (15:37 +0200)
src/lib/dhcpsrv/mysql_host_data_source.cc
src/lib/dhcpsrv/pgsql_host_data_source.cc
src/lib/dhcpsrv/pgsql_lease_mgr.cc

index 927f10a13f5f88fe96c611774a04974c0330acac..2c8123681f1afadd47e4f92d88c8ed601c0b4e76 100644 (file)
@@ -822,6 +822,11 @@ private:
                 space.assign(space_);
             }
 
+            // If empty or null space provided, use a default top level space.
+            if (space.empty()) {
+                space = (universe_ == Option::V4 ? "dhcp4" : "dhcp6");
+            }
+
             // Convert formatted_value to string as well.
             std::string formatted_value;
             if (formatted_value_null_ == MLM_FALSE) {
index cf2094ad4209c0976f3f6ae06d6228f5e43526b2..b1dce8033b6944e5a839805c7a6475c7954a017a 100644 (file)
@@ -506,6 +506,11 @@ private:
                 PgSqlExchange::getColumnValue(r, row, space_index_, space);
             }
 
+            // If empty or null space provided, use a default top level space.
+            if (space.empty()) {
+                space = (universe_ == Option::V4 ? "dhcp4" : "dhcp6");
+            }
+
             // persistent: BOOL default false
             bool persistent;
             PgSqlExchange::getColumnValue(r, row, persistent_index_,
index c8a62d6adee05797494131c7f1769b73be84a195..9d64acdc96022d19c8a2fa2c88ee4fa54803c02a 100644 (file)
@@ -581,6 +581,15 @@ public:
     /// @throw DbOperationError if the lease cannot be created.
     Lease6Ptr convertFromDatabase(const PgSqlResult& r, int row) {
         try {
+
+            /// @todo In theory, an administrator could tweak lease
+            /// information in the database. In this case, some of the
+            /// values could be set to NULL. This is less likely than
+            /// in case of host reservations, but we may consider if
+            /// retrieved values should be checked for being NULL to
+            /// prevent cryptic errors during conversions from NULL
+            /// to actual values.
+
             isc::asiolink::IOAddress addr(getIPv6Value(r, row, ADDRESS_COL));
 
             convertFromBytea(r, row, DUID_COL, duid_buffer_,