]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
Support dnspython 2.7.0
authorNicki Křížek <nicki@isc.org>
Tue, 15 Oct 2024 08:03:25 +0000 (10:03 +0200)
committerMichal Nowak <mnowak@isc.org>
Tue, 22 Oct 2024 06:31:07 +0000 (08:31 +0200)
CookieOption with new .server/.client attributes (rather than .data) was
added to dnspython. Adjust the code to use the new attributes if
available and fall back to the old code for dnspython<2.7.0
compatibility.

(cherry picked from commit 0d90b1364651d9ee5c3495e305187eee11961a42)

bin/tests/system/cookie/ans9/ans.py

index 1266b7e997858fea15862cec502d019abc3f8daa..dd48bdb0950bf31e1a267c60cc3d55534d02cbfc 100644 (file)
@@ -121,10 +121,14 @@ def create_response(msg, tcp, first, ns10):
                     )
                 elif labels[0] != "tcponly" or tcp:
                     cookie = o
-                    if len(o.data) == 8:
-                        cookie.data = o.data + o.data
-                    else:
-                        cookie.data = o.data
+                    try:
+                        if len(o.server) == 0:
+                            cookie.server = o.client
+                    except AttributeError:  # dnspython<2.7.0 compat
+                        if len(o.data) == 8:
+                            cookie.data = o.data + o.data
+                        else:
+                            cookie.data = o.data
                     r.use_edns(options=[cookie])
     r.flags |= dns.flags.AA
     return r