From: bert hubert Date: Sat, 30 Jan 2016 12:25:00 +0000 (+0100) Subject: always rectify after edit-zone, make sure we clear the tmp file on (r)eedit, prevent... X-Git-Tag: dnsdist-1.0.0-alpha2~24^2 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=refs%2Fpull%2F3319%2Fhead;p=thirdparty%2Fpdns.git always rectify after edit-zone, make sure we clear the tmp file on (r)eedit, prevent user from applying no changes --- 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; }