]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
pytest: dns_aging: test RPC updates of disparate types
authorDouglas Bagnall <douglas.bagnall@catalyst.net.nz>
Thu, 17 Jun 2021 11:10:50 +0000 (23:10 +1200)
committerAndrew Bartlett <abartlet@samba.org>
Tue, 22 Jun 2021 01:14:37 +0000 (01:14 +0000)
Can a TXT record be replaced by an A record in an RPC update?

According to Windows, yes.

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
python/samba/tests/dns_aging.py

index 3219e63151b8c16a34a3543718be56ac6f80fb67..49fda672821961b80848e0c0aa867e84f083e81a 100644 (file)
@@ -25,7 +25,7 @@ from samba.auth import system_session
 import ldb
 from samba import credentials
 from samba.dcerpc import dns, dnsp, dnsserver
-from samba.dnsserver import TXTRecord
+from samba.dnsserver import TXTRecord, ARecord
 from samba.dnsserver import recbuf_from_string
 from samba.tests.subunitrun import SubunitOptions, TestProgram
 from samba import werror, WERRORError
@@ -1798,6 +1798,21 @@ class TestDNSAging(DNSTest):
         rec = self.dns_update_record('ldap', 'test')
         self.assertEqual(rec.dwSerial, 123)
 
+    def test_rpc_update_disparate_types(self):
+        """Can we use update to replace a TXT with an AAAA?"""
+        name = 'x'
+        old = TXTRecord("x")
+        new = ARecord("127.0.0.111")
+        self.rpc_replace(name, None, old)
+        recs = self.ldap_get_records(name)
+        self.assertEqual(len(recs), 1)
+        self.assertEqual(recs[0].wType, old.wType)
+
+        self.rpc_replace(name, old, new)
+        recs = self.ldap_get_records(name)
+        self.assertEqual(len(recs), 1)
+        self.assertEqual(recs[0].wType, new.wType)
+
     def test_add_update_many(self):
         # Samba fails often in this set, but we want to see how it
         # goes further down, so we print the problems and defer the