]> git.ipfire.org Git - thirdparty/pdns.git/commitdiff
add g_rootzonename
authorPeter van Dijk <peter.van.dijk@powerdns.com>
Fri, 2 May 2025 10:28:16 +0000 (12:28 +0200)
committerMiod Vallat <miod.vallat@powerdns.com>
Mon, 26 May 2025 09:23:23 +0000 (11:23 +0200)
pdns/dnsname.cc
pdns/dnsname.hh
pdns/fuzz_zoneparsertng.cc
pdns/pdnsutil.cc
pdns/zone2ldap.cc
pdns/zoneparser-tng.hh

index 147aa4cbd6af398e98bb46e187e89346d8977548..c63931d34a2edc64643b664e867ed781e8121d6b 100644 (file)
@@ -30,6 +30,7 @@
 #include <boost/functional/hash.hpp>
 
 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'
index 9339b9d8473765c5819d9da26b6f9ad358af48a6..c30c35e1718b44409a9ddefc43210ea47ffd21ee 100644 (file)
@@ -426,6 +426,8 @@ using ZoneName = DNSName;
 using CanonZoneNameCompare = CanonDNSNameCompare;
 #endif // ]
 
+extern const ZoneName g_rootzonename;
+
 template<typename T>
 struct SuffixMatchTree
 {
index 0fec3e4127594cbe36f9054257785154b07781a8..01b965f40c5f55624788d09b338a0568ed5c24d8 100644 (file)
@@ -49,7 +49,7 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size)
     std::string tmp(reinterpret_cast<const char*>(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);
index 9ec564d4434af5775234a2d2874c60a39819ba3b..e7c59df3f39fe4d4b83d6df857ecbe42416c2bfe 100644 (file)
@@ -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<const char *>(tmpnam), ZoneName(g_rootdnsname));
+  ZoneParserTNG zpt(static_cast<const char *>(tmpnam), g_rootzonename);
   zpt.setMaxGenerateSteps(::arg().asNum("max-generate-steps"));
   zpt.setMaxIncludes(::arg().asNum("max-include-depth"));
   DNSResourceRecord zrr;
index eaf4bbb077d3db4c7b3cd21c8c942dc93b55ed04..ae46bea350424b6b1b25a307e13264b381ff53b7 100644 (file)
@@ -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;
index 79e56c7bbe97b76229302cb460d7e9e80bffe6bf..255e3760495beb8987ac3fc1ae2df4009aa9db5d 100644 (file)
@@ -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<string>& zonedata, ZoneName zname, bool upgradeContent=false);
 
   ~ZoneParserTNG();