From: Aki Tuomi Date: Fri, 11 Sep 2015 09:17:12 +0000 (+0300) Subject: Rectify records X-Git-Tag: dnsdist-1.0.0-alpha1~248^2~49^2 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=6f6b146f571d42f0f8d84fc7b2c01960d2ae89f1;p=pdns Rectify records --- diff --git a/modules/geoipbackend/geoipbackend.cc b/modules/geoipbackend/geoipbackend.cc index 2e7d2acc7..c3edfa419 100644 --- a/modules/geoipbackend/geoipbackend.cc +++ b/modules/geoipbackend/geoipbackend.cc @@ -121,6 +121,48 @@ void GeoIPBackend::initialize() { dom.services[DNSName(service->first.as())] = service->second.as(); } + // rectify the zone, first static records + for(auto &item : dom.records) { + // ensure we have parent in records + DNSName name = item.first; + while(name.chopOff() && name.isPartOf(dom.domain)) { + if (dom.records.find(name) == dom.records.end()) { + DNSResourceRecord rr; + vector rrs; + rr.domain_id = dom.id; + rr.ttl = dom.ttl; + rr.qname = name; + rr.qtype = "NULL"; + rr.content = ""; + rr.auth = 1; + rr.d_place = DNSResourceRecord::ANSWER; + rrs.push_back(rr); + std::swap(dom.records[name], rrs); + } + } + } + + // then services + for(auto &item : dom.services) { + // ensure we have parent in records + DNSName name = item.first; + while(name.chopOff() && name.isPartOf(dom.domain)) { + if (dom.records.find(name) == dom.records.end()) { + DNSResourceRecord rr; + vector rrs; + rr.domain_id = dom.id; + rr.ttl = dom.ttl; + rr.qname = name; + rr.qtype = "NULL"; + rr.content = ""; + rr.auth = 1; + rr.d_place = DNSResourceRecord::ANSWER; + rrs.push_back(rr); + std::swap(dom.records[name], rrs); + } + } + } + tmp_domains.push_back(dom); }