]> git.ipfire.org Git - thirdparty/pdns.git/commitdiff
Return current rcode instead of 0 if there are no CNAME records to follow. 10064/head
authorOtto <otto.moerbeek@open-xchange.com>
Fri, 5 Feb 2021 15:18:55 +0000 (16:18 +0100)
committerOtto <otto.moerbeek@open-xchange.com>
Fri, 5 Feb 2021 15:18:55 +0000 (16:18 +0100)
Note that this is a change in behaviour. While it is for the good, it might
be existing code depends on the old 0 value...

pdns/lua-recursor4.cc
pdns/pdns_recursor.cc
pdns/syncres.hh

index 2e742cd5494aa2ac2b72a5435f79c1cebb2af5fd..d2f57f791888891e743262dc53fc9f03a793281a 100644 (file)
@@ -664,7 +664,7 @@ loop:;
     
     if(!dq.followupFunction.empty()) {
       if(dq.followupFunction=="followCNAMERecords") {
-        ret = followCNAMERecords(dq.records, QType(dq.qtype));
+        ret = followCNAMERecords(dq.records, QType(dq.qtype), ret);
       }
       else if(dq.followupFunction=="getFakeAAAARecords") {
         ret=getFakeAAAARecords(dq.followupName, ComboAddress(dq.followupPrefix), dq.records);
index 66fc158d2f8107fb5bb1ad3884ebde31f5f2a38e..3e4348caff457ea3fff97bc1b5f072bf6bf42b29 100644 (file)
@@ -1352,7 +1352,7 @@ static bool udrCheckUniqueDNSRecord(const DNSName& dname, uint16_t qtype, const
 }
 #endif /* NOD_ENABLED */
 
-int followCNAMERecords(vector<DNSRecord>& ret, const QType& qtype)
+int followCNAMERecords(vector<DNSRecord>& ret, const QType& qtype, int rcode)
 {
   vector<DNSRecord> resolved;
   DNSName target;
@@ -1367,10 +1367,10 @@ int followCNAMERecords(vector<DNSRecord>& ret, const QType& qtype)
   }
 
   if(target.empty()) {
-    return 0;
+    return rcode;
   }
 
-  int rcode = directResolve(target, qtype, QClass::IN, resolved);
+  rcode = directResolve(target, qtype, QClass::IN, resolved);
 
   for(DNSRecord& rr :  resolved) {
     ret.push_back(std::move(rr));
@@ -1691,7 +1691,7 @@ static void startDoResolve(void *p)
         ret = std::move(dc->d_records);
         res = *dc->d_rcode;
         if (res == RCode::NoError && dc->d_followCNAMERecords) {
-          res = followCNAMERecords(ret, QType(dc->d_mdp.d_qtype));
+          res = followCNAMERecords(ret, QType(dc->d_mdp.d_qtype), res);
         }
         goto haveAnswer;
       }
index 2a7c8d9d61d59e1fbc3456cf7414cadc919349c2..5bb8821ae571383dc1ee0a90b53a94e1afb43260 100644 (file)
@@ -1094,7 +1094,7 @@ void broadcastFunction(const pipefunc_t& func);
 void distributeAsyncFunction(const std::string& question, const pipefunc_t& func);
 
 int directResolve(const DNSName& qname, const QType& qtype, int qclass, vector<DNSRecord>& ret);
-int followCNAMERecords(std::vector<DNSRecord>& ret, const QType& qtype);
+int followCNAMERecords(std::vector<DNSRecord>& ret, const QType& qtype, int oldret);
 int getFakeAAAARecords(const DNSName& qname, ComboAddress prefix, vector<DNSRecord>& ret);
 int getFakePTRRecords(const DNSName& qname, vector<DNSRecord>& ret);