From: Peter van Dijk Date: Fri, 2 May 2025 10:28:16 +0000 (+0200) Subject: add g_rootzonename X-Git-Tag: auth-5.0.0-alpha1~1^2~22 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=a9ced3258631bf439167a40ba3b090274deed71d;p=thirdparty%2Fpdns.git add g_rootzonename --- diff --git a/pdns/dnsname.cc b/pdns/dnsname.cc index 147aa4cbd6..c63931d34a 100644 --- a/pdns/dnsname.cc +++ b/pdns/dnsname.cc @@ -30,6 +30,7 @@ #include const DNSName g_rootdnsname("."), g_wildcarddnsname("*"); +const ZoneName g_rootzonename("."); /* raw storage in DNS label format, with trailing 0. W/o trailing 0, we are 'empty' diff --git a/pdns/dnsname.hh b/pdns/dnsname.hh index 9339b9d847..c30c35e171 100644 --- a/pdns/dnsname.hh +++ b/pdns/dnsname.hh @@ -426,6 +426,8 @@ using ZoneName = DNSName; using CanonZoneNameCompare = CanonDNSNameCompare; #endif // ] +extern const ZoneName g_rootzonename; + template struct SuffixMatchTree { diff --git a/pdns/fuzz_zoneparsertng.cc b/pdns/fuzz_zoneparsertng.cc index 0fec3e4127..01b965f40c 100644 --- a/pdns/fuzz_zoneparsertng.cc +++ b/pdns/fuzz_zoneparsertng.cc @@ -49,7 +49,7 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) std::string tmp(reinterpret_cast(data), size); boost::split(lines, tmp, boost::is_any_of("\n")); - ZoneParserTNG zpt(lines, ZoneName(g_rootdnsname)); + ZoneParserTNG zpt(lines, g_rootzonename); /* limit the number of steps for '$GENERATE' entries */ zpt.setMaxGenerateSteps(10000); zpt.setMaxIncludes(20); diff --git a/pdns/pdnsutil.cc b/pdns/pdnsutil.cc index 9ec564d443..e7c59df3f3 100644 --- a/pdns/pdnsutil.cc +++ b/pdns/pdnsutil.cc @@ -1343,7 +1343,7 @@ static int editZone(const ZoneName &zone, const PDNSColors& col) { unixDie("Editing file with: '"+cmdline+"', perhaps set EDITOR variable"); } cmdline.clear(); - ZoneParserTNG zpt(static_cast(tmpnam), ZoneName(g_rootdnsname)); + ZoneParserTNG zpt(static_cast(tmpnam), g_rootzonename); zpt.setMaxGenerateSteps(::arg().asNum("max-generate-steps")); zpt.setMaxIncludes(::arg().asNum("max-include-depth")); DNSResourceRecord zrr; diff --git a/pdns/zone2ldap.cc b/pdns/zone2ldap.cc index eaf4bbb077..ae46bea350 100644 --- a/pdns/zone2ldap.cc +++ b/pdns/zone2ldap.cc @@ -312,7 +312,7 @@ int main( int argc, char* argv[] ) } try { - if( i.name != ZoneName(g_rootdnsname) && i.name != ZoneName("localhost") && i.name != ZoneName("0.0.127.in-addr.arpa") ) + if( i.name != g_rootzonename && i.name != ZoneName("localhost") && i.name != ZoneName("0.0.127.in-addr.arpa") ) { cerr << "Parsing file: " << i.filename << ", domain: " << i.name << endl; g_zonename = i.name; diff --git a/pdns/zoneparser-tng.hh b/pdns/zoneparser-tng.hh index 79e56c7bbe..255e376049 100644 --- a/pdns/zoneparser-tng.hh +++ b/pdns/zoneparser-tng.hh @@ -31,7 +31,7 @@ class ZoneParserTNG { public: - ZoneParserTNG(const string& fname, ZoneName zname=ZoneName(g_rootdnsname), string reldir="", bool upgradeContent=false); + ZoneParserTNG(const string& fname, ZoneName zname=g_rootzonename, string reldir="", bool upgradeContent=false); ZoneParserTNG(const vector& zonedata, ZoneName zname, bool upgradeContent=false); ~ZoneParserTNG();