Skip to content

Commit

Permalink
feat(api): rectify zone on POST and PATCH
Browse files Browse the repository at this point in the history
  • Loading branch information
nils-wisiol committed Feb 24, 2016
1 parent a3929d0 commit 9cb4f6d
Showing 1 changed file with 17 additions and 1 deletion.
18 changes: 17 additions & 1 deletion pdns/ws-auth.cc
Original file line number Diff line number Diff line change
Expand Up @@ -700,6 +700,14 @@ static void apiServerZones(HttpRequest* req, HttpResponse* resp) {
}

if (boolFromJson(document, "dnssec", false)) {

if (stringFromJson(document, "nsec3param", "").length() > 0) {
NSEC3PARAMRecordContent ns3pr(stringFromJson(document, "nsec3param"));
if (!dk.setNSEC3PARAM(zonename, ns3pr, boolFromJson(document, "nsec3narrow", false))) {
throw ApiException("Cannot use given NSEC3 parameters for zone '" + zonename.toString() + "'.");
}
}

for (auto &k_algo: k_algos) {
int algo = DNSSECKeeper::shorthand2algorithm(k_algo);

Expand Down Expand Up @@ -731,7 +739,11 @@ static void apiServerZones(HttpRequest* req, HttpResponse* resp) {
}
}

// TODO rectify zone
if (!dk.isPresigned(zonename)) {
if (!dk.rectifyZone(B, zonename)) {
throw ApiException("Failed to rectify '" + zonename.toString() + "'.");
}
}

updateDomainSettingsFromDocument(di, zonename, document);

Expand Down Expand Up @@ -1019,6 +1031,10 @@ static void patchZone(HttpRequest* req, HttpResponse* resp) {
di.backend->abortTransaction();
throw;
}

DNSSECKeeper dk;
dk.rectifyZone(B, zonename);

di.backend->commitTransaction();

extern PacketCache PC;
Expand Down

0 comments on commit 9cb4f6d

Please sign in to comment.