1
0
mirror of https://github.com/samba-team/samba.git synced 2024-12-23 17:34:34 +03:00

selftest: Add example xattr_NTACL packets to demonstrate switch/union behaviour

This is a good example with both buffers and scalars in the union.

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

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Gary Lockyer <gary@catalyst.net.nz>
This commit is contained in:
Andrew Bartlett 2019-12-04 16:02:31 +13:00
parent cf83eec565
commit 6ef5014549
3 changed files with 136 additions and 0 deletions

View File

@ -350,3 +350,20 @@ dump OK
self.assertEqual(actual[:len(expected_head)],
expected_head)
self.assertTrue(actual.endswith(expected_tail))
# This is a good example of a union with scalars and buffers
def test_ndrdump_xattr_NTACL(self):
expected_head = open(self.data_path("xattr_NTACL.txt")).read().encode('utf8')
expected_tail = b'''dump OK
'''
try:
actual = self.check_output(
"ndrdump xattr xattr_NTACL struct --hex-input %s --validate" %
self.data_path("xattr_NTACL.dat"))
except BlackboxProcessError as e:
self.fail(e)
self.assertEqual(actual[:len(expected_head)],
expected_head)
self.assertTrue(actual.endswith(expected_tail))

View File

@ -0,0 +1,20 @@
[0000] 04 00 04 00 00 00 02 00 04 00 02 00 01 00 04 07 ........ ........
[0010] 8B 57 A0 0C F3 F7 9D 64 DF 3E 91 46 09 B8 07 A5 .W.....d .>.F....
[0020] F1 6C BE 38 DC 55 5B 1F 38 0C 23 A8 4A 85 00 00 .l.8.U[. 8.#.J...
[0030] 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ........ ........
[0040] 00 00 00 00 00 00 00 00 00 00 00 00 00 00 70 6F ........ ......po
[0050] 73 69 78 5F 61 63 6C 00 62 A2 D8 8C 4B AA D5 01 six_acl. b...K...
[0060] 5D 60 E7 56 A5 D4 54 92 1A 77 A5 E1 DC E2 A9 28 ]`.V..T. .w.....(
[0070] A9 5D 3B 97 71 6C F7 59 F4 92 FF E3 42 A5 E9 B5 .];.ql.Y ....B...
[0080] 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ........ ........
[0090] 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ........ ........
[00A0] 01 00 14 90 B4 00 00 00 D0 00 00 00 00 00 00 00 ........ ........
[00B0] E0 00 00 00 01 05 00 00 00 00 00 05 15 00 00 00 ........ ........
[00C0] 70 CB 8E 6B F1 F8 4E 7C 31 87 57 84 F4 01 00 00 p..k..N| 1.W.....
[00D0] 01 02 00 00 00 00 00 05 20 00 00 00 20 02 00 00 ........ ... ...
[00E0] 04 00 60 00 04 00 00 00 00 03 18 00 FF 01 1F 00 ..`..... ........
[00F0] 01 02 00 00 00 00 00 05 20 00 00 00 20 02 00 00 ........ ... ...
[0100] 00 03 18 00 A9 00 12 00 01 02 00 00 00 00 00 05 ........ ........
[0110] 20 00 00 00 25 02 00 00 00 03 14 00 FF 01 1F 00 ...%... ........
[0120] 01 01 00 00 00 00 00 05 12 00 00 00 00 03 14 00 ........ ........
[0130] A9 00 12 00 01 01 00 00 00 00 00 05 0B 00 00 00 ........ ........

View File

