rec: Set the result to NoError before calling `preresolve`
authorRemi Gacogne <remi.gacogne@powerdns.com>
Tue, 13 Dec 2016 15:21:17 +0000 (16:21 +0100)
committerRemi Gacogne <remi.gacogne@powerdns.com>
Tue, 13 Dec 2016 15:21:17 +0000 (16:21 +0100)
Otherwise `rq.rcode` needs to be set explicitly when handling the
query from `preresolve`, which is not documented and wasn't the case
before.

pdns/pdns_recursor.cc

index 8c87337cbdca4a51cb6da9cf4e3f22d9d00e7117..818ecb8b2735ac0762d10a556e2ed2058907ea23 100644 (file)
@@ -740,7 +740,8 @@ void startDoResolve(void *p)
     bool variableAnswer = false;
     bool shouldNotValidate = false;
 
-    int res;
+    /* preresolve expects res (dq.rcode) to be set to RCode::NoError by default */
+    int res = RCode::NoError;
     DNSFilterEngine::Policy appliedPolicy;
     DNSRecord spoofed;
     std::shared_ptr<RecursorLua4::DNSQuestion> dq = nullptr;