]> git.ipfire.org Git - thirdparty/pdns.git/commitdiff
Make rec_control get-parameter print something that is a valid old-style setting
authorOtto Moerbeek <otto.moerbeek@open-xchange.com>
Tue, 28 Oct 2025 09:52:23 +0000 (10:52 +0100)
committerOtto Moerbeek <otto.moerbeek@open-xchange.com>
Tue, 4 Nov 2025 12:40:38 +0000 (13:40 +0100)
In particular, quotes and escaping is not handled by the old-style settings parser

Signed-off-by: Otto Moerbeek <otto.moerbeek@open-xchange.com>
pdns/recursordist/rec_channel_rec.cc

index c9dcc86836af1cf551f79b6e5253798a19385e25..51782812cc217d06cbda735a3d1f049e707e7fbf 100644 (file)
@@ -297,22 +297,18 @@ static Answer doGet(ArgIterator begin, ArgIterator end)
 
 static Answer doGetParameter(ArgIterator begin, ArgIterator end)
 {
-  string ret;
-  string parm;
-  using boost::replace_all;
+  std::stringstream ret;
+
   for (auto i = begin; i != end; ++i) {
     if (::arg().parmIsset(*i)) {
-      parm = ::arg()[*i];
-      replace_all(parm, "\\", "\\\\");
-      replace_all(parm, "\"", "\\\"");
-      replace_all(parm, "\n", "\\n");
-      ret += *i + "=\"" + parm + "\"\n";
+      const auto& parm = arg()[*i];
+      ret << *i << '=' << parm << endl;
     }
     else {
-      ret += *i + " not known\n";
+      ret << *i << " not known" << endl;
     }
   }
-  return {0, std::move(ret)};
+  return {0, ret.str()};
 }
 
 /* Read an (open) fd from the control channel */