From 21a3792f1f75892d51b6c2aba9b145a38e48e6e2 Mon Sep 17 00:00:00 2001 From: Kees Monshouwer Date: Tue, 30 Jun 2015 08:08:03 +0200 Subject: [PATCH] fixes after merge with master --- modules/remotebackend/remotebackend.cc | 2 +- pdns/dnsname.cc | 2 +- pdns/dnsname.hh | 9 ------- pdns/dnssecinfra.cc | 4 +-- pdns/gss_context.cc | 16 ++++++------ pdns/gss_context.hh | 4 +-- pdns/misc.cc | 34 ++++++++++++-------------- pdns/misc.hh | 4 +-- pdns/packethandler.cc | 4 +-- pdns/pdnssec.cc | 12 ++++----- pdns/resolver.cc | 4 +-- pdns/signingpipe.cc | 2 +- pdns/signingpipe.hh | 2 +- pdns/tcpreceiver.cc | 2 +- pdns/tkey.cc | 14 +++++------ 15 files changed, 51 insertions(+), 64 deletions(-) diff --git a/modules/remotebackend/remotebackend.cc b/modules/remotebackend/remotebackend.cc index 1405d71e8..d16aa1fb3 100644 --- a/modules/remotebackend/remotebackend.cc +++ b/modules/remotebackend/remotebackend.cc @@ -732,7 +732,7 @@ bool RemoteBackend::createSlaveDomain(const string &ip, const DNSName& domain, c JSON_ADD_MEMBER(query, "method", "createSlaveDomain", query.GetAllocator()); parameters.SetObject(); JSON_ADD_MEMBER(parameters, "ip", ip.c_str(), query.GetAllocator()); - JSON_ADD_MEMBER_DNSNAME(parameters, "domain", domain. query.GetAllocator()); + JSON_ADD_MEMBER_DNSNAME(parameters, "domain", domain, query.GetAllocator()); JSON_ADD_MEMBER(parameters, "nameserver", nameserver.c_str(), query.GetAllocator()); JSON_ADD_MEMBER(parameters, "account", account.c_str(), query.GetAllocator()); query.AddMember("parameters", parameters, query.GetAllocator()); diff --git a/pdns/dnsname.cc b/pdns/dnsname.cc index 530a209a1..f6191149f 100644 --- a/pdns/dnsname.cc +++ b/pdns/dnsname.cc @@ -194,7 +194,7 @@ bool DNSName::canonCompare(const DNSName& rhs) const return std::lexicographical_compare(ours.rbegin(), ours.rend(), rhsLabels.rbegin(), rhsLabels.rend(), CIStringCompare()); } -bool DNSName::chopOff() +bool DNSName::chopOff() { if(d_storage.empty()) return false; diff --git a/pdns/dnsname.hh b/pdns/dnsname.hh index a3f3d3296..b44e4780f 100644 --- a/pdns/dnsname.hh +++ b/pdns/dnsname.hh @@ -70,8 +70,6 @@ public: }); // note that this is case insensitive, including on the label lengths } - bool canonCompare(const DNSName& rhs) const; - template void serialize(Archive &ar, const unsigned int version) { @@ -93,13 +91,6 @@ private: static std::string unescapeLabel(const std::string& orig); }; -struct CanonDNSNameCompare: public std::binary_function -{ - bool operator()(const DNSName&a, const DNSName& b) const - { - return a.canonCompare(b); - } -}; size_t hash_value(DNSName const& d); struct CanonDNSNameCompare: public std::binary_function diff --git a/pdns/dnssecinfra.cc b/pdns/dnssecinfra.cc index 7b9d1e6db..728c41779 100644 --- a/pdns/dnssecinfra.cc +++ b/pdns/dnssecinfra.cc @@ -591,7 +591,7 @@ 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); + throw PDNSException(string("Unsupported TSIG HMAC algorithm ") + trc->d_algoName.toString()); } string toSign; @@ -627,7 +627,7 @@ void addTSIG(DNSPacketWriter& pw, TSIGRecordContent* trc, const DNSName& tsigkey 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+string("'")); + throw PDNSException(string("Could not add TSIG signature with algorithm 'gss-tsig' and key name '")+tsigkeyname.toString()+string("'")); } } else { trc->d_mac = calculateHMAC(tsigsecret, toSign, algo); diff --git a/pdns/gss_context.cc b/pdns/gss_context.cc index 5b8f3066f..a92820a00 100644 --- a/pdns/gss_context.cc +++ b/pdns/gss_context.cc @@ -432,11 +432,11 @@ void GssContext::processError(const std::string& method, OM_uint32 maj, OM_uint3 #endif -bool gss_add_signature(const std::string& context, const std::string& message, std::string& mac) { +bool gss_add_signature(const DNSName& context, const std::string& message, std::string& mac) { string tmp_mac; - GssContext gssctx(context); + GssContext gssctx(context.toStringNoDot()); if (!gssctx.valid()) { - L< d_ctx; //d_tsig_algo); if (p->d_tsig_algo == TSIG_GSS) { - GssContext gssctx(keyname); + GssContext gssctx(keyname.toStringNoDot()); if (!gssctx.getPeerPrincipal(p->d_peer_principal)) { - L<createDomain(di.zone)) throw PDNSException("Failed to create zone"); tgt->setKind(di.zone, di.kind); diff --git a/pdns/resolver.cc b/pdns/resolver.cc index 1e236df10..09275e3dd 100644 --- a/pdns/resolver.cc +++ b/pdns/resolver.cc @@ -504,9 +504,9 @@ int AXFRRetriever::getChunk(Resolver::res_t &res) // Implementation is making su } if (algo == TSIG_GSS) { - GssContext gssctx(d_tsigkeyname); + GssContext gssctx(d_tsigkeyname.toStringNoDot()); if (!gss_verify_signature(d_tsigkeyname, message, theirMac)) { - throw ResolverException("Signature failed to validate on AXFR response from "+d_remote.toStringWithPort()+" signed with TSIG key '"+d_tsigkeyname+"'"); + throw ResolverException("Signature failed to validate on AXFR response from "+d_remote.toStringWithPort()+" signed with TSIG key '"+d_tsigkeyname.toString()+"'"); } } else { string ourMac=calculateHMAC(d_tsigsecret, message, algo); diff --git a/pdns/signingpipe.cc b/pdns/signingpipe.cc index c20e3a628..9030a4093 100644 --- a/pdns/signingpipe.cc +++ b/pdns/signingpipe.cc @@ -70,7 +70,7 @@ catch(...) { return 0; } -ChunkedSigningPipe::ChunkedSigningPipe(const DNSName& signerName, bool mustSign, const pdns::string& servers, unsigned int workers) +ChunkedSigningPipe::ChunkedSigningPipe(const DNSName& signerName, bool mustSign, const string& servers, unsigned int workers) : d_queued(0), d_outstanding(0), d_signer(signerName), d_maxchunkrecords(100), d_numworkers(workers), d_tids(d_numworkers), d_mustSign(mustSign), d_final(false), d_submitted(0) { diff --git a/pdns/signingpipe.hh b/pdns/signingpipe.hh index ce4cdc5f7..4c63aea72 100644 --- a/pdns/signingpipe.hh +++ b/pdns/signingpipe.hh @@ -19,7 +19,7 @@ public: typedef vector rrset_t; typedef rrset_t chunk_t; // for now - ChunkedSigningPipe(const DNSName& signerName, bool mustSign, /* FIXME servers is unused? */ const pdns::string& servers=pdns::string(), unsigned int numWorkers=3); + ChunkedSigningPipe(const DNSName& signerName, bool mustSign, /* FIXME servers is unused? */ const string& servers=string(), unsigned int numWorkers=3); ~ChunkedSigningPipe(); bool submit(const DNSResourceRecord& rr); chunk_t getChunk(bool final=false); diff --git a/pdns/tcpreceiver.cc b/pdns/tcpreceiver.cc index e74e19b68..c64f00fd8 100644 --- a/pdns/tcpreceiver.cc +++ b/pdns/tcpreceiver.cc @@ -424,7 +424,7 @@ bool TCPNameserver::canDoAXFR(shared_ptr q) } else { getTSIGHashEnum(trc.d_algoName, q->d_tsig_algo); if (q->d_tsig_algo == TSIG_GSS) { - GssContext gssctx(keyname); + GssContext gssctx(keyname.toStringNoDot()); if (!gssctx.getPeerPrincipal(q->d_peer_principal)) { L< tkey_out(new TKEYRecordContent()); - string label; + DNSName label; bool sign = false; if (!p->getTKEYRecord(&tkey_in, &label)) { @@ -22,19 +22,17 @@ void PacketHandler::tkeyHandler(DNSPacket *p, DNSPacket *r) { tkey_out->d_inception = time((time_t*)NULL); tkey_out->d_expiration = tkey_out->d_inception+15; - GssContext ctx(label); + GssContext ctx(label.toStringNoDot()); if (tkey_in.d_mode == 3) { // establish context if (tkey_in.d_algo == "gss-tsig.") { std::vector meta; - string tmpLabel = toLowerCanonic(label); - bool ok = true; - while(ok) { + DNSName tmpLabel(label); + do { if (B.getDomainMetadata(tmpLabel, "GSS-ACCEPTOR-PRINCIPAL", meta) && meta.size()>0) { break; } - ok = chopOff(tmpLabel); - } + } while(tmpLabel.chopOff()); if (meta.size()>0) { ctx.setLocalPrincipal(meta[0]); @@ -97,7 +95,7 @@ void PacketHandler::tkeyHandler(DNSPacket *p, DNSPacket *r) { trc.d_eRcode = 0; trc.d_otherData = ""; // this should cause it to lookup label context - r->setTSIGDetails(trc, label, label, "", false); + r->setTSIGDetails(trc, label, label.toStringNoDot(), "", false); } r->commitD(); -- 2.40.0