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

tests: Add test_symlink_reparse_data_buffer_parse

The blob was taken from a smbclient allinfo command for a Windows
symlink. Show that reparse_data_buffer_parse() is broken.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
This commit is contained in:
Volker Lendecke 2023-09-07 15:25:57 +02:00 committed by Jeremy Allison
parent 03ce770e8d
commit c9a000be41
2 changed files with 16 additions and 0 deletions

View File

@ -177,6 +177,21 @@ class Smb2SymlinkTests(samba.tests.libsmb.LibsmbTests):
self.clean_file(smb1, symlink)
def test_symlink_reparse_data_buffer_parse(self):
"""Test parsing a symlink reparse buffer coming from Windows"""
buf = (b'\x0c\x00\x00\xa0\x18\x00\x00\x00'
b'\x06\x00\x06\x00\x00\x00\x06\x00'
b'\x01\x00\x00\x00\x62\x00\x61\x00'
b'\x72\x00\x62\x00\x61\x00\x72\x00')
try:
syml = reparse_symlink.symlink_get(buf);
except:
self.fail("Could not parse symlink buffer")
self.assertEqual(syml, ('bar', 'bar', 0, 1));
if __name__ == '__main__':
import unittest
unittest.main()

View File

@ -2,3 +2,4 @@
^samba.tests.smb2symlink.samba.tests.smb2symlink.Smb2SymlinkTests.test_symlinkerror_file
^samba.tests.smb2symlink.samba.tests.smb2symlink.Smb2SymlinkTests.test_symlinkerror_absolute_outside_share
^samba.tests.smb2symlink.samba.tests.smb2symlink.Smb2SymlinkTests.test_symlinkerror_absolute_inshare
^samba.tests.smb2symlink.samba.tests.smb2symlink.Smb2SymlinkTests.test_symlink_reparse_data_buffer_parse