return true;
}
-bool Bind2Backend::feedRecord(const DNSResourceRecord &rr, const DNSName &ordername)
+bool Bind2Backend::feedRecord(const DNSResourceRecord &rr, const DNSName &ordername, bool ordernameIsNSEC3)
{
BB2DomainInfo bbd;
if (!safeGetBBDomainInfo(d_transaction_id, &bbd))
void setFresh(uint32_t domain_id) override;
void setNotified(uint32_t id, uint32_t serial) override;
bool startTransaction(const DNSName &qname, int id) override;
- bool feedRecord(const DNSResourceRecord &rr, const DNSName &ordername) override;
+ bool feedRecord(const DNSResourceRecord &rr, const DNSName &ordername, bool ordernameIsNSEC3=false) override;
bool commitTransaction() override;
bool abortTransaction() override;
void alsoNotifies(const DNSName &domain, set<string> *ips) override;
ret += rr.content;
ret.append((const char*)&rr.ttl, 4);
ret.append(1, (char)rr.auth);
+ ret.append(1, (char)false);
ret.append(1, (char)rr.disabled);
return ret;
}
memcpy(&len, &str[0], 2);
rr.content.assign(&str[2], len); // len bytes
memcpy(&rr.ttl, &str[2] + len, 4);
- rr.auth = str[str.size()-2];
+ rr.auth = str[str.size()-3];
rr.disabled = str[str.size()-1];
rr.wildcardname.clear();
}
}
// d_rwtxn must be set here
-bool LMDBBackend::feedRecord(const DNSResourceRecord &r, const DNSName &ordername)
+bool LMDBBackend::feedRecord(const DNSResourceRecord &r, const DNSName &ordername, bool ordernameIsNSEC3)
{
DNSResourceRecord rr(r);
rr.qname.makeUsRelative(d_transactiondomain);
rr.content = serializeContent(rr.qtype.getCode(), r.qname, rr.content);
+ rr.disabled = false;
compoundOrdername co;
d_rwtxn->txn.put(d_rwtxn->db->dbi, co(r.domain_id, rr.qname, rr.qtype.getCode()), serToString(rr));
- if(!ordername.empty()) {
+ if(ordernameIsNSEC3 && !ordername.empty()) {
+ MDBOutVal val;
+ if(d_rwtxn->txn.get(d_rwtxn->db->dbi, co(r.domain_id, rr.qname, QType::NSEC3), val)) {
rr.ttl = 0;
- rr.auth = 0;
rr.content=rr.qname.toDNSStringLC();
+ rr.auth = 0;
string ser = serToString(rr);
d_rwtxn->txn.put(d_rwtxn->db->dbi, co(r.domain_id, ordername, QType::NSEC3), ser);
rr.content = ordername.toDNSString();
ser = serToString(rr);
d_rwtxn->txn.put(d_rwtxn->db->dbi, co(r.domain_id, rr.qname, QType::NSEC3), ser);
+ }
}
return true;
}
for(const auto& nt: nonterm) {
rr.qname = nt.first.makeRelative(d_transactiondomain);
rr.auth = nt.second;
- std::string ser = serToString(rr);
+ rr.disabled = true;
+ std::string ser = serToString(rr);
d_rwtxn->txn.put(d_rwtxn->db->dbi, co(domain_id, rr.qname, 0), ser);
}
return true;
bool LMDBBackend::feedEnts3(int domain_id, const DNSName &domain, map<DNSName,bool> &nonterm, const NSEC3PARAMRecordContent& ns3prc, bool narrow)
{
+ string ser;
DNSName ordername;
DNSResourceRecord rr;
compoundOrdername co;
rr.qname = nt.first.makeRelative(domain);
rr.ttl = 0;
rr.auth = nt.second;
- rr.disabled = true;
- string ser = serToString(rr);
-
+ rr.disabled = nt.second;
+ ser = serToString(rr);
d_rwtxn->txn.put(d_rwtxn->db->dbi, co(domain_id, rr.qname, 0), ser);
if(!narrow && rr.auth) {
- rr.auth=0;
- rr.content=rr.qname.toDNSString();
+ rr.content = rr.qname.toDNSString();
+ rr.auth = false;
+ rr.disabled = false;
ser = serToString(rr);
ordername=DNSName(toBase32Hex(hashQNameWithSalt(ns3prc, nt.first)));
bool startTransaction(const DNSName &domain, int domain_id=-1) override;
bool commitTransaction() override;
bool abortTransaction() override;
- bool feedRecord(const DNSResourceRecord &r, const DNSName &ordername) override;
+ bool feedRecord(const DNSResourceRecord &r, const DNSName &ordername, bool ordernameIsNSEC3=false) override;
bool feedEnts(int domain_id, map<DNSName,bool>& nonterm) override;
bool feedEnts3(int domain_id, const DNSName &domain, map<DNSName,bool> &nonterm, const NSEC3PARAMRecordContent& ns3prc, bool narrow) override;
bool replaceRRSet(uint32_t domain_id, const DNSName& qname, const QType& qt, const vector<DNSResourceRecord>& rrset) override;
bool startTransaction(const DNSName &qname, int id) override;
bool commitTransaction() override;
bool abortTransaction() override;
- bool feedRecord(const DNSResourceRecord &rr, const DNSName &ordername) override;
+ bool feedRecord(const DNSResourceRecord &rr, const DNSName &ordername, bool ordernameIsNSEC3=false) override;
// SUPERMASTER BACKEND
virtual bool startTransaction(const string &qname, int id);
virtual bool commitTransaction();
virtual bool abortTransaction();
- virtual bool feedRecord(const DNSResourceRecord &rr, DNSName &ordername);
+ virtual bool feedRecord(const DNSResourceRecord &rr, DNSName &ordername, bool ordernameIsNSEC3);
virtual bool getDomainInfo(const string &domain, DomainInfo &di);
virtual void getUnfreshSlaveInfos(vector<DomainInfo>* domains);
return ok;
}
-bool LUABackend::feedRecord(const DNSResourceRecord &rr, const DNSName &ordername) {
+bool LUABackend::feedRecord(const DNSResourceRecord &rr, const DNSName &ordername, bool ordernameIsNSEC3) {
if (f_lua_feedrecord == 0)
return false;
-bool OdbxBackend::feedRecord( const DNSResourceRecord& rr, const DNSName& ordername )
+bool OdbxBackend::feedRecord( const DNSResourceRecord& rr, const DNSName& ordername, bool ordernameIsNSEC3 )
{
try
{
bool abortTransaction() override;
bool getDomainInfo( const DNSName& domain, DomainInfo& di, bool getSerial=true ) override;
- bool feedRecord( const DNSResourceRecord& rr, const DNSName& ordername ) override;
+ bool feedRecord( const DNSResourceRecord& rr, const DNSName& ordername, bool ordernameIsNSEC3=false ) override;
bool createSlaveDomain( const string& ip, const DNSName& domain, const string &nameserver, const string& account ) override;
bool superMasterBackend( const string& ip, const DNSName& domain, const vector<DNSResourceRecord>& nsset, string *nameserver, string* account, DNSBackend** ddb ) override;
return true;
}
-bool RemoteBackend::feedRecord(const DNSResourceRecord &rr, const DNSName &ordername) {
+bool RemoteBackend::feedRecord(const DNSResourceRecord &rr, const DNSName &ordername, bool ordernameIsNSEC3) {
Json query = Json::object{
{ "method", "feedRecord" },
{ "parameters", Json::object{
bool superMasterBackend(const string &ip, const DNSName& domain, const vector<DNSResourceRecord>&nsset, string *nameserver, string *account, DNSBackend **ddb) override;
bool createSlaveDomain(const string &ip, const DNSName& domain, const string& nameserver, const string &account) override;
bool replaceRRSet(uint32_t domain_id, const DNSName& qname, const QType& qt, const vector<DNSResourceRecord>& rrset) override;
- bool feedRecord(const DNSResourceRecord &r, const DNSName &ordername) override;
+ bool feedRecord(const DNSResourceRecord &r, const DNSName &ordername, bool ordernameIsNSEC3=false) override;
bool feedEnts(int domain_id, map<DNSName,bool>& nonterm) override;
bool feedEnts3(int domain_id, const DNSName& domain, map<DNSName,bool>& nonterm, const NSEC3PARAMRecordContent& ns3prc, bool narrow) override;
bool startTransaction(const DNSName& domain, int domain_id) override;
return true;
}
-bool GSQLBackend::feedRecord(const DNSResourceRecord &r, const DNSName &ordername)
+bool GSQLBackend::feedRecord(const DNSResourceRecord &r, const DNSName &ordername, bool ordernameIsNSEC3)
{
int prio=0;
string content(r.content);
bool startTransaction(const DNSName &domain, int domain_id=-1) override;
bool commitTransaction() override;
bool abortTransaction() override;
- bool feedRecord(const DNSResourceRecord &r, const DNSName &ordername) override;
+ bool feedRecord(const DNSResourceRecord &r, const DNSName &ordername, bool ordernameIsNSEC3=false) override;
bool feedEnts(int domain_id, map<DNSName,bool>& nonterm) override;
bool feedEnts3(int domain_id, const DNSName &domain, map<DNSName,bool> &nonterm, const NSEC3PARAMRecordContent& ns3prc, bool narrow) override;
bool createDomain(const DNSName &domain) override {
}
//! feeds a record to a zone, needs a call to startTransaction first
- virtual bool feedRecord(const DNSResourceRecord &rr, const DNSName &ordername)
+ virtual bool feedRecord(const DNSResourceRecord &rr, const DNSName &ordername, bool ordernameIsNSEC3=false)
{
return false; // no problem!
}
// NSEC3
ordername=DNSName(toBase32Hex(hashQNameWithSalt(zs.ns3pr, rr.qname)));
if(!zs.isNarrow && (rr.auth || (rr.qtype.getCode() == QType::NS && (!zs.optOutFlag || zs.secured.count(ordername))))) {
- di.backend->feedRecord(rr, ordername);
+ di.backend->feedRecord(rr, ordername, true);
} else
di.backend->feedRecord(rr, DNSName());
} else {