]> git.ipfire.org Git - thirdparty/pdns.git/commitdiff
dnsdist: Fix the `StatNode::fullname` issue introduced in 2.0.4 17212/head
authorRemi Gacogne <remi.gacogne@powerdns.com>
Mon, 20 Apr 2026 10:33:18 +0000 (12:33 +0200)
committerRemi Gacogne <remi.gacogne@powerdns.com>
Mon, 20 Apr 2026 11:39:12 +0000 (13:39 +0200)
Signed-off-by: Remi Gacogne <remi.gacogne@powerdns.com>
pdns/dnsdistdist/dnsdist-lua-inspection.cc

index 8c08dbb3905e2ad63ba68c0476a40237fb0a9774..9a793ef30d1a53154d1ed0cb314943dc673044c8 100644 (file)
@@ -902,7 +902,13 @@ void setupLuaInspection(LuaContext& luaCtx)
                                                               [](const StatNode& node) -> unsigned int {
                                                                 return node.size();
                                                               });
-  luaCtx.registerMember<std::string(StatNode::*)>(std::string("fullname"), [](const StatNode& node) -> std::string { return node.fullname.toString(); });
+  luaCtx.registerMember<std::string(StatNode::*)>(std::string("fullname"), [](const StatNode& node) -> std::string {
+    /* we are not using toLogString() because we want:
+       - an empty string for empty
+       - trailing dots otherwise
+    */
+    return !node.fullname.empty() ? node.fullname.toString() : "";
+  });
   luaCtx.registerMember("labelsCount", &StatNode::labelsCount);
   luaCtx.registerMember("servfails", &StatNode::Stat::servfails);
   luaCtx.registerMember("nxdomains", &StatNode::Stat::nxdomains);