LuaConfigItems::LuaConfigItems()
{
auto ds=unique_ptr<DSRecordContent>(dynamic_cast<DSRecordContent*>(DSRecordContent::make("19036 8 2 49aac11d7b6f6446702e54a1607371607a1a41855200fd2ce1cdde32f24e8fb5")));
- dsmap_t dsmap;
- dsmap.insert({ds->d_tag, *ds});
- // this hurts physically
- dsAnchors[DNSName(".")] = dsmap;
+ dsAnchors[DNSName(".")].insert(*ds);
}
/* DID YOU READ THE STORY ABOVE? */
Lua.writeFunction("addDS", [&lci](const std::string& who, const std::string& what) {
DNSName zone(who);
- dsmap_t dsmap = lci.dsAnchors[zone];
-
auto ds = unique_ptr<DSRecordContent>(dynamic_cast<DSRecordContent*>(DSRecordContent::make(what)));
- dsmap.insert({ds->d_tag, *ds});
- lci.dsAnchors[zone] = dsmap;
+ lci.dsAnchors[zone].insert(*ds);
});
Lua.writeFunction("clearDS", [&lci](boost::optional<string> who) {
try {
L<<Logger::Warning<<"Adding Trust Anchor for "<<who<<" with data '"<<what<<"', requested via control channel";
g_luaconfs.modify([who, what](LuaConfigItems& lci) {
- dsmap_t dsmap = lci.dsAnchors[who];
auto ds = unique_ptr<DSRecordContent>(dynamic_cast<DSRecordContent*>(DSRecordContent::make(what)));
- dsmap.insert({ds->d_tag, *ds});
- lci.dsAnchors[who] = dsmap;
+ lci.dsAnchors[who].insert(*ds);
});
broadcastAccFunction<uint64_t>(boost::bind(pleaseWipePacketCache, who, true));
L<<Logger::Warning<<endl;
for (auto anchor : luaconf->dsAnchors) {
ret += anchor.first.toLogString() + "\n";
for (auto e : anchor.second) {
- ret+="\t\t"+e.second.getZoneRepresentation() + "\n";
+ ret+="\t\t"+e.getZoneRepresentation() + "\n";
}
}
LuaConfigItems::LuaConfigItems()
{
auto ds=std::unique_ptr<DSRecordContent>(dynamic_cast<DSRecordContent*>(DSRecordContent::make("19036 8 2 49aac11d7b6f6446702e54a1607371607a1a41855200fd2ce1cdde32f24e8fb5")));
- // this hurts physically
- dsmap_t dsmap;
- dsmap.insert({ds->d_tag, *ds});
- dsAnchors[DNSName(".")] = dsmap;
+ dsAnchors[DNSName(".")].insert(*ds);
}
DNSFilterEngine::DNSFilterEngine() {}
}
LOG("got "<<tkeys.size()<<" keys and "<<sigs.size()<<" sigs from server"<<endl);
- for(dsmap_t::const_iterator i=dsmap.begin(); i!=dsmap.end(); i++)
+ for(auto const& dsrc : dsmap)
{
- DSRecordContent dsrc=i->second;
- auto r = getByTag(tkeys, i->first);
+ auto r = getByTag(tkeys, dsrc.d_tag);
// cerr<<"looking at DS with tag "<<dsrc.d_tag<<"/"<<i->first<<", got "<<r.size()<<" DNSKEYs for tag"<<endl;
- for(const auto& drc : r)
+ for(const auto& drc : r)
{
bool isValid = false;
DSRecordContent dsrc2;
}
if(isValid) {
- LOG("got valid DNSKEY (it matches the DS) with tag "<<dsrc.d_tag<<"/"<<i->first<<" for "<<qname<<endl);
+ LOG("got valid DNSKEY (it matches the DS) with tag "<<dsrc.d_tag<<" for "<<qname<<endl);
validkeys.insert(drc);
dotNode("DS", qname, "" /*std::to_string(dsrc.d_tag)*/, (boost::format("tag=%d, digest algo=%d, algo=%d") % dsrc.d_tag % static_cast<int>(dsrc.d_digesttype) % static_cast<int>(dsrc.d_algorithm)).str());
{
const auto dsrc=std::dynamic_pointer_cast<DSRecordContent>(*j);
if(dsrc) {
- dsmap.insert(make_pair(dsrc->d_tag, *dsrc));
+ dsmap.insert(*dsrc);
// dotEdge(keyqname,
// "DNSKEY", keyqname, ,
// "DS", qname, std::to_string(dsrc.d_tag));
// ponder adding a validate method that accepts a key
};
typedef map<pair<DNSName,uint16_t>, ContentSigPair> cspmap_t;
-typedef std::multimap<uint16_t, DSRecordContent> dsmap_t;
+typedef std::set<DSRecordContent> dsmap_t;
void validateWithKeySet(const cspmap_t& rrsets, cspmap_t& validated, const std::set<DNSKEYRecordContent>& keys);
cspmap_t harvestCSPFromRecs(const vector<DNSRecord>& recs);
vState getKeysFor(DNSRecordOracle& dro, const DNSName& zone, std::set<DNSKEYRecordContent> &keyset);