summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Bartlett <abartlet@samba.org>2019-11-14 13:49:48 +1300
committerDouglas Bagnall <dbagnall@samba.org>2019-11-17 22:28:41 +0000
commitb3bdb17a35380237f7b46cc2b453b6b6b7c7a4f8 (patch)
tree32f36e8a8b97ed39cce516650cf9d2d5db24928c
parent2bb642d98e1c26064907f8f671c1de864f2d8c2f (diff)
downloadsamba-b3bdb17a35380237f7b46cc2b453b6b6b7c7a4f8.tar.gz
selftest: Test fix for ndrdump of structures by number
This requires that misc.GUID not move in the IDL, so a comment is added. BUG: https://bugzilla.samba.org/show_bug.cgi?id=14191 Signed-off-by: Andrew Bartlett <abartlet@samba.org> Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
-rw-r--r--librpc/idl/misc.idl6
-rw-r--r--python/samba/tests/blackbox/ndrdump.py16
-rw-r--r--source4/librpc/tests/misc-GUID.dat1
3 files changed, 23 insertions, 0 deletions
diff --git a/librpc/idl/misc.idl b/librpc/idl/misc.idl
index 0b59ce5c96c..a705b53b5f3 100644
--- a/librpc/idl/misc.idl
+++ b/librpc/idl/misc.idl
@@ -11,6 +11,12 @@
]
interface misc
{
+ /*
+ * While structures are not normally known by their order,
+ * please keep this as the first struct, we use this for a
+ * test of 'ndrdump misc 0 struct' (this helps debug failures
+ * from our NDR fuzzing tool, which doesn't use string names)
+ */
typedef [public,noprint,gensize] struct {
uint32 time_low;
uint16 time_mid;
diff --git a/python/samba/tests/blackbox/ndrdump.py b/python/samba/tests/blackbox/ndrdump.py
index b8f467f8e82..8ec138bacb3 100644
--- a/python/samba/tests/blackbox/ndrdump.py
+++ b/python/samba/tests/blackbox/ndrdump.py
@@ -94,3 +94,19 @@ class NdrDumpTests(BlackboxTestCase):
self.assertEqual(actual[:len(expected)],
expected.encode('utf-8'))
self.assertTrue(actual.endswith(b"dump OK\n"))
+
+ def test_ndrdump_with_binary_struct_number(self):
+ expected = '''pull returned NT_STATUS_OK
+ 0 : 33323130-3534-3736-3839-616263646566
+dump OK
+'''
+ try:
+ actual = self.check_output(
+ "ndrdump misc 0 struct %s" %
+ self.data_path("misc-GUID.dat"))
+ except BlackboxProcessError as e:
+ self.fail(e)
+
+ # check_output will return bytes
+ # convert expected to bytes for python 3
+ self.assertEqual(actual, expected.encode('utf-8'))
diff --git a/source4/librpc/tests/misc-GUID.dat b/source4/librpc/tests/misc-GUID.dat
new file mode 100644
index 00000000000..454f6b314bf
--- /dev/null
+++ b/source4/librpc/tests/misc-GUID.dat
@@ -0,0 +1 @@
+0123456789abcdef \ No newline at end of file