From 907844e47b0006355ede3e9327486f689f3cd21a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Uwe=20Kleine-K=C3=B6nig?= Date: Tue, 17 Dec 2024 23:15:56 +0100 Subject: [PATCH] pdnsutil {add-record,delete-rrset}: Don't append ZONE if NAME ends with . If a NAME ends with a . it is to be understood as an absolute name and appending the zone is not intuitive then. Note this changes behaviour for calls like: pdnsutil --config-dir=configs/auth add-record example.net . NS 1.2.3.4 which added the NS record to the zone's apex before and is likely an error now. Closes: https://github.com/PowerDNS/pdns/issues/8595 --- pdns/pdnsutil.cc | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/pdns/pdnsutil.cc b/pdns/pdnsutil.cc index ed19662297cd..1d3ef9f87a85 100644 --- a/pdns/pdnsutil.cc +++ b/pdns/pdnsutil.cc @@ -1599,6 +1599,8 @@ static int addOrReplaceRecord(bool addOrReplace, const vector& cmds) { DNSName name; if (cmds.at(2) == "@") name=zone; + else if (isCanonical(cmds.at(2))) + name = DNSName(cmds.at(2)); else name = DNSName(cmds.at(2)) + zone; @@ -1737,6 +1739,8 @@ static int deleteRRSet(const std::string& zone_, const std::string& name_, const DNSName name; if(name_=="@") name=zone; + else if (isCanonical(name_)) + name = DNSName(name_); else name=DNSName(name_)+zone;