From: Kees Monshouwer Date: Mon, 20 Nov 2017 19:32:00 +0000 (+0100) Subject: use toLogString while throwing X-Git-Tag: dnsdist-1.3.0~163^2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=86f1af1c06d8c923e6cf8718219b1a4137359662;p=thirdparty%2Fpdns.git use toLogString while throwing --- diff --git a/modules/mydnsbackend/mydnsbackend.cc b/modules/mydnsbackend/mydnsbackend.cc index ec521ceb49..c7e9814cb8 100644 --- a/modules/mydnsbackend/mydnsbackend.cc +++ b/modules/mydnsbackend/mydnsbackend.cc @@ -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(); diff --git a/pdns/bpf-filter.cc b/pdns/bpf-filter.cc index 1b5b56a5ab..65cf551b36 100644 --- a/pdns/bpf-filter.cc +++ b/pdns/bpf-filter.cc @@ -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 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))); } } } diff --git a/pdns/dbdnsseckeeper.cc b/pdns/dbdnsseckeeper.cc index aca1b38d38..7f677f5218 100644 --- a/pdns/dbdnsseckeeper.cc +++ b/pdns/dbdnsseckeeper.cc @@ -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(); diff --git a/pdns/dnsparser.cc b/pdns/dnsparser.cc index 52fca0ef13..70d6d93916 100644 --- a/pdns/dnsparser.cc +++ b/pdns/dnsparser.cc @@ -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); } diff --git a/pdns/dnssecinfra.cc b/pdns/dnssecinfra.cc index 315691a22c..faa9496c38 100644 --- a/pdns/dnssecinfra.cc +++ b/pdns/dnssecinfra.cc @@ -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(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"); } } diff --git a/pdns/ixfr.cc b/pdns/ixfr.cc index 74982b518f..54bb8781ad 100644 --- a/pdns/ixfr.cc +++ b/pdns/ixfr.cc @@ -51,7 +51,7 @@ vector, vector > > processIXFRRecords(const Co auto sr = getRR(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 "<d_st.serial<<", final serial is "<d_st.serial<, vector > > 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(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, vector > > 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(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, vector > > 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, vector > > 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, vector > > 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: "<, vector > > 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(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(oursr.d_content)->d_st.serial) { @@ -222,7 +222,7 @@ vector, vector > > 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); diff --git a/pdns/recursordist/test-syncres_cc.cc b/pdns/recursordist/test-syncres_cc.cc index 465bc364c3..41981e92e4 100644 --- a/pdns/recursordist/test-syncres_cc.cc +++ b/pdns/recursordist/test-syncres_cc.cc @@ -264,7 +264,7 @@ static bool addRRSIG(const testkeysset_t& keys, std::vector& 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; diff --git a/pdns/reczones.cc b/pdns/reczones.cc index 9c1afd1107..1961f8216f 100644 --- a/pdns/reczones.cc +++ b/pdns/reczones.cc @@ -438,10 +438,10 @@ std::shared_ptr 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); diff --git a/pdns/resolver.cc b/pdns/resolver.cc index 86b224543c..14dba14498 100644 --- a/pdns/resolver.cc +++ b/pdns/resolver.cc @@ -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 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"); vectorparts; 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"); } } diff --git a/pdns/rpzloader.cc b/pdns/rpzloader.cc index 10dc0522db..4ed461273d 100644 --- a/pdns/rpzloader.cc +++ b/pdns/rpzloader.cc @@ -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 getZoneCuts(const DNSName& begin, const DNSName& en { vector 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 labelsToAdd = begin.makeRelative(end).getRawLabels(); diff --git a/pdns/ws-recursor.cc b/pdns/ws-recursor.cc index 4bbd59c64f..40f2766c9f 100644 --- a/pdns/ws-recursor.cc +++ b/pdns/ws-recursor.cc @@ -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(); diff --git a/pdns/zoneparser-tng.cc b/pdns/zoneparser-tng.cc index 913063c59a..ad7039531b 100644 --- a/pdns/zoneparser-tng.cc +++ b/pdns/zoneparser-tng.cc @@ -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();