]> git.ipfire.org Git - thirdparty/kea.git/commitdiff
[#3831] Checkpoint: fixes
authorFrancis Dupont <fdupont@isc.org>
Thu, 15 May 2025 19:01:23 +0000 (21:01 +0200)
committerFrancis Dupont <fdupont@isc.org>
Fri, 16 May 2025 21:08:02 +0000 (23:08 +0200)
src/bin/agent/tests/ca_controller_unittests.cc
src/bin/dhcp4/ctrl_dhcp4_srv.cc
src/bin/dhcp6/ctrl_dhcp6_srv.cc
src/lib/process/d_controller.cc
src/lib/process/daemon.cc

index 17b82b192c90d8c266d53e88f235ff83bcdcf7db..df7c74708767ca035812d934fa9614a952c75cb5 100644 (file)
@@ -828,6 +828,9 @@ TEST_F(CtrlAgentControllerTest, configWrite) {
     // Now clean up after ourselves.
     ctrl->registerCommands();
 
+    // Add a config file.
+    ctrl->setConfigFile(string(TEST_DATA_BUILDDIR) + string("/config.json"));
+
     // First, build the command:
     string file = string(TEST_DATA_BUILDDIR) + string("/config-write.json");
     string cmd_txt = "{ \"command\": \"config-write\" }";
index 9cf49e47cb75334eeced66f5fbe47358af50536b..7bd7722abbb5fe49dc95b59d98971cc376f6cc1c 100644 (file)
@@ -298,9 +298,10 @@ ControlledDhcpv4Srv::commandConfigWriteHandler(const string&,
         try {
             checkWriteConfigFile(filename);
         } catch (const isc::Exception& ex) {
-            return (createAnswer(CONTROL_RESULT_ERROR,
-                                 string("not allowed to write config into ") +
-                                 filename));
+            std::ostringstream msg;
+            msg << "not allowed to write config into " << filename
+                << ": " << ex.what();
+            return (createAnswer(CONTROL_RESULT_ERROR, msg.str()));
         }
     }
 
index 304c083b8fd0ca7b8786ce87a41f142113929dd2..884ef8fa0e13b7d73f32e673f9d2287ca3a86588 100644 (file)
@@ -301,9 +301,10 @@ ControlledDhcpv6Srv::commandConfigWriteHandler(const string&,
         try {
             checkWriteConfigFile(filename);
         } catch (const isc::Exception& ex) {
-            return (createAnswer(CONTROL_RESULT_ERROR,
-                                 string("not allowed to write config into ") +
-                                 filename));
+            std::ostringstream msg;
+            msg << "not allowed to write config into " << filename
+                << ": " << ex.what();
+            return (createAnswer(CONTROL_RESULT_ERROR, msg.str()));
         }
     }
 
index a535ffb65bed76394f1208309632a1f665775dc0..f86b73220b4b38b4f0092af4d11341c084cdbac0 100644 (file)
@@ -512,9 +512,10 @@ DControllerBase::configWriteHandler(const std::string&,
         try {
             checkWriteConfigFile(filename);
         } catch (const isc::Exception& ex) {
-            return (createAnswer(CONTROL_RESULT_ERROR,
-                                 std::string("not allowed to write config into ") +
-                                 filename));
+            std::ostringstream msg;
+            msg << "not allowed to write config into " << filename
+                << ": " << ex.what();
+            return (createAnswer(CONTROL_RESULT_ERROR, msg.str()));
         }
     }
 
index fdd66128df81c8be31b8dfc3c2884977eb7cca52..e5d517979fa8c0f51a10af15b702f7e77ad65815 100644 (file)
@@ -144,7 +144,7 @@ Daemon::checkWriteConfigFile(std::string& file) {
         return;
     }
     isc_throw(isc::BadValue, "file " << file << " must be in the same "
-              << "directory as the config file (" << config_file_ << "'");
+              << "directory as the config file (" << config_file_ << ")");
 }
 
 std::string