vector<string> masters;
for(const auto& m : di.masters)
masters.push_back(m.toStringWithPortExcept(53));
-
+
return Json::object {
// id is the canonical lookup key, which doesn't actually match the name (in some cases)
{ "id", zoneId },
out["uptime"] = std::to_string(time(0) - s_starttime);
}
+static void validateGatheredRRType(const DNSResourceRecord& rr) {
+ if (rr.qtype.getCode() == QType::OPT || rr.qtype.getCode() == QType::TSIG) {
+ throw ApiException("RRset "+rr.qname.toString()+" IN "+rr.qtype.getName()+": invalid type given");
+ }
+}
+
static void gatherRecords(const Json container, const DNSName& qname, const QType qtype, const int ttl, vector<DNSResourceRecord>& new_records, vector<DNSResourceRecord>& new_ptrs) {
UeberBackend B;
DNSResourceRecord rr;
rr.qtype = qtype;
rr.auth = 1;
rr.ttl = ttl;
+
+ validateGatheredRRType(rr);
for(auto record : container["records"].array_items()) {
string content = stringFromJson(record, "content");
rr.disabled = boolFromJson(record, "disabled");
continue;
if(rr.qtype.getCode() == QType::SOA)
seenSOA=true;
+ validateGatheredRRType(rr);
new_records.push_back(rr);
}
if (!qname.isPartOf(zonename) && qname != zonename)
throw ApiException("RRset "+qname.toString()+" IN "+qtype.getName()+": Name is out of zone");
- if (qtype.getCode() == QType::OPT || qtype.getCode() == QType::TSIG) {
- throw ApiException("RRset "+qname.toString()+" IN "+stringFromJson(rrset, "type")+": invalid type given");
- }
-
bool replace_records = rrset["records"].is_array();
bool replace_comments = rrset["comments"].is_array();