summaryrefslogtreecommitdiff
path: root/tests/test_message.py
diff options
context:
space:
mode:
authorBob Halley <halley@dnspython.org>2020-12-21 07:11:30 -0800
committerBob Halley <halley@dnspython.org>2020-12-21 07:11:30 -0800
commit0cadb332e9946fb404fe70a0ba2775733f6a6824 (patch)
tree022e67233b72afa45bb64641a5c71aba3a42c71e /tests/test_message.py
parentab5026af2b12379dd157f4c5aef4d3ab1561026d (diff)
downloaddnspython-0cadb332e9946fb404fe70a0ba2775733f6a6824.tar.gz
resolve_chaining() should not go into an infinite loop if the qtype is
CNAME and there is no answer [Issue #610].
Diffstat (limited to 'tests/test_message.py')
-rw-r--r--tests/test_message.py14
1 files changed, 14 insertions, 0 deletions
diff --git a/tests/test_message.py b/tests/test_message.py
index 8ebcd05..ec96458 100644
--- a/tests/test_message.py
+++ b/tests/test_message.py
@@ -550,6 +550,20 @@ class MessageTestCase(unittest.TestCase):
with self.assertRaises(dns.exception.FormError):
r.resolve_chaining()
+ def test_resolve_chaining_no_infinite_loop(self):
+ r = dns.message.from_text('''id 1
+flags QR
+;QUESTION
+www.example. IN CNAME
+;AUTHORITY
+example. 300 IN SOA . . 1 2 3 4 5
+''')
+ # passing is actuall not going into an infinite loop in this call
+ (qname, min_ttl, rrset) = r.resolve_chaining()
+ self.assertEqual(qname, dns.name.from_text('www.example.'))
+ self.assertEqual(min_ttl, 5)
+ self.assertIsNone(rrset)
+
def test_bad_text_questions(self):
with self.assertRaises(dns.exception.SyntaxError):
dns.message.from_text('''id 1