From fbfc18098803295d704c13bee74b88bc680f3a85 Mon Sep 17 00:00:00 2001 From: Remi Gacogne Date: Tue, 19 Mar 2019 16:29:10 +0100 Subject: [PATCH] rec: Prevent an exception in RCC handling from terminating the rec --- pdns/pdns_recursor.cc | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/pdns/pdns_recursor.cc b/pdns/pdns_recursor.cc index 8715b3ba8..b8d1f8ade 100644 --- a/pdns/pdns_recursor.cc +++ b/pdns/pdns_recursor.cc @@ -2979,27 +2979,27 @@ template vector > broadcastAccFunction(const boost::funct static void handleRCC(int fd, FDMultiplexer::funcparam_t& var) { - string remote; - string msg=s_rcc.recv(&remote); - RecursorControlParser rcp; - RecursorControlParser::func_t* command; + try { + string remote; + string msg=s_rcc.recv(&remote); + RecursorControlParser rcp; + RecursorControlParser::func_t* command; - string answer=rcp.getAnswer(msg, &command); + string answer=rcp.getAnswer(msg, &command); - // If we are inside a chroot, we need to strip - if (!arg()["chroot"].empty()) { - size_t len = arg()["chroot"].length(); - remote = remote.substr(len); - } + // If we are inside a chroot, we need to strip + if (!arg()["chroot"].empty()) { + size_t len = arg()["chroot"].length(); + remote = remote.substr(len); + } - try { s_rcc.send(answer, &remote); command(); } - catch(std::exception& e) { + catch(const std::exception& e) { g_log<