]> git.ipfire.org Git - thirdparty/kea.git/commitdiff
[3589] CfgOptionDef::copy overrides old configuration.
authorMarcin Siodelski <marcin@isc.org>
Wed, 1 Oct 2014 09:38:35 +0000 (11:38 +0200)
committerMarcin Siodelski <marcin@isc.org>
Wed, 1 Oct 2014 09:38:35 +0000 (11:38 +0200)
src/lib/dhcpsrv/cfg_option_def.cc
src/lib/dhcpsrv/cfg_option_def.h

index 00e73ff11d30ee105a881e1c45eb8df195d45bbb..130a9ee102c66e414833043134d624aed7fd8084 100644 (file)
@@ -22,6 +22,8 @@ namespace dhcp {
 
 void
 CfgOptionDef::copyTo(CfgOptionDef& new_config) const {
+    // Remove any existing option definitions from the destination.
+    new_config.option_definitions_.clearItems();
     const std::list<std::string>& names =
         option_definitions_.getOptionSpaceNames();
     for (std::list<std::string>::const_iterator name = names.begin();
index fadc8b6d4434025196b758319f5adaa808501670..09932acfd237130f45545c15c15d9d8e6aa15675 100644 (file)
@@ -43,11 +43,6 @@ public:
     /// to an object passed as parameter. There are no shared objects or
     /// pointers between the original object and a copy.
     ///
-    /// @warning This function doesn't perform a cleanup of the @c new_config
-    /// before copying the new configuration into it. It is caller's
-    /// responsibility to make sure that this object doesn't contain any
-    /// garbage data.
-    ///
     /// @param [out] new_config An object to which the configuration will be
     /// copied.
     void copyTo(CfgOptionDef& new_config) const;