From 59f77e10a40f94d14c3b90e027d0bd0057eea181 Mon Sep 17 00:00:00 2001 From: Otto Moerbeek Date: Tue, 28 Oct 2025 10:52:23 +0100 Subject: [PATCH] Make rec_control get-parameter print something that is a valid old-style setting In particular, quotes and escaping is not handled by the old-style settings parser Signed-off-by: Otto Moerbeek --- pdns/recursordist/rec_channel_rec.cc | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/pdns/recursordist/rec_channel_rec.cc b/pdns/recursordist/rec_channel_rec.cc index c9dcc86836..51782812cc 100644 --- a/pdns/recursordist/rec_channel_rec.cc +++ b/pdns/recursordist/rec_channel_rec.cc @@ -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 */ -- 2.47.3