From: Rafael Buchbinder Date: Wed, 17 Oct 2018 06:48:28 +0000 (+0300) Subject: pdns-recursor: properly handle exceptions thrown from lua-recursor4 X-Git-Tag: dnsdist-1.3.3~37^2 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=refs%2Fpull%2F7072%2Fhead;p=thirdparty%2Fpdns.git 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. --- diff --git a/pdns/syncres.cc b/pdns/syncres.cc index ec3cf531bc..f90a5c2cd2 100644 --- a/pdns/syncres.cc +++ b/pdns/syncres.cc @@ -2902,7 +2902,26 @@ int directResolve(const DNSName& qname, const QType& qtype, int qclass, vector