]> granicus.if.org Git - pdns/commitdiff
use toLogString while throwing
authorKees Monshouwer <mind04@monshouwer.org>
Mon, 20 Nov 2017 19:32:00 +0000 (20:32 +0100)
committermind04 <mind04@monshouwer.org>
Mon, 20 Nov 2017 19:32:00 +0000 (20:32 +0100)
16 files changed:
modules/mydnsbackend/mydnsbackend.cc
pdns/bpf-filter.cc
pdns/dbdnsseckeeper.cc
pdns/dnsparser.cc
pdns/dnssecinfra.cc
pdns/ixfr.cc
pdns/recursordist/test-syncres_cc.cc
pdns/reczones.cc
pdns/resolver.cc
pdns/rpzloader.cc
pdns/slavecommunicator.cc
pdns/syncres.cc
pdns/tsigverifier.cc
pdns/validate.cc
pdns/ws-recursor.cc
pdns/zoneparser-tng.cc

index ec521ceb49a2e7b4b085a039efd0b0722683151e..c7e9814cb85ff9955760a9944adb5f37ef0bd658 100644 (file)
@@ -211,7 +211,7 @@ bool MyDNSBackend::getSOA(const DNSName& name, SOAData& soadata) {
       reset();
   }
   catch (SSqlException &e) {
-    throw PDNSException("MyDNSBackend unable to get soa for domain "+name.toString()+": "+e.txtReason());
+    throw PDNSException("MyDNSBackend unable to get soa for domain "+name.toLogString()+": "+e.txtReason());
   }
 
   if (d_result.empty()) {
@@ -269,7 +269,7 @@ void MyDNSBackend::lookup(const QType &qtype, const DNSName &qname, DNSPacket *p
           reset();
       }
       catch (SSqlException &e) {
-        throw PDNSException("MyDNSBackend unable to lookup "+qname.toString()+": "+e.txtReason());
+        throw PDNSException("MyDNSBackend unable to lookup "+qname.toLogString()+": "+e.txtReason());
       }
 
       if (d_result.empty() == false) {
@@ -292,7 +292,7 @@ void MyDNSBackend::lookup(const QType &qtype, const DNSName &qname, DNSPacket *p
         reset();
     }
     catch (SSqlException &e) {
-      throw PDNSException("MyDNSBackend unable to lookup "+qname.toString()+": "+e.txtReason());
+      throw PDNSException("MyDNSBackend unable to lookup "+qname.toLogString()+": "+e.txtReason());
     }
 
     if(d_result.empty()) {
@@ -342,7 +342,7 @@ void MyDNSBackend::lookup(const QType &qtype, const DNSName &qname, DNSPacket *p
       }
     }
     catch (SSqlException &e) {
-      throw PDNSException("MyDNSBackend unable to lookup "+qname.toString()+": "+e.txtReason());
+      throw PDNSException("MyDNSBackend unable to lookup "+qname.toLogString()+": "+e.txtReason());
     }
 
     d_qname = qname.toString();
index 1b5b56a5ab7d2368044aed6fde21cf9600859584..65cf551b361403109d82178cc62ecf6ceebcb7a3 100644 (file)
@@ -294,19 +294,19 @@ void BPFFilter::block(const DNSName& qname, uint16_t qtype)
 
   std::string keyStr = qname.toDNSStringLC();
   if (keyStr.size() > sizeof(key.qname)) {
-    throw std::runtime_error("Invalid QName to block " + qname.toString());
+    throw std::runtime_error("Invalid QName to block " + qname.toLogString());
   }
   memcpy(key.qname, keyStr.c_str(), keyStr.size());
 
   {
     std::unique_lock<std::mutex> lock(d_mutex);
     if (d_qNamesCount >= d_maxQNames) {
-      throw std::runtime_error("Table full when trying to block " + qname.toString());
+      throw std::runtime_error("Table full when trying to block " + qname.toLogString());
     }
 
     int res = bpf_lookup_elem(d_qnamemap.fd, &key, &value);
     if (res != -1) {
-      throw std::runtime_error("Trying to block an already blocked qname: " + qname.toString());
+      throw std::runtime_error("Trying to block an already blocked qname: " + qname.toLogString());
     }
 
     res = bpf_update_elem(d_qnamemap.fd, &key, &value, BPF_NOEXIST);
@@ -315,7 +315,7 @@ void BPFFilter::block(const DNSName& qname, uint16_t qtype)
     }
 
     if (res != 0) {
-      throw std::runtime_error("Error adding blocked qname " + qname.toString() + ": " + std::string(strerror(errno)));
+      throw std::runtime_error("Error adding blocked qname " + qname.toLogString() + ": " + std::string(strerror(errno)));
     }
   }
 }