@ -0,0 +1,99 @@
pull returned Success
xattr_NTACL: struct xattr_NTACL
version : 0x0004 (4)
info : union xattr_NTACL_Info(case 4)
sd_hs4 : *
sd_hs4: struct security_descriptor_hash_v4
sd : *
sd: struct security_descriptor
revision : SECURITY_DESCRIPTOR_REVISION_1 (1)
type : 0x9014 (36884)
0: SEC_DESC_OWNER_DEFAULTED
0: SEC_DESC_GROUP_DEFAULTED
1: SEC_DESC_DACL_PRESENT
0: SEC_DESC_DACL_DEFAULTED
1: SEC_DESC_SACL_PRESENT
0: SEC_DESC_SACL_DEFAULTED
0: SEC_DESC_DACL_TRUSTED
0: SEC_DESC_SERVER_SECURITY
0: SEC_DESC_DACL_AUTO_INHERIT_REQ
0: SEC_DESC_SACL_AUTO_INHERIT_REQ
0: SEC_DESC_DACL_AUTO_INHERITED
0: SEC_DESC_SACL_AUTO_INHERITED
1: SEC_DESC_DACL_PROTECTED
0: SEC_DESC_SACL_PROTECTED
0: SEC_DESC_RM_CONTROL_VALID
1: SEC_DESC_SELF_RELATIVE
owner_sid : *
owner_sid : S-1-5-21-1804520304-2085550321-2220328753-500
group_sid : *
group_sid : S-1-5-32-544
sacl : NULL
dacl : *
dacl: struct security_acl
revision : SECURITY_ACL_REVISION_ADS (4)
size : 0x0060 (96)
num_aces : 0x00000004 (4)
aces: ARRAY(4)
aces: struct security_ace
type : SEC_ACE_TYPE_ACCESS_ALLOWED (0)
flags : 0x03 (3)
1: SEC_ACE_FLAG_OBJECT_INHERIT
1: SEC_ACE_FLAG_CONTAINER_INHERIT
0: SEC_ACE_FLAG_NO_PROPAGATE_INHERIT
0: SEC_ACE_FLAG_INHERIT_ONLY
0: SEC_ACE_FLAG_INHERITED_ACE
0x03: SEC_ACE_FLAG_VALID_INHERIT (3)
0: SEC_ACE_FLAG_SUCCESSFUL_ACCESS
0: SEC_ACE_FLAG_FAILED_ACCESS
size : 0x0018 (24)
access_mask : 0x001f01ff (2032127)
object : union security_ace_object_ctr(case 0)
trustee : S-1-5-32-544
aces: struct security_ace
type : SEC_ACE_TYPE_ACCESS_ALLOWED (0)
flags : 0x03 (3)
1: SEC_ACE_FLAG_OBJECT_INHERIT
1: SEC_ACE_FLAG_CONTAINER_INHERIT
0: SEC_ACE_FLAG_NO_PROPAGATE_INHERIT
0: SEC_ACE_FLAG_INHERIT_ONLY
0: SEC_ACE_FLAG_INHERITED_ACE
0x03: SEC_ACE_FLAG_VALID_INHERIT (3)
0: SEC_ACE_FLAG_SUCCESSFUL_ACCESS
0: SEC_ACE_FLAG_FAILED_ACCESS
size : 0x0018 (24)
access_mask : 0x001200a9 (1179817)
object : union security_ace_object_ctr(case 0)
trustee : S-1-5-32-549
aces: struct security_ace
type : SEC_ACE_TYPE_ACCESS_ALLOWED (0)
flags : 0x03 (3)
1: SEC_ACE_FLAG_OBJECT_INHERIT
1: SEC_ACE_FLAG_CONTAINER_INHERIT
0: SEC_ACE_FLAG_NO_PROPAGATE_INHERIT
0: SEC_ACE_FLAG_INHERIT_ONLY
0: SEC_ACE_FLAG_INHERITED_ACE
0x03: SEC_ACE_FLAG_VALID_INHERIT (3)
0: SEC_ACE_FLAG_SUCCESSFUL_ACCESS
0: SEC_ACE_FLAG_FAILED_ACCESS
size : 0x0014 (20)
access_mask : 0x001f01ff (2032127)
object : union security_ace_object_ctr(case 0)
trustee : S-1-5-18
aces: struct security_ace
type : SEC_ACE_TYPE_ACCESS_ALLOWED (0)
flags : 0x03 (3)
1: SEC_ACE_FLAG_OBJECT_INHERIT
1: SEC_ACE_FLAG_CONTAINER_INHERIT
0: SEC_ACE_FLAG_NO_PROPAGATE_INHERIT
0: SEC_ACE_FLAG_INHERIT_ONLY
0: SEC_ACE_FLAG_INHERITED_ACE
0x03: SEC_ACE_FLAG_VALID_INHERIT (3)
0: SEC_ACE_FLAG_SUCCESSFUL_ACCESS
0: SEC_ACE_FLAG_FAILED_ACCESS
size : 0x0014 (20)
access_mask : 0x001200a9 (1179817)
object : union security_ace_object_ctr(case 0)
trustee : S-1-5-11
hash_type : 0x0001 (1)
hash: ARRAY(64)