From 1365807195bf3a2d14b8c5559b456a2e0215da43 Mon Sep 17 00:00:00 2001 From: Rafael Buchbinder Date: Wed, 17 Oct 2018 09:48:28 +0300 Subject: [PATCH] pdns-recursor: properly handle exceptions thrown from lua-recursor4 directResolve function is used by lua-recursor4 in various callbacks. As a result an exception thrown from this function is caught in generic exception handlers at the end of startDoResolve (pdns_recursor). Specifically, ImmediateServFailException is caught in the catch-all exception handler, which obscures the origin of the error. This commit adds handling of all exceptions inside directResolve and converts them to error code (-1). This way, an exception in this function is handled properly in startDoResolve and ServFail is sent downstream. To clarify, in case of exception the return DNSRecord vector is cleared to make sure that old behavior is preserved, when in case of exception the vector was not referenced in any way. --- pdns/syncres.cc | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/pdns/syncres.cc b/pdns/syncres.cc index ec3cf531b..f90a5c2cd 100644 --- a/pdns/syncres.cc +++ b/pdns/syncres.cc @@ -2902,7 +2902,26 @@ int directResolve(const DNSName& qname, const QType& qtype, int qclass, vector