@@ -327,7 +327,7 @@ void BPFFilter::unblock(const DNSName& qname, uint16_t qtype)
   (void) qtype;
 
   if (keyStr.size() > sizeof(key.qname)) {
-    throw std::runtime_error("Invalid QName to block " + qname.toString());
+    throw std::runtime_error("Invalid QName to block " + qname.toLogString());
   }
   memcpy(key.qname, keyStr.c_str(), keyStr.size());
 
@@ -339,7 +339,7 @@ void BPFFilter::unblock(const DNSName& qname, uint16_t qtype)
       d_qNamesCount--;
     }
     else {
-      throw std::runtime_error("Error removing qname address " + qname.toString() + ": " + std::string(strerror(errno)));
+      throw std::runtime_error("Error removing qname address " + qname.toLogString() + ": " + std::string(strerror(errno)));
     }
   }
 }
index aca1b38d38a15669740a96ad27933190d2b8ded8..7f677f5218728cd59a0e9875e4ca170495cc0d0b 100644 (file)
@@ -169,7 +169,7 @@ DNSSECPrivateKey DNSSECKeeper::getKeyById(const DNSName& zname, unsigned int id)
     
     return dpk;    
   }
-  throw runtime_error("Can't find a key with id "+std::to_string(id)+" for zone '"+zname.toString()+"'");
+  throw runtime_error("Can't find a key with id "+std::to_string(id)+" for zone '"+zname.toLogString()+"'");
 }
 
 
