Commit 8ee2a7648b for bind

commit 8ee2a7648b594717073aa3c09bc8d6bbdc142139
Author: Štěpán Balážik <stepan@isc.org>
Date:   Wed Oct 21 13:16:08 2026 +0200

    Build the crafted TKEY record with dnspython's TKEY rdata type

    The SPNEGO flaws test crafts malformed GSS-API tokens, not a malformed
    TKEY record, so the rdata carrying the token can come from dnspython's
    TKEY type, as the GSS context test already does.

    Assisted-by: Claude:claude-fable-5-1

diff --git a/bin/tests/system/tsiggss/tests_isc_spnego_flaws.py b/bin/tests/system/tsiggss/tests_isc_spnego_flaws.py
index bbd14500be..e35a276ec4 100644
--- a/bin/tests/system/tsiggss/tests_isc_spnego_flaws.py
+++ b/bin/tests/system/tsiggss/tests_isc_spnego_flaws.py
@@ -18,10 +18,11 @@ import struct
 import time

 import dns.name
-import dns.rdata
 import dns.rdataclass
 import dns.rdatatype
+import dns.rdtypes.ANY.TKEY
 import dns.rrset
+import dns.tsig
 import pytest

 import isctest
@@ -50,8 +51,16 @@ class CraftedTKEYQuery:
         # Prepare crafted key data
         tkey_data = ASN1Encoder(opts).get_tkey_data()
         # Prepare TKEY RDATA containing crafted key data
-        rdata = dns.rdata.GenericRdata(
-            dns.rdataclass.ANY, dns.rdatatype.TKEY, self._get_tkey_rdata(tkey_data)
+        now = int(time.time())
+        rdata = dns.rdtypes.ANY.TKEY.TKEY(
+            dns.rdataclass.ANY,
+            dns.rdatatype.TKEY,
+            algorithm=dns.tsig.GSS_TSIG,
+            inception=now - 3600,
+            expiration=now + 86400,
+            mode=dns.rdtypes.ANY.TKEY.TKEY.GSSAPI_NEGOTIATION,
+            error=0,
+            key=tkey_data,
         )
         # Prepare TKEY RRset with crafted RDATA (for the ADDITIONAL section)
         rrset = dns.rrset.from_rdata(dns.name.root, dns.rdatatype.TKEY, rdata)
@@ -62,28 +71,6 @@ class CraftedTKEYQuery:
         )
         self.msg.additional.append(rrset)

-    def _get_tkey_rdata(self, tkey_data: bytes) -> bytes:
-        """
-        Return the RDATA to be used for the TKEY RRset sent in the ADDITIONAL
-        section
-        """
-        tkey_rdata = dns.name.from_text("gss-tsig.").to_wire()  # domain
-        if not tkey_rdata:
-            return b""
-        tkey_rdata += struct.pack(">I", int(time.time()) - 3600)  # inception
-        tkey_rdata += struct.pack(">I", int(time.time()) + 86400)  # expiration
-        tkey_rdata += struct.pack(">H", 3)  # mode
-        tkey_rdata += struct.pack(">H", 0)  # error
-        tkey_rdata += self._with_len(tkey_data)  # key
-        tkey_rdata += struct.pack(">H", 0)  # other size
-        return tkey_rdata
-
-    def _with_len(self, data: bytes) -> bytes:
-        """
-        Return 'data' with its length prepended as a 16-bit big-endian integer
-        """
-        return struct.pack(">H", len(data)) + data
-

 class ASN1Encoder:
     """