From: Remi Gacogne Date: Wed, 30 Oct 2019 17:24:11 +0000 (+0100) Subject: Allow disabling '$GENERATE' in ZoneParserTNG X-Git-Tag: dnsdist-1.4.0~22^2~4 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=91a862bfa82dba048b916bf167ff34c2ec7c66ff;p=thirdparty%2Fpdns.git Allow disabling '$GENERATE' in ZoneParserTNG --- diff --git a/pdns/zoneparser-tng.cc b/pdns/zoneparser-tng.cc index b2d88b3a94..3a1bc444d3 100644 --- a/pdns/zoneparser-tng.cc +++ b/pdns/zoneparser-tng.cc @@ -319,6 +319,9 @@ bool ZoneParserTNG::get(DNSResourceRecord& rr, std::string* comment) d_zonename = DNSName(makeString(d_line, parts[1])); } else if(pdns_iequals(command, "$GENERATE") && parts.size() > 2) { + if (!d_generateEnabled) { + throw exception("$GENERATE is not allowed in this zone"); + } // $GENERATE 1-127 $ CNAME $.0 string range=makeString(d_line, parts[1]); d_templatestep=1; diff --git a/pdns/zoneparser-tng.hh b/pdns/zoneparser-tng.hh index f20845371d..437eb14a36 100644 --- a/pdns/zoneparser-tng.hh +++ b/pdns/zoneparser-tng.hh @@ -41,6 +41,10 @@ public: DNSName getZoneName(); string getLineOfFile(); // for error reporting purposes pair getLineNumAndFile(); // idem + void disableGenerate() + { + d_generateEnabled = false; + } void setMaxGenerateSteps(size_t max) { d_maxGenerateSteps = max; @@ -72,6 +76,7 @@ private: uint32_t d_templatecounter, d_templatestop, d_templatestep; bool d_havedollarttl; bool d_fromfile; + bool d_generateEnabled{true}; }; #endif