From: Peter van Dijk Date: Mon, 1 Jun 2015 11:06:38 +0000 (+0200) Subject: make tools compile X-Git-Tag: dnsdist-1.0.0-alpha1~248^2~58^2~21^2~5^2~72 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=9d7fa32700da8c35146b16543b242aa0b0c26d98;p=thirdparty%2Fpdns.git make tools compile --- diff --git a/pdns/nsec3dig.cc b/pdns/nsec3dig.cc index d3bcdaa4f4..6860611e9f 100644 --- a/pdns/nsec3dig.cc +++ b/pdns/nsec3dig.cc @@ -16,12 +16,12 @@ StatBag S; typedef std::pair nsec3; typedef set nsec3set; -string nsec3Hash(const string &qname, const string &salt, unsigned int iters) +string nsec3Hash(const DNSName &qname, const string &salt, unsigned int iters) { return toBase32Hex(hashQNameWithSalt(iters, salt, qname)); } -void proveOrDeny(const nsec3set &nsec3s, const string &qname, const string &salt, unsigned int iters, set &proven, set &denied) +void proveOrDeny(const nsec3set &nsec3s, const DNSName &qname, const string &salt, unsigned int iters, set &proven, set &denied) { string hashed = nsec3Hash(qname, salt, iters); @@ -34,23 +34,23 @@ void proveOrDeny(const nsec3set &nsec3s, const string &qname, const string &salt if(hashed == base) { proven.insert(qname); - cout< base && hashed < next) || (next < base && (hashed < next || hashed > base))) { denied.insert(qname); - cout< names; - set namesseen; - set namestocheck; + set names; + set namesseen; + set namestocheck; nsec3set nsec3s; string nsec3salt; int nsec3iters = 0; @@ -134,7 +134,8 @@ try // nsec3.insert(new nsec3() // cerr< parts; - boost::split(parts, i->first.d_label, boost::is_any_of(".")); + string sname=i->first.d_label.toString(); + boost::split(parts, sname /* FIXME */, boost::is_any_of(".")); nsec3s.insert(make_pair(toLower(parts[0]), toBase32Hex(r.d_nexthash))); nsec3salt = r.d_salt; nsec3iters = r.d_iterations; @@ -142,8 +143,8 @@ try else { // cerr<<"namesseen.insert('"<first.d_label<<"')"<first.d_label)); - namesseen.insert(stripDot(i->first.d_label)); + names.insert(i->first.d_label); + namesseen.insert(i->first.d_label); } if(i->first.d_type == QType::CNAME) @@ -151,7 +152,7 @@ try namesseen.insert(stripDot(i->first.d_content->getZoneRepresentation())); } - cout<first.d_place-1<<"\t"<first.d_label<<"\tIN\t"<first.d_type); + cout<first.d_place-1<<"\t"<first.d_label.toString()<<"\tIN\t"<first.d_type); cout<<"\t"<first.d_ttl<<"\t"<< i->first.d_content->getZoneRepresentation()<<"\n"; } @@ -167,17 +168,17 @@ try #endif cout<<"== nsec3 prove/deny report follows =="< proven; - set denied; + set proven; + set denied; namesseen.insert(stripDot(qname)); - BOOST_FOREACH(string n, namesseen) + for(const auto &n: namesseen) { - string shorter(n); + DNSName shorter(n); do { namestocheck.insert(shorter); - } while(chopOff(shorter)); + } while(shorter.chopOff()); } - BOOST_FOREACH(string n, namestocheck) + for(const auto &n: namestocheck) { proveOrDeny(nsec3s, n, nsec3salt, nsec3iters, proven, denied); proveOrDeny(nsec3s, "*."+n, nsec3salt, nsec3iters, proven, denied); @@ -194,43 +195,44 @@ try cout<<"qname found proven, NODATA response?"< > records; - set labels; - map hashes; + vector > records; + set labels; + map hashes; NSEC3PARAMRecordContent ns3pr; while(soacount<2) { @@ -290,14 +290,14 @@ try o<<"\t"<first.d_content->getZoneRepresentation(); } - records.push_back(make_pair(stripDot(i->first.d_label),o.str())); + records.push_back(make_pair(i->first.d_label,o.str())); - string shorter(stripDot(i->first.d_label)); + DNSName shorter(i->first.d_label); do { labels.insert(shorter); if (pdns_iequals(shorter, argv[3])) break; - }while(chopOff(shorter)); + }while(shorter.chopOff()); } @@ -307,22 +307,21 @@ try if (isNSEC3 && unhash) { string hashed; - BOOST_FOREACH(const string &label, labels) { + for(const auto &label: labels) { hashed=toBase32Hex(hashQNameWithSalt(ns3pr.d_iterations, ns3pr.d_salt, label)); - hashes.insert(pair(hashed, label)); + hashes.insert(pair(hashed, label)); } } - pair record; - BOOST_FOREACH(record, records) { - string label=record.first; + for(auto &record: records) { + DNSName label /* FIXME rename */=record.first; if (isNSEC3 && unhash) { - map::iterator i = hashes.find(makeRelative(label, argv[3])); + auto i = hashes.find(makeRelative(label.toString(), argv[3])); if (i != hashes.end()) label=i->second; } - cout<first.d_place-1<<"\t"<first.d_label<<"\tIN\t"<first.d_type); + cout<first.d_place-1<<"\t"<first.d_label.toString()<<"\tIN\t"<first.d_type); if(i->first.d_type == QType::RRSIG) { string zoneRep = i->first.d_content->getZoneRepresentation();