@@ -321,7 +321,7 @@ bool DNSSECKeeper::setNSEC3PARAM(const DNSName& zname, const NSEC3PARAMRecordCon
 {
   string error_msg = "";
   if (!checkNSEC3PARAM(ns3p, error_msg))
-    throw runtime_error("NSEC3PARAMs provided for zone '"+zname.toString()+"' are invalid: " + error_msg);
+    throw runtime_error("NSEC3PARAMs provided for zone '"+zname.toLogString()+"' are invalid: " + error_msg);
 
   clearCaches(zname);
   string descr = ns3p.getZoneRepresentation();
index 52fca0ef132482be7462fb2572c6edb7a2fbb28b..70d6d93916de7291bd1b6a24728ae054f4ecbdb6 100644 (file)
@@ -297,7 +297,7 @@ void MOADNSParser::init(bool query, const char *packet, unsigned int len)
 
       if(dr.d_type == QType::TSIG && dr.d_class == QClass::ANY) {
         if(dr.d_place != DNSResourceRecord::ADDITIONAL || n != (unsigned int)(d_header.ancount + d_header.nscount + d_header.arcount) - 1) {
-          throw MOADNSException("Packet ("+d_qname.toString()+"|#"+std::to_string(d_qtype)+") has a TSIG record in an invalid position.");
+          throw MOADNSException("Packet ("+d_qname.toLogString()+"|#"+std::to_string(d_qtype)+") has a TSIG record in an invalid position.");
         }
         d_tsigPos = recordStartPos + sizeof(struct dnsheader);
       }
index 315691a22c3f740282958cc9f86bf771e0c9667c..faa9496c38c0affd2756ecbf2f10f1aa0eff782c 100644 (file)
@@ -696,14 +696,14 @@ void addTSIG(DNSPacketWriter& pw, TSIGRecordContent& trc, const DNSName& tsigkey
 {
   TSIGHashEnum algo;
   if (!getTSIGHashEnum(trc.d_algoName, algo)) {
-    throw PDNSException(string("Unsupported TSIG HMAC algorithm ") + trc.d_algoName.toString());
+    throw PDNSException(string("Unsupported TSIG HMAC algorithm ") + trc.d_algoName.toLogString());
   }
 
   string toSign = makeTSIGPayload(tsigprevious, reinterpret_cast<const char*>(pw.getContent().data()), pw.getContent().size(), tsigkeyname, trc, timersonly);
 
   if (algo == TSIG_GSS) {
     if (!gss_add_signature(tsigkeyname, toSign, trc.d_mac)) {
-      throw PDNSException(string("Could not add TSIG signature with algorithm 'gss-tsig' and key name '")+tsigkeyname.toString()+string("'"));
+      throw PDNSException(string("Could not add TSIG signature with algorithm 'gss-tsig' and key name '")+tsigkeyname.toLogString()+string("'"));
     }
   } else {
     trc.d_mac = calculateHMAC(tsigsecret, toSign, algo);
@@ -723,16 +723,16 @@ bool validateTSIG(const std::string& packet, size_t sigPos, const TSIGTriplet& t
 
   TSIGHashEnum algo;
   if (!getTSIGHashEnum(trc.d_algoName, algo)) {
-    throw std::runtime_error("Unsupported TSIG HMAC algorithm " + trc.d_algoName.toString());
+    throw std::runtime_error("Unsupported TSIG HMAC algorithm " + trc.d_algoName.toLogString());
   }
 
   TSIGHashEnum expectedAlgo;
   if (!getTSIGHashEnum(tt.algo, expectedAlgo)) {
-    throw std::runtime_error("Unsupported TSIG HMAC algorithm expected " + tt.algo.toString());
+    throw std::runtime_error("Unsupported TSIG HMAC algorithm expected " + tt.algo.toLogString());
   }
 
   if (algo != expectedAlgo) {
-    throw std::runtime_error("Signature with TSIG key '"+tt.name.toString()+"' does not match the expected algorithm (" + tt.algo.toString() + " / " + trc.d_algoName.toString() + ")");
+    throw std::runtime_error("Signature with TSIG key '"+tt.name.toLogString()+"' does not match the expected algorithm (" + tt.algo.toLogString() + " / " + trc.d_algoName.toLogString() + ")");
   }
 
   string tsigMsg;
@@ -741,13 +741,13 @@ bool validateTSIG(const std::string& packet, size_t sigPos, const TSIGTriplet& t
   if (algo == TSIG_GSS) {
     GssContext gssctx(tt.name);
     if (!gss_verify_signature(tt.name, tsigMsg, theirMAC)) {
-      throw std::runtime_error("Signature with TSIG key '"+tt.name.toString()+"' failed to validate");
+      throw std::runtime_error("Signature with TSIG key '"+tt.name.toLogString()+"' failed to validate");
     }
   } else {
     string ourMac = calculateHMAC(tt.secret, tsigMsg, algo);
 
     if(!constantTimeStringEquals(ourMac, theirMAC)) {
-      throw std::runtime_error("Signature with TSIG key '"+tt.name.toString()+"' failed to validate");
+      throw std::runtime_error("Signature with TSIG key '"+tt.name.toLogString()+"' failed to validate");
     }
   }
 
index 74982b518f779e2e13d24d345196c037cc4a2a07..54bb8781adedc0bfe8f76980b160e18096d85428 100644 (file)
@@ -51,7 +51,7 @@ vector<pair<vector<DNSRecord>, vector<DNSRecord> > > processIXFRRecords(const Co
 
     auto sr = getRR<SOARecordContent>(records[pos]);
     if (!sr) {
-      throw std::runtime_error("Error getting the content of the first SOA record of this IXFR sequence for zone '"+zone.toString()+"' from master '"+master.toStringWithPort()+"'");
+      throw std::runtime_error("Error getting the content of the first SOA record of this IXFR sequence for zone '"+zone.toLogString()+"' from master '"+master.toStringWithPort()+"'");
     }
 
     // cerr<<"Serial is "<<sr->d_st.serial<<", final serial is "<<masterSOA->d_st.serial<<endl;
@@ -71,12 +71,12 @@ vector<pair<vector<DNSRecord>, vector<DNSRecord> > > processIXFRRecords(const Co
     }
 
     if (pos >= records.size()) {
-      throw std::runtime_error("No SOA record to finish the removals part of the IXFR sequence of zone '" + zone.toString() + "' from " + master.toStringWithPort());
+      throw std::runtime_error("No SOA record to finish the removals part of the IXFR sequence of zone '" + zone.toLogString() + "' from " + master.toStringWithPort());
     }
 
     sr = getRR<SOARecordContent>(records[pos]);
     if (!sr) {
-      throw std::runtime_error("Invalid SOA record to finish the removals part of the IXFR sequence of zone '" + zone.toString() + "' from " + master.toStringWithPort());
+      throw std::runtime_error("Invalid SOA record to finish the removals part of the IXFR sequence of zone '" + zone.toLogString() + "' from " + master.toStringWithPort());
     }
 
     // this is the serial of the zone after the removals
@@ -91,22 +91,22 @@ vector<pair<vector<DNSRecord>, vector<DNSRecord> > > processIXFRRecords(const Co
     }
 
     if (pos >= records.size()) {
-      throw std::runtime_error("No SOA record to finish the additions part of the IXFR sequence of zone '" + zone.toString() + "' from " + master.toStringWithPort());
+      throw std::runtime_error("No SOA record to finish the additions part of the IXFR sequence of zone '" + zone.toLogString() + "' from " + master.toStringWithPort());
     }
 
     sr = getRR<SOARecordContent>(records[pos]);
     if (!sr) {
-      throw std::runtime_error("Invalid SOA record to finish the additions part of the IXFR sequence of zone '" + zone.toString() + "' from " + master.toStringWithPort());
+      throw std::runtime_error("Invalid SOA record to finish the additions part of the IXFR sequence of zone '" + zone.toLogString() + "' from " + master.toStringWithPort());
     }
 
     if (sr->d_st.serial != newSerial) {
-      throw std::runtime_error("Invalid serial (" + std::to_string(sr->d_st.serial) + ", expecting " + std::to_string(newSerial) + ") in the SOA record finishing the additions part of the IXFR sequence of zone '" + zone.toString() + "' from " + master.toStringWithPort());
+      throw std::runtime_error("Invalid serial (" + std::to_string(sr->d_st.serial) + ", expecting " + std::to_string(newSerial) + ") in the SOA record finishing the additions part of the IXFR sequence of zone '" + zone.toLogString() + "' from " + master.toStringWithPort());
     }
 
     if (newSerial == masterSOA->d_st.serial) {
       // this was the last sequence
       if (pos != (records.size() - 1)) {
-        throw std::runtime_error("Trailing records after the last IXFR sequence of zone '" + zone.toString() + "' from " + master.toStringWithPort());
+        throw std::runtime_error("Trailing records after the last IXFR sequence of zone '" + zone.toLogString() + "' from " + master.toStringWithPort());
       }
     }
 
@@ -138,7 +138,7 @@ vector<pair<vector<DNSRecord>, vector<DNSRecord> > > getIXFRDeltas(const ComboAd
     try {
       trc.d_algoName = getTSIGAlgoName(the);
     } catch(PDNSException& pe) {
-      throw std::runtime_error("TSIG algorithm '"+tt.algo.toString()+"' is unknown.");
+      throw std::runtime_error("TSIG algorithm '"+tt.algo.toLogString()+"' is unknown.");
     }
     trc.d_time = time((time_t*)NULL);
     trc.d_fudge = 300;
@@ -179,7 +179,7 @@ vector<pair<vector<DNSRecord>, vector<DNSRecord> > > getIXFRDeltas(const ComboAd
       break;
 
     if (maxReceivedBytes > 0 && (maxReceivedBytes - receivedBytes) < (size_t) len)
-      throw std::runtime_error("Reached the maximum number of received bytes in an IXFR delta for zone '"+zone.toString()+"' from master "+master.toStringWithPort());
+      throw std::runtime_error("Reached the maximum number of received bytes in an IXFR delta for zone '"+zone.toLogString()+"' from master "+master.toStringWithPort());
 
     char reply[len]; 
     readn2(s.getHandle(), reply, len);
@@ -187,7 +187,7 @@ vector<pair<vector<DNSRecord>, vector<DNSRecord> > > getIXFRDeltas(const ComboAd
 
     MOADNSParser mdp(false, string(reply, len));
     if(mdp.d_header.rcode) 
-      throw std::runtime_error("Got an error trying to IXFR zone '"+zone.toString()+"' from master '"+master.toStringWithPort()+"': "+RCode::to_s(mdp.d_header.rcode));
+      throw std::runtime_error("Got an error trying to IXFR zone '"+zone.toLogString()+"' from master '"+master.toStringWithPort()+"': "+RCode::to_s(mdp.d_header.rcode));
 
     //    cout<<"Got a response, rcode: "<<mdp.d_header.rcode<<", got "<<mdp.d_answers.size()<<" answers"<<endl;
 
@@ -200,12 +200,12 @@ vector<pair<vector<DNSRecord>, vector<DNSRecord> > > getIXFRDeltas(const ComboAd
       if(!masterSOA) {
         // we have not seen the first SOA record yet
         if (r.first.d_type != QType::SOA) {
-          throw std::runtime_error("The first record of the IXFR answer for zone '"+zone.toString()+"' from master '"+master.toStringWithPort()+"' is not a SOA ("+QType(r.first.d_type).getName()+")");
+          throw std::runtime_error("The first record of the IXFR answer for zone '"+zone.toLogString()+"' from master '"+master.toStringWithPort()+"' is not a SOA ("+QType(r.first.d_type).getName()+")");
         }
 
        auto sr = getRR<SOARecordContent>(r.first);
        if (!sr) {
-          throw std::runtime_error("Error getting the content of the first SOA record of the IXFR answer for zone '"+zone.toString()+"' from master '"+master.toStringWithPort()+"'");
+          throw std::runtime_error("Error getting the content of the first SOA record of the IXFR answer for zone '"+zone.toLogString()+"' from master '"+master.toStringWithPort()+"'");
         }
 
         if(sr->d_st.serial == std::dynamic_pointer_cast<SOARecordContent>(oursr.d_content)->d_st.serial) {
@@ -222,7 +222,7 @@ vector<pair<vector<DNSRecord>, vector<DNSRecord> > > getIXFRDeltas(const ComboAd
         if(r.first.d_type == QType::OPT)
           continue;
 
-        throw std::runtime_error("Unexpected record (" +QType(r.first.d_type).getName()+") in non-answer section ("+std::to_string(r.first.d_place)+")in IXFR response for zone '"+zone.toString()+"' from master '"+master.toStringWithPort());
+        throw std::runtime_error("Unexpected record (" +QType(r.first.d_type).getName()+") in non-answer section ("+std::to_string(r.first.d_place)+")in IXFR response for zone '"+zone.toLogString()+"' from master '"+master.toStringWithPort());
       }
 
       r.first.d_name.makeUsRelative(zone);
index 465bc364c3cd206b50d0e6e91bae3536bef983b6..41981e92e4838569814d47d67115e0fcea4e67c7 100644 (file)
@@ -264,7 +264,7 @@ static bool addRRSIG(const testkeysset_t& keys, std::vector<DNSRecord>& records,
 
   const auto it = keys.find(signer);
   if (it == keys.cend()) {
-    throw std::runtime_error("No DNSKEY found for " + signer.toString() + ", unable to compute the requested RRSIG");
+    throw std::runtime_error("No DNSKEY found for " + signer.toLogString() + ", unable to compute the requested RRSIG");
   }
 
   size_t recordsCount = records.size();
@@ -300,7 +300,7 @@ static void addDNSKEY(const testkeysset_t& keys, const DNSName& signer, uint32_t
 {
   const auto it = keys.find(signer);
   if (it == keys.cend()) {
-    throw std::runtime_error("No DNSKEY found for " + signer.toString());
+    throw std::runtime_error("No DNSKEY found for " + signer.toLogString());
   }
 
   DNSRecord rec;
index 9c1afd1107cd0d855a82651cc13662ed1dd1f2b3..1961f8216fd80e27e8fc069d1709bf42280ca9f6 100644 (file)
@@ -438,10 +438,10 @@ std::shared_ptr<SyncRes::domainmap_t> parseAuthAndForwards()
            dr.d_place=DNSResourceRecord::ANSWER;
           }
           catch(std::exception &e) {
-            throw PDNSException("Error parsing record '"+rr.qname.toString()+"' of type "+rr.qtype.getName()+" in zone '"+headers.first+"' from file '"+headers.second+"': "+e.what());
+            throw PDNSException("Error parsing record '"+rr.qname.toLogString()+"' of type "+rr.qtype.getName()+" in zone '"+headers.first+"' from file '"+headers.second+"': "+e.what());
           }
           catch(...) {
-            throw PDNSException("Error parsing record '"+rr.qname.toString()+"' of type "+rr.qtype.getName()+" in zone '"+headers.first+"' from file '"+headers.second+"'");
+            throw PDNSException("Error parsing record '"+rr.qname.toLogString()+"' of type "+rr.qtype.getName()+" in zone '"+headers.first+"' from file '"+headers.second+"'");
           }
 
           ad.d_records.insert(dr);
index 86b224543cea73b87e5dd34e8b3aca8d14e333bd..14dba144982e2c3670f7b4c7c9ad39fb2338aff8 100644 (file)
@@ -199,7 +199,7 @@ static int parseResult(MOADNSParser& mdp, const DNSName& origQname, uint16_t ori
     if(mdp.d_header.qdcount != 1)
       throw ResolverException("resolver: received answer with wrong number of questions ("+itoa(mdp.d_header.qdcount)+")");
     if(mdp.d_qname != origQname)
-      throw ResolverException(string("resolver: received an answer to another question (")+mdp.d_qname.toString()+"!="+ origQname.toString()+".)");
+      throw ResolverException(string("resolver: received an answer to another question (")+mdp.d_qname.toLogString()+"!="+ origQname.toLogString()+".)");
   }
 
   vector<DNSResourceRecord> ret;
@@ -283,7 +283,7 @@ bool Resolver::tryGetSOASerial(DNSName *domain, uint32_t *theirSerial, uint32_t
     }
   }
   if(!gotSOA)
-    throw ResolverException("Query to '" + fromaddr.toString() + "' for SOA of '" + domain->toString() + "' did not return a SOA");
+    throw ResolverException("Query to '" + fromaddr.toString() + "' for SOA of '" + domain->toLogString() + "' did not return a SOA");
   return true;
 }
 
@@ -345,21 +345,21 @@ void Resolver::getSoaSerial(const string &ipport, const DNSName &domain, uint32_
   int ret = resolve(ipport, domain, QType::SOA, &res);
   
   if(ret || res.empty())
-    throw ResolverException("Query to '" + ipport + "' for SOA of '" + domain.toString() + "' produced no answers");
+    throw ResolverException("Query to '" + ipport + "' for SOA of '" + domain.toLogString() + "' produced no answers");
 
   if(res[0].qtype.getCode() != QType::SOA) 
-    throw ResolverException("Query to '" + ipport + "' for SOA of '" + domain.toString() + "' produced a "+res[0].qtype.getName()+" record");
+    throw ResolverException("Query to '" + ipport + "' for SOA of '" + domain.toLogString() + "' produced a "+res[0].qtype.getName()+" record");
 
   vector<string>parts;
   stringtok(parts, res[0].content);
   if(parts.size()<3)
-    throw ResolverException("Query to '" + ipport + "' for SOA of '" + domain.toString() + "' produced an unparseable response");
+    throw ResolverException("Query to '" + ipport + "' for SOA of '" + domain.toLogString() + "' produced an unparseable response");
 
   try {
     *serial=pdns_stou(parts[2]);
   }
   catch(const std::out_of_range& oor) {
-    throw ResolverException("Query to '" + ipport + "' for SOA of '" + domain.toString() + "' produced an unparseable serial");
+    throw ResolverException("Query to '" + ipport + "' for SOA of '" + domain.toLogString() + "' produced an unparseable serial");
   }
 }
 
index 10dc0522db1771ad405386e45d51887d6009db19..4ed461273de2564cbb1cfac9160b558e7f37eb78 100644 (file)
@@ -16,7 +16,7 @@ static Netmask makeNetmaskFromRPZ(const DNSName& name)
    * Terrible right?
    */
   if(parts.size() < 2 || parts.size() > 9)
-    throw PDNSException("Invalid IP address in RPZ: "+name.toString());
+    throw PDNSException("Invalid IP address in RPZ: "+name.toLogString());
 
   bool isV6 = (stoi(parts[0]) > 32);
   bool hadZZ = false;
@@ -29,7 +29,7 @@ static Netmask makeNetmaskFromRPZ(const DNSName& name)
 
     if (pdns_iequals(part,"zz")) {
       if (hadZZ)
-        throw PDNSException("more than one 'zz' label found in RPZ name"+name.toString());
+        throw PDNSException("more than one 'zz' label found in RPZ name"+name.toLogString());
       part = "";
       isV6 = true;
       hadZZ = true;
@@ -37,7 +37,7 @@ static Netmask makeNetmaskFromRPZ(const DNSName& name)
   }
 
   if (isV6 && parts.size() < 9 && !hadZZ)
-    throw PDNSException("No 'zz' label found in an IPv6 RPZ name shorter than 9 elements: "+name.toString());
+    throw PDNSException("No 'zz' label found in an IPv6 RPZ name shorter than 9 elements: "+name.toLogString());
 
   if (parts.size() == 5 && !isV6)
     return Netmask(parts[4]+"."+parts[3]+"."+parts[2]+"."+parts[1]+"/"+parts[0]);
@@ -238,7 +238,7 @@ void loadRPZFromFile(const std::string& fname, std::shared_ptr<DNSFilterEngine::
       }
     }
     catch(const PDNSException& pe) {
-      throw PDNSException("Issue parsing '"+drr.qname.toString()+"' '"+drr.content+"' at "+zpt.getLineOfFile()+": "+pe.reason);
+      throw PDNSException("Issue parsing '"+drr.qname.toLogString()+"' '"+drr.content+"' at "+zpt.getLineOfFile()+": "+pe.reason);
     }
   }
 }
index 4b6da4dbfdd1dc0901624da36fa629e899ee2707..d5819bb6fa06096ec306d05a42fefd1f14de6ad4 100644 (file)
@@ -685,7 +685,7 @@ struct SlaveSenderReceiver
       }
     }
     catch(PDNSException& e) {
-      throw runtime_error("While attempting to query freshness of '"+dni.di.zone.toString()+"': "+e.reason);
+      throw runtime_error("While attempting to query freshness of '"+dni.di.zone.toLogString()+"': "+e.reason);
     }
   }
 
index 8215de663217caae36c11680ae90b5633c0c2421..c49560f42c9d35cabebe563285d75515003f8f91 100644 (file)
@@ -1674,8 +1674,8 @@ bool SyncRes::lookForCut(const DNSName& qname, unsigned int depth, const vState
 void SyncRes::computeZoneCuts(const DNSName& begin, const DNSName& end, unsigned int depth)
 {
   if(!begin.isPartOf(end)) {
-    LOG(d_prefix<<" "<<begin.toLogString()<<" is not part of "<<end.toString()<<endl);
-    throw PDNSException(begin.toLogString() + " is not part of " + end.toString());
+    LOG(d_prefix<<" "<<begin.toLogString()<<" is not part of "<<end.toLogString()<<endl);
+    throw PDNSException(begin.toLogString() + " is not part of " + end.toLogString());
   }
 
   if (d_cutStates.count(begin) != 0) {
index ce01c434b44ea8ef4bad99b04ba5aea00188a7de..de0471b73dde899b853c1ac6a9e4bdbda3ff7e78 100644 (file)
@@ -46,7 +46,7 @@ bool TSIGTCPVerifier::check(const string& data, const MOADNSParser& mdp)
 
   if (checkTSIG) {
     if (theirMac.empty()) {
-      throw std::runtime_error("No TSIG on AXFR response from "+d_remote.toStringWithPort()+" , should be signed with TSIG key '"+d_tt.name.toString()+"'");
+      throw std::runtime_error("No TSIG on AXFR response from "+d_remote.toStringWithPort()+" , should be signed with TSIG key '"+d_tt.name.toLogString()+"'");
     }
 
     try {
index e82c86da7b3941d471e11d035ef765e1f2f77ba5..c3ed98f1474e9116d3d6eb3a3fe2aba4c0dd1977 100644 (file)
@@ -625,7 +625,7 @@ static const vector<DNSName> getZoneCuts(const DNSName& begin, const DNSName& en
 {
   vector<DNSName> ret;
   if(!begin.isPartOf(end))
-    throw PDNSException(end.toLogString() + "is not part of " + begin.toString());
+    throw PDNSException(end.toLogString() + "is not part of " + begin.toLogString());
 
   DNSName qname(end);
   vector<string> labelsToAdd = begin.makeRelative(end).getRawLabels();
index 4bbd59c64f6fec43fdd993ca4d3a04dd1396ab87..40f2766c9fbc9c5da9eda1ad79d4b035a5352c7f 100644 (file)
@@ -118,7 +118,7 @@ static void fillZone(const DNSName& zonename, HttpResponse* resp)
 {
   auto iter = SyncRes::t_sstorage.domainmap->find(zonename);
   if (iter == SyncRes::t_sstorage.domainmap->end())
-    throw ApiException("Could not find domain '"+zonename.toString()+"'");
+    throw ApiException("Could not find domain '"+zonename.toLogString()+"'");
 
   const SyncRes::AuthDomain& zone = iter->second;
 
@@ -292,7 +292,7 @@ static void apiServerZoneDetail(HttpRequest* req, HttpResponse* resp)
 
   SyncRes::domainmap_t::const_iterator iter = SyncRes::t_sstorage.domainmap->find(zonename);
   if (iter == SyncRes::t_sstorage.domainmap->end())
-    throw ApiException("Could not find domain '"+zonename.toString()+"'");
+    throw ApiException("Could not find domain '"+zonename.toLogString()+"'");
 
   if(req->method == "PUT" && !::arg().mustDo("api-readonly")) {
     Json document = req->json();
index 913063c59aebf366e33b34430875e5b30bdac5d5..ad7039531b956efa482dec280df4934aa428edeb 100644 (file)
@@ -426,7 +426,7 @@ bool ZoneParserTNG::get(DNSResourceRecord& rr, std::string* comment)
         try {
           recparts[1] = toCanonic(d_zonename, recparts[1]).toStringRootDot();
         } catch (std::exception &e) {
-          throw PDNSException("Error in record '" + rr.qname.toString() + " " + rr.qtype.getName() + "': " + e.what());
+          throw PDNSException("Error in record '" + rr.qname.toLogString() + " " + rr.qtype.getName() + "': " + e.what());
         }
       }
       rr.content=recparts[0]+" "+recparts[1];
@@ -449,7 +449,7 @@ bool ZoneParserTNG::get(DNSResourceRecord& rr, std::string* comment)
         try {
           recparts[3] = toCanonic(d_zonename, recparts[3]).toStringRootDot();
         } catch (std::exception &e) {
-          throw PDNSException("Error in record '" + rr.qname.toString() + " " + rr.qtype.getName() + "': " + e.what());
+          throw PDNSException("Error in record '" + rr.qname.toLogString() + " " + rr.qtype.getName() + "': " + e.what());
         }
       }
       rr.content=recparts[0]+" "+recparts[1]+" "+recparts[2]+" "+recparts[3];
@@ -464,7 +464,7 @@ bool ZoneParserTNG::get(DNSResourceRecord& rr, std::string* comment)
     try {
       rr.content = toCanonic(d_zonename, rr.content).toStringRootDot();
     } catch (std::exception &e) {
-      throw PDNSException("Error in record '" + rr.qname.toString() + " " + rr.qtype.getName() + "': " + e.what());
+      throw PDNSException("Error in record '" + rr.qname.toLogString() + " " + rr.qtype.getName() + "': " + e.what());
     }
     break;
   case QType::AFSDB:
@@ -473,10 +473,10 @@ bool ZoneParserTNG::get(DNSResourceRecord& rr, std::string* comment)
       try {
         recparts[1]=toCanonic(d_zonename, recparts[1]).toStringRootDot();
       } catch (std::exception &e) {
-        throw PDNSException("Error in record '" + rr.qname.toString() + " " + rr.qtype.getName() + "': " + e.what());
+        throw PDNSException("Error in record '" + rr.qname.toLogString() + " " + rr.qtype.getName() + "': " + e.what());
       }
     } else {
-      throw PDNSException("AFSDB record for "+rr.qname.toString()+" invalid");
+      throw PDNSException("AFSDB record for "+rr.qname.toLogString()+" invalid");
     }
     rr.content.clear();
     for(string::size_type n = 0; n < recparts.size(); ++n) {
@@ -489,13 +489,13 @@ bool ZoneParserTNG::get(DNSResourceRecord& rr, std::string* comment)
   case QType::SOA:
     stringtok(recparts, rr.content);
     if(recparts.size() > 7)
-      throw PDNSException("SOA record contents for "+rr.qname.toString()+" contains too many parts");
+      throw PDNSException("SOA record contents for "+rr.qname.toLogString()+" contains too many parts");
     if(recparts.size() > 1) {
       try {
         recparts[0]=toCanonic(d_zonename, recparts[0]).toStringRootDot();
         recparts[1]=toCanonic(d_zonename, recparts[1]).toStringRootDot();
       } catch (std::exception &e) {
-        throw PDNSException("Error in record '" + rr.qname.toString() + " " + rr.qtype.getName() + "': " + e.what());
+        throw PDNSException("Error in record '" + rr.qname.toLogString() + " " + rr.qtype.getName() + "': " + e.what());
       }
     }
     rr.content.clear();