From 6945584f1a36b0be1f3cc4ee4551809c2f1375f2 Mon Sep 17 00:00:00 2001 From: bert hubert Date: Sat, 30 Jan 2016 13:25:00 +0100 Subject: [PATCH] always rectify after edit-zone, make sure we clear the tmp file on (r)eedit, prevent user from applying no changes --- pdns/pdnsutil.cc | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/pdns/pdnsutil.cc b/pdns/pdnsutil.cc index 08447d2e2f..749c7c6f84 100644 --- a/pdns/pdnsutil.cc +++ b/pdns/pdnsutil.cc @@ -959,12 +959,14 @@ int editZone(DNSSECKeeper& dk, const DNSName &zone) { pre.clear(); post.clear(); DNSResourceRecord rr; { - if(tmpfd < 0 && (tmpfd=open(tmpnam, O_WRONLY, 0600)) < 0) + if(tmpfd < 0 && (tmpfd=open(tmpnam, O_WRONLY | O_TRUNC, 0600)) < 0) unixDie("Error reopening temporary file "+string(tmpnam)); string header("; Warning - every name in this file is ABSOLUTE!\n$ORIGIN .\n"); if(write(tmpfd, header.c_str(), header.length()) < 0) unixDie("Writing zone to temporary file"); while(di.backend->get(rr)) { + if(!rr.qtype.getCode()) + continue; DNSRecord dr(rr); pre.push_back(dr); ostringstream os; @@ -1022,7 +1024,8 @@ int editZone(DNSSECKeeper& dk, const DNSName &zone) { cerr<<"\x1b[31;1mThere was a problem with your zone\x1b[0m\nOptions are: (e)dit your changes, (r)etry with original zone, (a)pply change anyhow, (q)uit: "<replaceRRSet(di.id, c.first, QType(c.second), vrr); } - if(dk.isSecuredZone(zone)) { - rectifyZone(dk, zone); - } + rectifyZone(dk, zone); return 0; } -- 2.47.2