From: Otto Moerbeek Date: Tue, 28 Oct 2025 09:52:23 +0000 (+0100) Subject: Make rec_control get-parameter print something that is a valid old-style setting X-Git-Tag: rec-5.4.0-alpha1~108^2~10 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=59f77e10a40f94d14c3b90e027d0bd0057eea181;p=thirdparty%2Fpdns.git 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 --- 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 */