}
SOAData soadata;
- BOOST_FOREACH(DomainInfo& di, consider) {
+ for(DomainInfo& di : consider) {
soadata.serial=0;
try {
this->getSOA(di.zone, soadata); // we might not *have* a SOA yet, but this might trigger a load of it
};
}
- BOOST_FOREACH(DomainInfo &di, *domains) {
+ for(DomainInfo &di : *domains) {
this->getSOA(di.zone, soadata);
di.serial=soadata.serial;
}
}
}
- BOOST_FOREACH(DomainInfo &sd, domains) {
+ for(DomainInfo &sd : domains) {
SOAData soadata;
soadata.refresh=0;
soadata.serial=0;
DNSName sqname;
recordstorage_t nssets;
- BOOST_FOREACH(const Bind2DNSRecord& bdr, *records) {
+ for(const Bind2DNSRecord& bdr : *records) {
if(bdr.qtype==QType::NS)
nssets.insert(bdr);
}
- BOOST_FOREACH(const Bind2DNSRecord& bdr, *records) {
+ for(const Bind2DNSRecord& bdr : *records) {
bdr.auth=true;
if(bdr.qtype == QType::DS) // as are delegation signer records
set<DNSName> oldnames, newnames;
{
ReadLock rl(&s_state_lock);
- BOOST_FOREACH(const BB2DomainInfo& bbd, s_state) {
+ for(const BB2DomainInfo& bbd : s_state) {
oldnames.insert(bbd.d_name);
}
}
typedef recordstorage_t::index<HashedTag>::type records_by_hashindex_t;
records_by_hashindex_t& hashindex=boost::multi_index::get<HashedTag>(*bbd.d_records.getWRITABLE()); // needlessly dangerous
-// BOOST_FOREACH(const Bind2DNSRecord& bdr, hashindex) {
+// for(const Bind2DNSRecord& bdr : hashindex) {
// cerr<<"Hash: "<<bdr.nsec3hash<<"\t"<< (lqname < bdr.nsec3hash) <<endl;
// }
config = YAML::LoadFile(getArg("zones-file"));
- BOOST_FOREACH(YAML::Node domain, config["domains"]) {
+ for(YAML::Node domain : config["domains"]) {
GeoIPDomain dom;
dom.id = s_domains.size();
dom.domain = DNSName(domain["domain"].as<string>());
DNSName qname = DNSName(recs->first.as<string>());
vector<DNSResourceRecord> rrs;
- BOOST_FOREACH(YAML::Node item, recs->second) {
+ for(YAML::Node item : recs->second) {
YAML::const_iterator rec = item.begin();
DNSResourceRecord rr;
rr.domain_id = dom.id;
bool GeoIPBackend::getDomainInfo(const DNSName& domain, DomainInfo &di) {
ReadLock rl(&s_state_lock);
- BOOST_FOREACH(GeoIPDomain dom, s_domains) {
+ for(GeoIPDomain dom : s_domains) {
if (dom.domain == domain) {
SOAData sd;
this->getSOA(domain, sd);
if (!d_dnssec) return false;
ReadLock rl(&s_state_lock);
- BOOST_FOREACH(GeoIPDomain dom, s_domains) {
+ for(GeoIPDomain dom : s_domains) {
if (dom.domain == name) {
if (hasDNSSECkey(dom.domain)) {
meta[string("NSEC3NARROW")].push_back("1");
if (!d_dnssec) return false;
ReadLock rl(&s_state_lock);
- BOOST_FOREACH(GeoIPDomain dom, s_domains) {
+ for(GeoIPDomain dom : s_domains) {
if (dom.domain == name) {
if (hasDNSSECkey(dom.domain)) {
if (kind == "NSEC3NARROW")
bool GeoIPBackend::getDomainKeys(const DNSName& name, unsigned int kind, std::vector<DNSBackend::KeyData>& keys) {
if (!d_dnssec) return false;
ReadLock rl(&s_state_lock);
- BOOST_FOREACH(GeoIPDomain dom, s_domains) {
+ for(GeoIPDomain dom : s_domains) {
if (dom.domain == name) {
regex_t reg;
regmatch_t regm[5];
WriteLock rl(&s_state_lock);
ostringstream path;
- BOOST_FOREACH(GeoIPDomain dom, s_domains) {
+ for(GeoIPDomain dom : s_domains) {
if (dom.domain == name) {
regex_t reg;
regmatch_t regm[5];
WriteLock rl(&s_state_lock);
int nextid=1;
- BOOST_FOREACH(GeoIPDomain dom, s_domains) {
+ for(GeoIPDomain dom : s_domains) {
if (dom.domain == name) {
regex_t reg;
regmatch_t regm[5];
bool GeoIPBackend::activateDomainKey(const DNSName& name, unsigned int id) {
if (!d_dnssec) return false;
WriteLock rl(&s_state_lock);
- BOOST_FOREACH(GeoIPDomain dom, s_domains) {
+ for(GeoIPDomain dom : s_domains) {
if (dom.domain == name) {
regex_t reg;
regmatch_t regm[5];
bool GeoIPBackend::deactivateDomainKey(const DNSName& name, unsigned int id) {
if (!d_dnssec) return false;
WriteLock rl(&s_state_lock);
- BOOST_FOREACH(GeoIPDomain dom, s_domains) {
+ for(GeoIPDomain dom : s_domains) {
if (dom.domain == name) {
regex_t reg;
regmatch_t regm[5];
SSqlStatement* d_anyQuery_stmt;
};
-#endif /* MYDNSBACKEND_HH */
\ No newline at end of file
+#endif /* MYDNSBACKEND_HH */
stringtok(parts, opts, ",");
// find out some options and parse them while we're at it
- BOOST_FOREACH(std::string opt, parts) {
+ for(std::string opt : parts) {
std::string key,val;
// make sure there is something else than air in the option...
if (opt.find_first_not_of(" ") == std::string::npos) continue;
JSON_ADD_MEMBER_DNSNAME(parameters, "name", name, query.GetAllocator());
JSON_ADD_MEMBER(parameters, "kind", kind.c_str(), query.GetAllocator());
val.SetArray();
- BOOST_FOREACH(std::string value, meta) {
+ for(std::string value : meta) {
val.PushBack(value.c_str(), query.GetAllocator());
}
parameters.AddMember("value", val, query.GetAllocator());
// but not fatal
if (keys.size() > 1) {
// check that we have two keys
- BOOST_FOREACH(DNSBackend::KeyData &kd, keys) {
+ for(DNSBackend::KeyData &kd : keys) {
BOOST_CHECK(kd.id > 0);
BOOST_CHECK(kd.flags == 256 || kd.flags == 257);
BOOST_CHECK(kd.active == true);
if (!included && !params["include-dir"].empty()) {
std::vector<std::string> extraConfigs;
gatherIncludes(extraConfigs);
- BOOST_FOREACH(const std::string& fn, extraConfigs) {
+ for(const std::string& fn : extraConfigs) {
if (!file(fn.c_str(), lax, true)) {
L << Logger::Error << fn << " could not be parsed" << std::endl;
throw ArgException(fn + " could not be parsed");
hostname=tmp;
boost::replace_all(hostname, ".", "_");
}
- BOOST_FOREACH(const string& entry, entries) {
+ for(const string& entry : entries) {
str<<"pdns."<<hostname<<".auth."<<entry<<' '<<S.read(entry)<<' '<<now<<"\r\n";
}
const string msg = str.str();
try
{
int totcount=0;
- BOOST_FOREACH(DNSDistributor* d, g_distributors) {
+ for(DNSDistributor* d : g_distributors) {
if(!d)
continue;
totcount += d->getQueueSize(); // this does locking and other things, so don't get smart
keyset_t keys = getKeys(zone); // does the cache
- BOOST_FOREACH(keyset_t::value_type& val, keys) {
+ for(keyset_t::value_type& val : keys) {
if(val.second.active) {
return true;
}
{
vector<DNSBackend::KeyData> keys;
d_keymetadb->getDomainKeys(zname, 0, keys);
- BOOST_FOREACH(const DNSBackend::KeyData& kd, keys) {
+ for(const DNSBackend::KeyData& kd : keys) {
if(kd.id != id)
continue;
if(iter != s_keycache.end() && iter->d_ttd > now) {
keyset_t ret;
- BOOST_FOREACH(const keyset_t::value_type& value, iter->d_keys) {
+ for(const keyset_t::value_type& value : iter->d_keys) {
if(boost::indeterminate(allOrKeyOrZone) || allOrKeyOrZone == value.second.keyOrZone)
ret.push_back(value);
}
d_keymetadb->getDomainKeys(zone, 0, dbkeyset);
- BOOST_FOREACH(DNSBackend::KeyData& kd, dbkeyset)
+ for(DNSBackend::KeyData& kd : dbkeyset)
{
DNSSECPrivateKey dpk;
d_keymetadb->getDomainMetadata(zone, "TSIG-ALLOW-AXFR", allowed);
- BOOST_FOREACH(const string& dbkey, allowed) {
+ for(const string& dbkey : allowed) {
if(DNSName(dbkey)==keyname)
return true;
}
keyname->trimToLabels(0);
// XXX FIXME this should check for a specific master!
- BOOST_FOREACH(const string& dbkey, keynames) {
+ for(const string& dbkey : keynames) {
*keyname=DNSName(dbkey);
return true;
}
// cerr<<"Slow: "<<domain<<" ("<<usec/1000.0<<" msec)\n";
if(!g_quiet) {
cout<<domain.name<<"|"<<DNSRecordContent::NumberToType(domain.type)<<": ("<<usec/1000.0<<"msec) rcode: "<<dr.rcode;
- BOOST_FOREACH(const ComboAddress& ca, dr.ips) {
+ for(const ComboAddress& ca : dr.ips) {
cout<<", "<<ca.toString();
}
cout<<endl;
bool getEDNSOpts(const MOADNSParser& mdp, EDNSOpts* eo)
{
if(mdp.d_header.arcount && !mdp.d_answers.empty()) {
- BOOST_FOREACH(const MOADNSParser::answers_t::value_type& val, mdp.d_answers) {
+ for(const MOADNSParser::answers_t::value_type& val : mdp.d_answers) {
if(val.first.d_place == DNSResourceRecord::ADDITIONAL && val.first.d_type == QType::OPT) {
eo->d_packetsize=val.first.d_class;
servfails+=rhs.servfails;
drops+=rhs.drops;
- BOOST_FOREACH(const remotes_t::value_type& rem, rhs.remotes) {
+ for(const remotes_t::value_type& rem : rhs.remotes) {
remotes[rem.first]+=rem.second;
}
return *this;
if(children.size()>1024 && !silent) {
cout<<string(depth, ' ')<<name<<": too many to print"<<endl;
}
- BOOST_FOREACH(const children_t::value_type& child, children) {
+ for(const children_t::value_type& child : children) {
childstat=child.second.print(depth+8, childstat, silent || children.size()>1024);
}
if(!silent || children.size()>1)
Stat selfstat(childstat);
- BOOST_FOREACH(const children_t::value_type& child, children) {
+ for(const children_t::value_type& child : children) {
child.second.visit(visitor, childstat, depth+8);
}
if(labels.empty())
return;
// cerr<<"Submit called for domain='"<<domain<<"': ";
- // BOOST_FOREACH(const std::string& n, labels)
+ // for(const std::string& n : labels)
// cerr<<n<<".";
// cerr<<endl;
if(name.empty()) {
{
if(1.0*childstat.servfails / (childstat.servfails+childstat.noerrors) > 0.8 && node->children.size()>100) {
cout<<node->fullname<<", servfails: "<<childstat.servfails<<", remotes: "<<childstat.remotes.size()<<", children: "<<node->children.size()<<endl;
- BOOST_FOREACH(const StatNode::Stat::remotes_t::value_type& rem, childstat.remotes) {
+ for(const StatNode::Stat::remotes_t::value_type& rem : childstat.remotes) {
cout<<"source: "<<node->fullname<<"\t"<<rem.first.toString()<<"\t"<<rem.second<<endl;
}
}
unsigned int liveQuestions()
{
unsigned int ret=0;
- BOOST_FOREACH(statmap_t::value_type& val, statmap) {
+ for(statmap_t::value_type& val : statmap) {
if(!val.second.d_answercount)
ret++;
// if(val.second.d_qcount > val.second.d_answercount)
ofstream load(g_vm["load-stats"].as<string>().c_str());
if(!load)
throw runtime_error("Error writing load statistics to "+g_vm["load-stats"].as<string>());
- BOOST_FOREACH(pcounts_t::value_type& val, pcounts) {
+ for(pcounts_t::value_type& val : pcounts) {
load<<val.first<<'\t'<<val.second.questions<<'\t'<<val.second.answers<<'\t'<<val.second.outstanding<<'\n';
}
}
cout<<"Saw questions from "<<requestors.size()<<" distinct remotes, answers to "<<recipients.size()<<endl;
ofstream remotes("remotes");
- BOOST_FOREACH(const ComboAddress& rem, requestors) {
+ for(const ComboAddress& rem : requestors) {
remotes<<rem.toString()<<'\n';
}
cout<<"Saw "<<diff.size()<<" unique remotes asking questions, but not getting RA answers"<<endl;
ofstream ignored("ignored");
- BOOST_FOREACH(const ComboAddress& rem, diff) {
+ for(const ComboAddress& rem : diff) {
ignored<<rem.toString()<<'\n';
}
ofstream rdnonrafs("rdnonra");
- BOOST_FOREACH(const ComboAddress& rem, rdnonra) {
+ for(const ComboAddress& rem : rdnonra) {
rdnonrafs<<rem.toString()<<'\n';
}
storvector_t stormap = this->convertToISCVector();
ostringstream ret;
ret<<"Private-key-format: v1.2\n";
- BOOST_FOREACH(const stormap_t::value_type& value, stormap) {
+ for(const stormap_t::value_type& value : stormap) {
if(value.first != "Algorithm" && value.first != "PIN" &&
value.first != "Slot" && value.first != "Engine" &&
value.first != "Label")
{
bool ret=true;
- BOOST_FOREACH(const allmakers_t::value_type& value, getAllMakers())
+ for(const allmakers_t::value_type& value : getAllMakers())
{
- BOOST_FOREACH(maker_t* creator, value.second) {
+ for(maker_t* creator : value.second) {
- BOOST_FOREACH(maker_t* signer, value.second) {
+ for(maker_t* signer : value.second) {
// multi_map<unsigned int, maker_t*> bestSigner, bestVerifier;
- BOOST_FOREACH(maker_t* verifier, value.second) {
+ for(maker_t* verifier : value.second) {
try {
/* pair<unsigned int, unsigned int> res=*/ testMakers(value.first, creator, signer, verifier);
}
{
bool ret=true;
- BOOST_FOREACH(maker_t* creator, getAllMakers()[algo]) {
+ for(maker_t* creator : getAllMakers()[algo]) {
- BOOST_FOREACH(maker_t* signer, getAllMakers()[algo]) {
+ for(maker_t* signer : getAllMakers()[algo]) {
// multi_map<unsigned int, maker_t*> bestSigner, bestVerifier;
- BOOST_FOREACH(maker_t* verifier, getAllMakers()[algo]) {
+ for(maker_t* verifier : getAllMakers()[algo]) {
try {
/* pair<unsigned int, unsigned int> res=*/testMakers(algo, creator, signer, verifier);
}
DNSCryptoKeyEngine* DNSCryptoKeyEngine::makeFromPEMString(DNSKEYRecordContent& drc, const std::string& raw)
{
- BOOST_FOREACH(makers_t::value_type& val, getMakers())
+ for(makers_t::value_type& val : getMakers())
{
DNSCryptoKeyEngine* ret=0;
try {
toHash.append(const_cast<RRSIGRecordContent&>(rrc).serialize(DNSName(), true, true));
toHash.resize(toHash.size() - rrc.d_signature.length()); // chop off the end, don't sign the signature!
- BOOST_FOREACH(shared_ptr<DNSRecordContent>& add, signRecords) {
+ for(shared_ptr<DNSRecordContent>& add : signRecords) {
toHash.append(qname.toDNSString()); // FIXME400 tolower?
uint16_t tmp=htons(rrc.d_type);
toHash.append((char*)&tmp, 2);
set<int> algoHasKSK, algoHasZSK;
vector<DNSSECPrivateKey> signingKeys;
- BOOST_FOREACH(DNSSECKeeper::keyset_t::value_type& keymeta, keys) {
+ for(DNSSECKeeper::keyset_t::value_type& keymeta : keys) {
if(keymeta.second.active) {
if(keymeta.second.keyOrZone)
algoHasKSK.insert(keymeta.first.d_algorithm);
}
}
- BOOST_FOREACH(DNSSECKeeper::keyset_t::value_type& keymeta, keys) {
+ for(DNSSECKeeper::keyset_t::value_type& keymeta : keys) {
if(!keymeta.second.active)
continue;
signingKeys.push_back(keymeta.first);
}
- BOOST_FOREACH(DNSSECPrivateKey& dpk, signingKeys) {
+ for(DNSSECPrivateKey& dpk : signingKeys) {
fillOutRRSIG(dpk, signQName, rrc, toSign);
rrcs.push_back(rrc);
}
rr.ttl=signTTL;
rr.auth=false;
rr.d_place = signPlace;
- BOOST_FOREACH(RRSIGRecordContent& rrc, rrcs) {
+ for(RRSIGRecordContent& rrc : rrcs) {
rr.content = rrc.getZoneRepresentation();
outsigned.push_back(rr);
}
typedef map<time_t, uint32_t> counts_t;
counts_t counts;
- BOOST_FOREACH(const BenchQuery& bq, g_queries) {
+ for(const BenchQuery& bq : g_queries) {
counts[bq.answerSecond]++;
udpspeeds(bq.udpUsec);
tcpspeeds(bq.tcpUsec);
}
- BOOST_FOREACH(const counts_t::value_type& val, counts) {
+ for(const counts_t::value_type& val : counts) {
qps(val.second);
}
return;
}
vector<string> segments = segmentDNSText(text);
- BOOST_FOREACH(const string& str, segments) {
+ for(const string& str : segments) {
d_record.push_back(str.length());
d_record.insert(d_record.end(), str.c_str(), str.c_str() + str.length());
}
respsizes_t respsizes = g_rs.getSizeResponseCounts();
ostringstream os;
boost::format fmt("%d\t%d\n");
- BOOST_FOREACH(const respsizes_t::value_type& val, respsizes) {
+ for(const respsizes_t::value_type& val : respsizes) {
os << (fmt % val.first % val.second).str();
}
return os.str();
totals_t totals = S.getRing("remotes");
string ret;
boost::format fmt("%s\t%d\n");
- BOOST_FOREACH(totals_t::value_type& val, totals) {
+ for(totals_t::value_type& val : totals) {
ret += (fmt % val.first % val.second).str();
}
return ret;
GssContext gssctx(context);
if (!gssctx.valid()) {
L<<Logger::Error<<"GSS context '"<<context<<"' is not valid"<<endl;
- BOOST_FOREACH(const string& error, gssctx.getErrorStrings()) {
+ for(const string& error : gssctx.getErrorStrings()) {
L<<Logger::Error<<"GSS error: "<<error<<endl;;
}
return false;
if (!gssctx.sign(message, tmp_mac)) {
L<<Logger::Error<<"Could not sign message using GSS context '"<<context<<"'"<<endl;
- BOOST_FOREACH(const string& error, gssctx.getErrorStrings()) {
+ for(const string& error : gssctx.getErrorStrings()) {
L<<Logger::Error<<"GSS error: "<<error<<endl;;
}
return false;
GssContext gssctx(context);
if (!gssctx.valid()) {
L<<Logger::Error<<"GSS context '"<<context<<"' is not valid"<<endl;
- BOOST_FOREACH(const string& error, gssctx.getErrorStrings()) {
+ for(const string& error : gssctx.getErrorStrings()) {
L<<Logger::Error<<"GSS error: "<<error<<endl;;
}
return false;
if (!gssctx.verify(message, mac)) {
L<<Logger::Error<<"Could not verify message using GSS context '"<<context<<"'"<<endl;
- BOOST_FOREACH(const string& error, gssctx.getErrorStrings()) {
+ for(const string& error : gssctx.getErrorStrings()) {
L<<Logger::Error<<"GSS error: "<<error<<endl;;
}
return false;
Document doc;
doc.SetObject();
typedef map<string, string> items_t;
- BOOST_FOREACH(const items_t::value_type& val, items) {
+ for(const items_t::value_type& val : items) {
doc.AddMember(val.first.c_str(), val.second.c_str(), doc.GetAllocator());
}
return makeStringFromDocument(doc);
DNSPacket *p=ldp_checkDNSPacket(L);
vector<DNSRecord> rrs;
popResourceRecordsTable(L, DNSName("BOGUS"), rrs);
- BOOST_FOREACH(const DNSRecord& dr, rrs) {
+ for(const DNSRecord& dr : rrs) {
p->addRecord(DNSResourceRecord(dr));
}
return 0;
{
vector<DNSRecord> resolved;
string target; // XXX DNSNAME PAIN
- BOOST_FOREACH(DNSRecord& rr, ret) {
+ for(DNSRecord& rr : ret) {
if(rr.d_type == QType::CNAME) {
target=std::dynamic_pointer_cast<CNAMERecordContent>(rr.d_content)->getTarget().toString();
break;
int rcode=directResolve(target, qtype, 1, resolved); // 1 == class
- BOOST_FOREACH(const DNSRecord& rr, resolved)
+ for(const DNSRecord& rr : resolved)
{
ret.push_back(rr);
}
ComboAddress prefixAddress(prefix);
- BOOST_FOREACH(DNSRecord& rr, ret)
+ for(DNSRecord& rr : ret)
{
if(rr.d_type == QType::A && rr.d_place==DNSResourceRecord::ANSWER) {
ComboAddress ipv4(std::dynamic_pointer_cast<ARecordContent>(rr.d_content)->getCA());
int rcode = directResolve(newquery, QType(QType::PTR), 1, ret);
- BOOST_FOREACH(DNSRecord& rr, ret)
+ for(DNSRecord& rr : ret)
{
if(rr.d_type == QType::PTR && rr.d_place==DNSResourceRecord::ANSWER) {
rr.d_name = qname;
void NotificationQueue::dump()
{
cerr<<"Waiting for notification responses: "<<endl;
- BOOST_FOREACH(NotificationRequest& nr, d_nqueue) {
+ for(NotificationRequest& nr : d_nqueue) {
cerr<<nr.domain.toString()<<", "<<nr.ip<<endl;
}
}
}
storvect.push_back(make_pair("Algorithm", algorithm));
- BOOST_FOREACH(outputs_t::value_type value, outputs) {
+ for(outputs_t::value_type value : outputs) {
unsigned char tmp[mbedtls_mpi_size(value.second)];
mbedtls_mpi_write_binary(value.second, tmp, sizeof(tmp));
storvect.push_back(make_pair(value.first, string((char*)tmp, sizeof(tmp))));
drc.d_algorithm = atoi(stormap["algorithm"].c_str());
string raw;
- BOOST_FOREACH(const places_t::value_type& val, places) {
+ for(const places_t::value_type& val : places) {
raw=stormap[toLower(val.first)];
mbedtls_mpi_read_binary(val.second, (unsigned char*) raw.c_str(), raw.length());
}
bool AddressIsUs(const ComboAddress& remote)
{
- BOOST_FOREACH(const ComboAddress& us, g_localaddresses) {
+ for(const ComboAddress& us : g_localaddresses) {
if(remote == us)
return true;
if(IsAnyAddress(us)) {
int err;
vector<struct pollfd> rfds= d_rfds;
- BOOST_FOREACH(struct pollfd &pfd, rfds) {
+ for(struct pollfd &pfd : rfds) {
pfd.events = POLLIN;
pfd.revents = 0;
}
unixDie("Unable to poll for new UDP events");
}
- BOOST_FOREACH(struct pollfd &pfd, rfds) {
+ for(struct pollfd &pfd : rfds) {
if(pfd.revents & POLLIN) {
sock=pfd.fd;
if((len=recvmsg(sock, &msgh, 0)) < 0 ) {
privAttr = new CK_ATTRIBUTE[privAttributes.size()];
k = 0;
- BOOST_FOREACH(P11KitAttribute& attribute, pubAttributes) {
+ for(P11KitAttribute& attribute : pubAttributes) {
attribute.rattr(pubAttr+k);
k++;
}
k = 0;
- BOOST_FOREACH(P11KitAttribute& attribute, privAttributes) {
+ for(P11KitAttribute& attribute : privAttributes) {
attribute.rattr(privAttr+k);
k++;
}
attr = new CK_ATTRIBUTE[attributes.size()];
k = 0;
- BOOST_FOREACH(const P11KitAttribute& attribute, attributes) {
+ for(const P11KitAttribute& attribute : attributes) {
attribute.rattr(attr+k);
k++;
}
attr = new CK_ATTRIBUTE[attributes.size()];
k = 0;
- BOOST_FOREACH(P11KitAttribute &attribute, attributes) {
+ for(P11KitAttribute &attribute : attributes) {
attribute.wattr(attr+k);
k++;
}
#ifndef PDNS_PUBSUFFIX_HH
extern const char* g_pubsuffix;
-#endif
\ No newline at end of file
+#endif
hostname=tmp;
boost::replace_all(hostname, ".", "_");
}
- BOOST_FOREACH(const all_t::value_type& val, all) {
+ for(const all_t::value_type& val : all) {
str<<"pdns."<<hostname<<".recursor."<<val.first<<' '<<val.second<<' '<<now<<"\r\n";
}
const string msg = str.str();
uint64_t RecursorPacketCache::bytes()
{
uint64_t sum=0;
- BOOST_FOREACH(const struct Entry& e, d_packetCache) {
+ for(const struct Entry& e : d_packetCache) {
sum += sizeof(e) + e.d_packet.length() + 4;
}
return sum;
std::vector<std::string> extraConfigs;
::arg().gatherIncludes(extraConfigs);
- BOOST_FOREACH(const std::string& fn, extraConfigs) {
+ for(const std::string& fn : extraConfigs) {
::arg().preParseFile(fn.c_str(), "forward-zones", ::arg()["forward-zones"]);
::arg().preParseFile(fn.c_str(), "forward-zones-file", ::arg()["forward-zones-file"]);
::arg().preParseFile(fn.c_str(), "forward-zones-recurse", ::arg()["forward-zones-recurse"]);
*theirInception = *theirExpire = 0;
bool gotSOA=false;
- BOOST_FOREACH(const MOADNSParser::answers_t::value_type& drc, mdp.d_answers) {
+ for(const MOADNSParser::answers_t::value_type& drc : mdp.d_answers) {
if(drc.first.d_type == QType::SOA) {
shared_ptr<SOARecordContent> src=std::dynamic_pointer_cast<SOARecordContent>(drc.first.d_content);
*theirSerial=src->d_st.serial;
if(err)
throw ResolverException("AXFR chunk error: " + RCode::to_s(err));
- BOOST_FOREACH(const MOADNSParser::answers_t::value_type& answer, mdp.d_answers)
+ for(const MOADNSParser::answers_t::value_type& answer : mdp.d_answers)
if (answer.first.d_type == QType::SOA)
d_soacount++;
string theirMac;
bool checkTSIG = false;
- BOOST_FOREACH(const MOADNSParser::answers_t::value_type& answer, mdp.d_answers) {
+ for(const MOADNSParser::answers_t::value_type& answer : mdp.d_answers) {
if (answer.first.d_type == QType::SOA) // A SOA is either the first or the last record. We need to check TSIG if that's the case.
checkTSIG = true;
qtypenums_t qtypenums = getQTypeResponseCounts();
ostringstream os;
boost::format fmt("%s\t%d\n");
- BOOST_FOREACH(const qtypenums_t::value_type& val, qtypenums) {
+ for(const qtypenums_t::value_type& val : qtypenums) {
os << (fmt %DNSRecordContent::NumberToType( val.first) % val.second).str();
}
return os.str();
DNSName shorter;
string hashed;
- BOOST_FOREACH(const DNSName& qname, qnames) {
+ for(const DNSName& qname : qnames) {
shorter = qname;
int ddepth = 0;
do {
pwtkey.startRecord(gssctx.getLabel(), QType::TKEY, 3600, QClass::ANY, DNSResourceRecord::ADDITIONAL, false);
tkrc.toPacket(pwtkey);
pwtkey.commit();
- BOOST_FOREACH(const string& msg, gssctx.getErrorStrings()) {
+ for(const string& msg : gssctx.getErrorStrings()) {
cerr<<msg<<endl;
}
}
L<<Logger::Debug<<msg.substr(0, msg.length() - 2)<<endl;
- BOOST_FOREACH(ComboAddress& dest, s_secpollresolvers) {
+ for(ComboAddress& dest : s_secpollresolvers) {
Socket sock(dest.sin4.sin_family, SOCK_DGRAM);
sock.setNonBlocking();
sock.sendTo(string(packet.begin(), packet.end()), dest);
bool editSOA(DNSSECKeeper& dk, const DNSName& qname, DNSPacket* dp)
{
vector<DNSResourceRecord>& rrs = dp->getRRS();
- BOOST_FOREACH(DNSResourceRecord& rr, rrs) {
+ for(DNSResourceRecord& rr : rrs) {
if(rr.qtype.getCode() == QType::SOA && rr.qname == qname) {
string kind;
dk.getSoaEdit(qname, kind);
delete d_rrsetToSign;
if(!d_mustSign)
return;
- BOOST_FOREACH(int fd, d_sockets) {
+ for(int fd : d_sockets) {
close(fd); // this will trigger all threads to exit
}
void* res;
- BOOST_FOREACH(pthread_t& tid, d_tids) {
+ for(pthread_t& tid : d_tids) {
pthread_join(tid, &res);
}
//cout<<"Did: "<<d_signed<<", records (!= chunks) submitted: "<<d_submitted<<endl;
while(d_outstanding) {
chunk_t* chunk;
- BOOST_FOREACH(int fd, rwVect.first) {
+ for(int fd : rwVect.first) {
if(d_eof.count(fd))
continue;
unsigned int ChunkedSigningPipe::getReady()
{
unsigned int sum=0;
- BOOST_FOREACH(const std::vector<DNSResourceRecord>& v, d_chunks) {
+ for(const std::vector<DNSResourceRecord>& v : d_chunks) {
sum += v.size();
}
return sum;
d_final = true;
flushToSign();
- BOOST_FOREACH(int fd, d_sockets) {
+ for(int fd : d_sockets) {
shutdown(fd, SHUT_WR); // perhaps this transmits EOF the other side
//cerr<<"shutdown of "<<fd<<endl;
}
out.push_back(*i);
}
- BOOST_FOREACH(DNSResourceRecord& rr, out) {
+ for(DNSResourceRecord& rr : out) {
switch(rr.qtype.getCode()) {
case QType::NSEC3PARAM: {
ns3pr = NSEC3PARAMRecordContent(rr.content);
map<DNSName,bool> nonterm;
- BOOST_FOREACH(DNSResourceRecord& rr, rrs) {
+ for(DNSResourceRecord& rr : rrs) {
if(!isPresigned) {
if (rr.qtype.getCode() == QType::RRSIG)
d_potentialsupermasters.clear();
}
- BOOST_FOREACH(DNSPacket& dp, trysuperdomains) {
+ for(DNSPacket& dp : trysuperdomains) {
int res;
res=P->trySuperMasterSynchronous(&dp);
if(res>=0) {
Lock l(&d_lock);
domains_by_name_t& nameindex=boost::multi_index::get<IDTag>(d_suckdomains);
- BOOST_FOREACH(DomainInfo& di, rdomains) {
+ for(DomainInfo& di : rdomains) {
std::vector<std::string> localaddr;
SuckRequest sr;
sr.domain=di.zone;
L<<Logger::Warning<<"Received serial number updates for "<<ssr.d_freshness.size()<<" zones, had "<<ifl.getTimeouts()<<" timeouts"<<endl;
typedef DomainNotificationInfo val_t;
- BOOST_FOREACH(val_t& val, sdomains) {
+ for(val_t& val : sdomains) {
DomainInfo& di(val.di);
// might've come from the packethandler
if(!di.backend && !B->getDomainInfo(di.zone, di)) {
}
- BOOST_FOREACH(const funcstats_t::value_type& val, d_funcstats) {
+ for(const funcstats_t::value_type& val : d_funcstats) {
o << val.first<<"="<<val.second(val.first)<<",";
}
dir=o.str();
i++)
ret.push_back(i->first);
- BOOST_FOREACH(const funcstats_t::value_type& val, d_funcstats) {
+ for(const funcstats_t::value_type& val : d_funcstats) {
ret.push_back(val.first);
}
typedef pair<SComboAddress, unsigned int> stor_t;
vector<stor_t> raw =d_comborings[name].get();
vector<pair<string, unsigned int> > ret;
- BOOST_FOREACH(const stor_t& stor, raw) {
+ for(const stor_t& stor : raw) {
ret.push_back(make_pair(stor.first.ca.toString(), stor.second));
}
return ret;
(case_t(std::string("foobar"), std::string("cpnmuoj1e8======")))
;
- BOOST_FOREACH(const case_t& val, cases) {
+ for(const case_t& val : cases) {
std::string res;
res = toBase32Hex(val.get<0>());
BOOST_CHECK_EQUAL(res, val.get<1>());
("eSHBt7Xx5F7A4HFtabXEzDLD01bnSiG","ZVNIQnQ3WHg1RjdBNEhGdGFiWEV6RExEMDFiblNpRw==")
("dq4KydZjmcoQQ45VYBP2EDR8FqKaMul0","ZHE0S3lkWmptY29RUTQ1VllCUDJFRFI4RnFLYU11bDA=");
- BOOST_FOREACH(const cases_t::value_type& val, cases) {
+ for(const cases_t::value_type& val : cases) {
std::string encoded = Base64Encode(val.first), decoded;
BOOST_CHECK_EQUAL(encoded, val.second);
decoded.clear();
int n=0;
int lq=-1;
- BOOST_FOREACH(const cases_t::value_type& val, cases) {
+ for(const cases_t::value_type& val : cases) {
QType q(val.get<0>());
if (lq != q.getCode()) n = 0;
lq = q.getCode();
int n=0;
int lq=-1;
- BOOST_FOREACH(const cases_t::value_type& val, cases) {
+ for(const cases_t::value_type& val : cases) {
QType q(val.get<0>());
if (lq != q.getCode()) n = 0;
lq = q.getCode();
(case_t(std::string("Abc"), std::string("abc"), false))
;
- BOOST_FOREACH(const case_t& val, cases) {
+ for(const case_t& val : cases) {
bool res;
res = pdns_ilexicographical_compare(val.get<0>(), val.get<1>());
BOOST_CHECK_EQUAL(res, val.get<2>());
(case_t(std::string("Abc"), std::string("abc"), true))
;
- BOOST_FOREACH(const case_t& val, cases) {
+ for(const case_t& val : cases) {
bool res;
res = pdns_iequals(val.get<0>(), val.get<1>());
BOOST_CHECK_EQUAL(res, val.get<2>());
(case_t("abc", "a9 99 3e 36 47 06 81 6a ba 3e 25 71 78 50 c2 6c 9c d0 d8 9d "))
(case_t("abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq", "84 98 3e 44 1c 3b d2 6e ba ae 4a a1 f9 51 29 e5 e5 46 70 f1 "));
- BOOST_FOREACH(case_t& val, cases) {
+ for(case_t& val : cases) {
SHA1Summer s;
s.feed(val.get<0>());
BOOST_CHECK_EQUAL(makeHexDump(s.get()), val.get<1>());
(case_t("abc", "ba 78 16 bf 8f 01 cf ea 41 41 40 de 5d ae 22 23 b0 03 61 a3 96 17 7a 9c b4 10 ff 61 f2 00 15 ad "))
(case_t("abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq", "24 8d 6a 61 d2 06 38 b8 e5 c0 26 93 0c 3e 60 39 a3 3c e4 59 64 ff 21 67 f6 ec ed d4 19 db 06 c1 "));
- BOOST_FOREACH(case_t& val, cases) {
+ for(case_t& val : cases) {
SHA256Summer s;
s.feed(val.get<0>());
BOOST_CHECK_EQUAL(makeHexDump(s.get()), val.get<1>());
(case_t("abc", "cb 00 75 3f 45 a3 5e 8b b5 a0 3d 69 9a c6 50 07 27 2c 32 ab 0e de d1 63 1a 8b 60 5a 43 ff 5b ed 80 86 07 2b a1 e7 cc 23 58 ba ec a1 34 c8 25 a7 "))
(case_t("abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq", "33 91 fd dd fc 8d c7 39 37 07 a6 5b 1b 47 09 39 7c f8 b1 d1 62 af 05 ab fe 8f 45 0d e5 f3 6b c6 b0 45 5a 85 20 bc 4e 6f 5f e9 5b 1f e3 c8 45 2b "));
- BOOST_FOREACH(case_t& val, cases) {
+ for(case_t& val : cases) {
SHA384Summer s;
s.feed(val.get<0>());
BOOST_CHECK_EQUAL(makeHexDump(s.get()), val.get<1>());
(case_t("abc", "dd af 35 a1 93 61 7a ba cc 41 73 49 ae 20 41 31 12 e6 fa 4e 89 a9 7e a2 0a 9e ee e6 4b 55 d3 9a 21 92 99 2a 27 4f c1 a8 36 ba 3c 23 a3 fe eb bd 45 4d 44 23 64 3c e8 0e 2a 9a c9 4f a5 4c a4 9f "))
(case_t("abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq", "20 4a 8f c6 dd a8 2f 0a 0c ed 7b eb 8e 08 a4 16 57 c1 6e f4 68 b2 28 a8 27 9b e3 31 a7 03 c3 35 96 fd 15 c1 3b 1b 07 f9 aa 1d 3b ea 57 78 9c a0 31 ad 85 c7 a7 1d d7 03 54 ec 63 12 38 ca 34 45 "));
- BOOST_FOREACH(case_t& val, cases) {
+ for(case_t& val : cases) {
SHA512Summer s;
s.feed(val.get<0>());
BOOST_CHECK_EQUAL(makeHexDump(s.get()), val.get<1>());
bool UeberBackend::createDomain(const DNSName &domain)
{
- BOOST_FOREACH(DNSBackend* mydb, backends) {
+ for(DNSBackend* mydb : backends) {
if(mydb->createDomain(domain)) {
return true;
}
int UeberBackend::addDomainKey(const DNSName& name, const DNSBackend::KeyData& key)
{
int ret;
- BOOST_FOREACH(DNSBackend* db, backends) {
+ for(DNSBackend* db : backends) {
if((ret = db->addDomainKey(name, key)) >= 0)
return ret;
}
}
bool UeberBackend::getDomainKeys(const DNSName& name, unsigned int kind, std::vector<DNSBackend::KeyData>& keys)
{
- BOOST_FOREACH(DNSBackend* db, backends) {
+ for(DNSBackend* db : backends) {
if(db->getDomainKeys(name, kind, keys))
return true;
}
bool UeberBackend::getAllDomainMetadata(const DNSName& name, std::map<std::string, std::vector<std::string> >& meta)
{
- BOOST_FOREACH(DNSBackend* db, backends) {
+ for(DNSBackend* db : backends) {
if(db->getAllDomainMetadata(name, meta))
return true;
}
bool UeberBackend::getDomainMetadata(const DNSName& name, const std::string& kind, std::vector<std::string>& meta)
{
- BOOST_FOREACH(DNSBackend* db, backends) {
+ for(DNSBackend* db : backends) {
if(db->getDomainMetadata(name, kind, meta))
return true;
}
bool UeberBackend::setDomainMetadata(const DNSName& name, const std::string& kind, const std::vector<std::string>& meta)
{
- BOOST_FOREACH(DNSBackend* db, backends) {
+ for(DNSBackend* db : backends) {
if(db->setDomainMetadata(name, kind, meta))
return true;
}
bool UeberBackend::activateDomainKey(const DNSName& name, unsigned int id)
{
- BOOST_FOREACH(DNSBackend* db, backends) {
+ for(DNSBackend* db : backends) {
if(db->activateDomainKey(name, id))
return true;
}
bool UeberBackend::deactivateDomainKey(const DNSName& name, unsigned int id)
{
- BOOST_FOREACH(DNSBackend* db, backends) {
+ for(DNSBackend* db : backends) {
if(db->deactivateDomainKey(name, id))
return true;
}
bool UeberBackend::removeDomainKey(const DNSName& name, unsigned int id)
{
- BOOST_FOREACH(DNSBackend* db, backends) {
+ for(DNSBackend* db : backends) {
if(db->removeDomainKey(name, id))
return true;
}
bool UeberBackend::getTSIGKey(const DNSName& name, DNSName* algorithm, string* content)
{
- BOOST_FOREACH(DNSBackend* db, backends) {
+ for(DNSBackend* db : backends) {
if(db->getTSIGKey(name, algorithm, content))
return true;
}
bool UeberBackend::setTSIGKey(const DNSName& name, const DNSName& algorithm, const string& content)
{
- BOOST_FOREACH(DNSBackend* db, backends) {
+ for(DNSBackend* db : backends) {
if(db->setTSIGKey(name, algorithm, content))
return true;
}
bool UeberBackend::deleteTSIGKey(const DNSName& name)
{
- BOOST_FOREACH(DNSBackend* db, backends) {
+ for(DNSBackend* db : backends) {
if(db->deleteTSIGKey(name))
return true;
}
bool UeberBackend::getTSIGKeys(std::vector< struct TSIGKey > &keys)
{
- BOOST_FOREACH(DNSBackend* db, backends) {
+ for(DNSBackend* db : backends) {
db->getTSIGKeys(keys);
}
return true;
string value;
Document doc;
doc.SetArray();
- BOOST_FOREACH(const string& item, items) {
+ for(const string& item : items) {
Value jitem;
jitem.SetObject();
jitem.AddMember("type", "ConfigSetting", doc.GetAllocator());
Document doc;
doc.SetArray();
if(!lines.empty()) {
- BOOST_FOREACH(const string& line, lines) {
+ for(const string& line : lines) {
doc.PushBack(line.c_str(), doc.GetAllocator());
}
}
Document doc;
doc.SetArray();
typedef map<string, string> items_t;
- BOOST_FOREACH(const items_t::value_type& item, items) {
+ for(const items_t::value_type& item : items) {
Value jitem;
jitem.SetObject();
jitem.AddMember("type", "StatisticItem", doc.GetAllocator());
vector<string> entries;
t_allowFrom->toStringVector(&entries);
- BOOST_FOREACH(const string& entry, entries) {
+ for(const string& entry : entries) {
Value jentry(entry.c_str(), document.GetAllocator()); // copy
jlist.PushBack(jentry, document.GetAllocator());
}
doc.AddMember("kind", zone.d_servers.empty() ? "Native" : "Forwarded", doc.GetAllocator());
Value servers;
servers.SetArray();
- BOOST_FOREACH(const ComboAddress& server, zone.d_servers) {
+ for(const ComboAddress& server : zone.d_servers) {
Value value(server.toStringWithPort().c_str(), doc.GetAllocator());
servers.PushBack(value, doc.GetAllocator());
}
Value records;
records.SetArray();
- BOOST_FOREACH(const SyncRes::AuthDomain::records_t::value_type& dr, zone.d_records) {
+ for(const SyncRes::AuthDomain::records_t::value_type& dr : zone.d_records) {
Value object;
object.SetObject();
Value jname(dr.d_name.toString().c_str(), doc.GetAllocator()); // copy
Document doc;
doc.SetArray();
- BOOST_FOREACH(const SyncRes::domainmap_t::value_type& val, *t_sstorage->domainmap) {
+ for(const SyncRes::domainmap_t::value_type& val : *t_sstorage->domainmap) {
const SyncRes::AuthDomain& zone = val.second;
Value jdi;
jdi.SetObject();
jdi.AddMember("kind", zone.d_servers.empty() ? "Native" : "Forwarded", doc.GetAllocator());
Value servers;
servers.SetArray();
- BOOST_FOREACH(const ComboAddress& server, zone.d_servers) {
+ for(const ComboAddress& server : zone.d_servers) {
Value value(server.toStringWithPort().c_str(), doc.GetAllocator());
servers.PushBack(value, doc.GetAllocator());
}
Document doc;
doc.SetArray();
- BOOST_FOREACH(const SyncRes::domainmap_t::value_type& val, *t_sstorage->domainmap) {
+ for(const SyncRes::domainmap_t::value_type& val : *t_sstorage->domainmap) {
string zoneId = apiZoneNameToId(val.first);
if (pdns_ci_find(val.first.toString(), q) != string::npos) {
Value object;
const SyncRes::AuthDomain& zone = val.second;
- BOOST_FOREACH(const SyncRes::AuthDomain::records_t::value_type& rr, zone.d_records) {
+ for(const SyncRes::AuthDomain::records_t::value_type& rr : zone.d_records) {
if (pdns_ci_find(rr.d_name.toString(), q) == string::npos && pdns_ci_find(rr.d_content->getZoneRepresentation(), q) == string::npos)
continue;
typedef map<query_t,unsigned int> counts_t;
counts_t counts;
unsigned int total=0;
- BOOST_FOREACH(const query_t& q, queries) {
+ for(const query_t& q : queries) {
total++;
if(filter)
counts[make_pair(getRegisteredName(q.first), q.second)]++;
Value entries;
entries.SetArray();
unsigned int tot=0, totIncluded=0;
- BOOST_FOREACH(const rcounts_t::value_type& q, rcounts) {
+ for(const rcounts_t::value_type& q : rcounts) {
Value arr;
arr.SetArray();
typedef map<ComboAddress,unsigned int,ComboAddress::addressOnlyLessThan> counts_t;
counts_t counts;
unsigned int total=0;
- BOOST_FOREACH(const ComboAddress& q, queries) {
+ for(const ComboAddress& q : queries) {
total++;
counts[q]++;
}
Value entries;
entries.SetArray();
unsigned int tot=0, totIncluded=0;
- BOOST_FOREACH(const rcounts_t::value_type& q, rcounts) {
+ for(const rcounts_t::value_type& q : rcounts) {
totIncluded-=q.first;
Value arr;
if(g_mode==POSTGRES || g_mode==MYSQL || g_mode==SQLITE) {
string mstrs;
if (masters != 0 && ! masters->empty()) {
- BOOST_FOREACH(const string& mstr, *masters) {
+ for(const string& mstr : *masters) {
mstrs.append(mstr);
mstrs.append(1, ' ');
}