]> git.ipfire.org Git - thirdparty/kea.git/commitdiff
[#2947] Bug fixed
authorFrancis Dupont <fdupont@isc.org>
Wed, 28 Jun 2023 14:51:57 +0000 (16:51 +0200)
committerFrancis Dupont <fdupont@isc.org>
Thu, 29 Jun 2023 13:45:26 +0000 (15:45 +0200)
src/bin/dhcp4/json_config_parser.cc
src/bin/dhcp6/json_config_parser.cc
src/lib/config/base_command_mgr.cc
src/lib/config/base_command_mgr.h

index 0de041bdf4adc0d8060b6e5205d668a97383f777..b62bbe116f6e2e9e41973d94056090ea5a758ba2 100644 (file)
@@ -974,8 +974,9 @@ configureDhcp4Server(Dhcpv4Srv& server, isc::data::ConstElementPtr config_set,
         .arg(CfgMgr::instance().getStagingCfg()->
              getConfigSummary(SrvConfig::CFGSEL_ALL4));
 
-    // Also calculate SHA256 hash of the config that was just set and append it to the response.
-    ElementPtr config = CfgMgr::instance().getCurrentCfg()->toElement();
+    // Also calculate SHA256 hash of the config that was just set and
+    // append it to the response.
+    ConstElementPtr config = CfgMgr::instance().getStagingCfg()->toElement();
     string hash = BaseCommandMgr::getHash(config);
     ElementPtr hash_map = Element::createMap();
     hash_map->set("hash", Element::create(hash));
index c8fbfc79be71a119dd2f8b9de163a4d0c454b8ec..337371c22323ed4ff380b348c86fbb0deff14188 100644 (file)
@@ -1099,8 +1099,9 @@ configureDhcp6Server(Dhcpv6Srv& server, isc::data::ConstElementPtr config_set,
         .arg(CfgMgr::instance().getStagingCfg()->
              getConfigSummary(SrvConfig::CFGSEL_ALL6));
 
-    // Also calculate SHA256 hash of the config that was just set and append it to the response.
-    ElementPtr config = CfgMgr::instance().getCurrentCfg()->toElement();
+    // Also calculate SHA256 hash of the config that was just set and
+    // append it to the response.
+    ConstElementPtr config = CfgMgr::instance().getStagingCfg()->toElement();
     string hash = BaseCommandMgr::getHash(config);
     ElementPtr hash_map = Element::createMap();
     hash_map->set("hash", Element::create(hash));
index 5a7591c735f5d258a8cabfd685b77e9870c91781..d2d7201da64fea811164fd1fdbb12e8c2b317ecf 100644 (file)
@@ -1,4 +1,4 @@
-// Copyright (C) 2017-2022 Internet Systems Consortium, Inc. ("ISC")
+// Copyright (C) 2017-2023 Internet Systems Consortium, Inc. ("ISC")
 //
 // This Source Code Form is subject to the terms of the Mozilla Public
 // License, v. 2.0. If a copy of the MPL was not distributed with this
@@ -191,7 +191,7 @@ BaseCommandMgr::listCommandsHandler(const std::string& /* name */,
 }
 
 std::string
-BaseCommandMgr::getHash(isc::data::ElementPtr& config) {
+BaseCommandMgr::getHash(const isc::data::ConstElementPtr& config) {
 
     // First, get the string representation.
     std::string config_txt = config->str();
index 28bad8dc98a650c5e27f992607b66947d5186e00..916eebcc0fd93ed075e0d0b9753c444d9967c410 100644 (file)
@@ -1,4 +1,4 @@
-// Copyright (C) 2017-2020 Internet Systems Consortium, Inc. ("ISC")
+// Copyright (C) 2017-2023 Internet Systems Consortium, Inc. ("ISC")
 //
 // This Source Code Form is subject to the terms of the Mozilla Public
 // License, v. 2.0. If a copy of the MPL was not distributed with this
@@ -155,11 +155,12 @@ public:
 
     /// @brief returns a hash of a given Element structure
     ///
-    /// The hash is currently implemented as SHA256 on the string represenation of the structure.
+    /// The hash is currently implemented as SHA256 on the string
+    // representation of the structure.
     ///
     /// @param config typically full config, but hash can be calculated on any structure
-    /// @return string representation
-    static std::string getHash(isc::data::ElementPtr& config);
+    /// @return hash of string representation
+    static std::string getHash(const isc::data::ConstElementPtr& config);
 
 protected: