]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
librpc/idl: Add dnsp_DnsProperty_short
authorAndrew Bartlett <abartlet@samba.org>
Wed, 13 May 2020 22:21:19 +0000 (10:21 +1200)
committerAndrew Bartlett <abartlet@samba.org>
Fri, 15 May 2020 06:05:30 +0000 (06:05 +0000)
This will be used by a test and the DNS server code to parse short dnsProperty
records which come from Windows servers.

This example is from the value that caused Samba to fail as it
can not be parsed as a normal dnsp_DnsProperty

BUG: https://bugzilla.samba.org/show_bug.cgi?id=14310

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

index 814d573cddf3469d73049413ad5929376f4b00e3..2fb45a217a4ccdb3e570661d6680ca5d0c7a885b 100644 (file)
@@ -260,4 +260,20 @@ interface dnsp
                [switch_is(id)]     dnsPropertyData data;
                uint32              name;
        } dnsp_DnsProperty;
+
+       /*
+        * this is the format for the dnsProperty attribute in the DNS
+        * partitions in AD when the wDataLength is 0.  This is an
+        * invalid format seen from some Windows servers in the same
+        * domain.
+        */
+       typedef [flag(NDR_NOALIGN),public] struct {
+               [range(0, 0), value(0)] uint32         wDataLength;
+               uint32                                 namelength;
+               [value(0)] uint32                      flag;
+               [value(1)] uint32                      version;
+               dns_property_id                        id;
+               [switch_is(DSPROPERTY_ZONE_EMPTY)]     dnsPropertyData data;
+               uint32                                 name;
+       } dnsp_DnsProperty_short;
 }
index 0b72684f2703cf0eaa931ccc9fe8c4922d15a3cd..a33229e474097b5ae20ab864ca60e7fd3cbc3a7d 100644 (file)
@@ -468,3 +468,24 @@ dump OK
         # check_output will return bytes
         # convert expected to bytes for python 3
         self.assertRegex(actual.decode('utf8'), expected + '$')
+
+    def test_ndrdump_short_dnsProperty(self):
+        expected = b'''pull returned Success
+    dnsp_DnsProperty_short: struct dnsp_DnsProperty_short
+        wDataLength              : 0x00000000 (0)
+        namelength               : 0x00000000 (0)
+        flag                     : 0x00000000 (0)
+        version                  : 0x00000001 (1)
+        id                       : DSPROPERTY_ZONE_NS_SERVERS_DA (146)
+        data                     : union dnsPropertyData(case 0)
+        name                     : 0x00000000 (0)
+dump OK
+'''
+        command = (
+            "ndrdump dnsp dnsp_DnsProperty_short struct --base64-input "
+            "--input AAAAAAAAAAAAAAAAAQAAAJIAAAAAAAAA")
+        try:
+            actual = self.check_output(command)
+        except BlackboxProcessError as e:
+            self.fail(e)
+        self.assertEqual(actual, expected)