]> git.ipfire.org Git - thirdparty/pdns.git/commitdiff
Return current rcode instead of 0 if there are no CNAME records to follow. 10226/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, 26 Mar 2021 09:41:31 +0000 (10:41 +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...

(cherry picked from commit 558d47eba7d2edd3fb5991af428d9d432fec1dfa)

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

index 1bfb865eeb543db6865e3199c57376eb1179c4b4..b6b30c22958578ecb6cdc46d65af9e2f4e9b408d 100644 (file)
@@ -658,7 +658,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 99a19520683a622fad8c6ff97b3a28ab65147d95..a20a47b6cc30a21d7e446495a23f290fe8d37255 100644 (file)
@@ -1164,7 +1164,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;
@@ -1179,10 +1179,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));
@@ -1508,7 +1508,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 80a2e6dc86f4c603d00d1e8393c865b1c52006b7..3b91b35b821af2ff7c5c85686cf67ac7d323025e 100644 (file)
@@ -1109,7 +1109,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);