zonename.resize(zonename.size()-1);
}
- string dotsuffix = "." + zonename;
string zonestring = stringFromJson(document, "zone", "");
bool exists = B.getDomainInfo(zonename, di);
DNSResourceRecord rr;
BOOST_FOREACH(rr, new_records) {
- if (!rr.qname.isPartOf(dotsuffix) && !pdns_iequals(rr.qname, zonename))
+ if (!rr.qname.isPartOf(zonename) && !pdns_iequals(rr.qname, zonename))
throw ApiException("RRset "+rr.qname.toString()+" IN "+rr.qtype.getName()+": Name is out of zone");
if (rr.qtype.getCode() == QType::SOA && pdns_iequals(rr.qname, zonename)) {
if (!B.getDomainInfo(zonename, di))
throw ApiException("Could not find domain '"+zonename+"'");
- string dotsuffix = "." + zonename;
vector<DNSResourceRecord> new_records;
vector<Comment> new_comments;
vector<DNSResourceRecord> new_ptrs;
for(SizeType rrsetIdx = 0; rrsetIdx < rrsets.Size(); ++rrsetIdx) {
const Value& rrset = rrsets[rrsetIdx];
- string qname, changetype;
+ string changetype;
QType qtype;
- qname = stringFromJson(rrset, "name");
+ DNSName qname = stringFromJson(rrset, "name");
qtype = stringFromJson(rrset, "type");
changetype = toUpper(stringFromJson(rrset, "changetype"));
}
else if (changetype == "REPLACE") {
// we only validate for REPLACE, as DELETE can be used to "fix" out of zone records.
- if (!iends_with(qname, dotsuffix) && !pdns_iequals(qname, zonename))
- throw ApiException("RRset "+qname+" IN "+qtype.getName()+": Name is out of zone");
+ if (!qname.isPartOf(zonename) && !pdns_iequals(qname, zonename))
+ throw ApiException("RRset "+qname.toString()+" IN "+qtype.getName()+": Name is out of zone");
new_records.clear();
new_comments.clear();
rr.domain_id = di.id;
if (rr.qname != qname || rr.qtype != qtype)
- throw ApiException("Record "+rr.qname.toString()+"/"+rr.qtype.getName()+" "+rr.content+": Record wrongly bundled with RRset " + qname + "/" + qtype.getName());
+ throw ApiException("Record "+rr.qname.toString()+"/"+rr.qtype.getName()+" "+rr.content+": Record wrongly bundled with RRset " + qname.toString() + "/" + qtype.getName());
if (rr.qtype.getCode() == QType::SOA && pdns_iequals(rr.qname, zonename)) {
soa_edit_done = increaseSOARecord(rr, soa_edit_api_kind, soa_edit_kind);
bool replace_comments = rrset["comments"].IsArray();
if (!replace_records && !replace_comments) {
- throw ApiException("No change for RRset " + qname + "/" + qtype.getName());
+ throw ApiException("No change for RRset " + qname.toString() + "/" + qtype.getName());
}
if (replace_records) {