Browse Source

[5009] Addressed review comments.

Marcin Siodelski 8 years ago
parent
commit
07fbb6e142

+ 5 - 0
src/lib/dhcpsrv/mysql_host_data_source.cc

@@ -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) {

+ 5 - 0
src/lib/dhcpsrv/pgsql_host_data_source.cc

@@ -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_,

+ 9 - 0
src/lib/dhcpsrv/pgsql_lease_mgr.cc

@@ -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_,