From: Peter van Dijk Date: Fri, 1 Jul 2022 10:24:13 +0000 (+0200) Subject: auth 2136: match autosplit TXT correctly X-Git-Tag: auth-4.8.0-alpha0~31^2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=d040cb869d63d78a34e9efe9f517fa8829fbf6d9;p=thirdparty%2Fpdns.git auth 2136: match autosplit TXT correctly --- diff --git a/modules/tinydnsbackend/data b/modules/tinydnsbackend/data index f8adb95c3d..b5120a79c7 100644 --- a/modules/tinydnsbackend/data +++ b/modules/tinydnsbackend/data @@ -20219,6 +20219,7 @@ Ztest.com:ns1.test.com.:ahu.example.com.:2005092501:28800:7200:604800:86400:3600 +ttl.test.dyndns:127.0.0.1:3600 :delete-add.test.dyndns:16:\034Should\040be\040gone\040after\040a\040while:3600 :txt.test.dyndns:16:\021This\040is\040some\040text:3600 +:xautosplit.test.dyndns:16:\377They\040fixed\040up\040the\040corner\040store\040like\040it\040was\040a\040nightclub\040-\040It\047s\040permanently\040disco\040-\040Everyone\040is\040dressed\040so\040oddly\040I\040can\047t\040recognize\040them\040-\040I\040can\047t\040tell\040the\040staff\040from\040the\040customers\040-\040Baby\040check\040this\040out\054\040I\047ve\040got\040something\040to\040say\040-\040Man\054\040it\047s\040so\040loud\040in\040here\040S-\040When\040they\040stop\040the\040drum\040machine\040and\040I\040can\040think\040again\040-\040I\047ll\040remember\040what\040it\040was:3600 @test.dyndns::host-1.test.dyndns.:10:3600 @test.dyndns::host-2.test.dyndns.:20:3600 Ccname1.test.dyndns:host-1.test.dyndns.:3600 diff --git a/modules/tinydnsbackend/data.cdb b/modules/tinydnsbackend/data.cdb index 5460277209..bdaff5fd8d 100644 Binary files a/modules/tinydnsbackend/data.cdb and b/modules/tinydnsbackend/data.cdb differ diff --git a/pdns/rfc2136handler.cc b/pdns/rfc2136handler.cc index ea985b35c0..24763517b4 100644 --- a/pdns/rfc2136handler.cc +++ b/pdns/rfc2136handler.cc @@ -1,3 +1,4 @@ +#include "dnswriter.hh" #ifdef HAVE_CONFIG_H #include "config.h" #endif @@ -398,7 +399,17 @@ uint PacketHandler::performUpdate(const string &msgPrefix, const DNSRecord *rr, recordsToDelete.push_back(rec); } if (rr->d_class == QClass::NONE) { // 3.4.2.4 - if (rrType == rec.qtype && rec.getZoneRepresentation() == rr->d_content->getZoneRepresentation()) + auto repr = rec.getZoneRepresentation(); + if (rec.qtype == QType::TXT) { + DLOG(g_log<serialize(rec.qname, true, true); + auto rc = DNSRecordContent::deserialize(rec.qname, rec.qtype.getCode(), ser); + repr = rc->getZoneRepresentation(true); + DLOG(g_log<d_content->getZoneRepresentation()=["<d_content->getZoneRepresentation()<<"]"<d_content->getZoneRepresentation()) recordsToDelete.push_back(rec); else rrset.push_back(rec); diff --git a/regression-tests/tests/1dyndns-update-add-delete-txt/command b/regression-tests/tests/1dyndns-update-add-delete-txt/command index 05d1f88f29..02b50e052d 100755 --- a/regression-tests/tests/1dyndns-update-add-delete-txt/command +++ b/regression-tests/tests/1dyndns-update-add-delete-txt/command @@ -1,4 +1,4 @@ -#!/bin/sh +#!/bin/sh -x ## add + delete with explicit data @@ -130,3 +130,19 @@ answer # check if the record was deleted. cleandig test.dyndns TXT +## now remove the overly long entry that was autosplit + +# check that it exists now +cleandig xautosplit.test.dyndns TXT + +# delete it +cleannsupdate <>HEADER<<- opcode: UPDATE, status: NOERROR, id: [id] +;; flags: qr aa; ZONE: 1, PREREQ: 0, UPDATE: 0, ADDITIONAL: 0 +;; ZONE SECTION: +;test.dyndns. IN SOA + +1 test.dyndns. IN SOA 3600 ns1.test.dyndns. ahu.example.dyndns. 2022070137 28800 7200 604800 86400 +Rcode: 3 (Non-Existent domain), RD: 0, QR: 1, TC: 0, AA: 1, opcode: 0 +Reply to question for qname='xautosplit.test.dyndns.', qtype=TXT diff --git a/regression-tests/zones/test.dyndns.orig b/regression-tests/zones/test.dyndns.orig index 3f843c5916..823bb03500 100644 --- a/regression-tests/zones/test.dyndns.orig +++ b/regression-tests/zones/test.dyndns.orig @@ -32,3 +32,6 @@ e.host IN A 1.1.1.1 sub IN NS ns1.test.dyndns. sub IN NS ns2.test.dyndns. + +; unlike other records in this zone, the record below will actually disappear during the 1dyndns-update-add-delete-txt test +xautosplit IN TXT "They fixed up the corner store like it was a nightclub - It's permanently disco - Everyone is dressed so oddly I can't recognize them - I can't tell the staff from the customers - Baby check this out, I've got something to say - Man, it's so loud in here - When they stop the drum machine and I can think again - I'll remember what it was"