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

tests: Show that a directory with a reparse point can't be populated

Works against Windows 2016

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: David Mulder <dmulder@samba.org>
This commit is contained in:
Volker Lendecke 2022-12-01 14:49:37 +01:00
parent 7fe3fab655
commit 62302849dd

View File

@ -82,18 +82,30 @@ class ReparsePoints(samba.tests.libsmb.LibsmbTests):
def test_create_reparse_directory(self):
conn = self.connection()
dirname = "reparse_dir"
filename = f'{dirname}\\file.txt'
self.clean_file(conn, filename)
self.clean_file(conn, dirname)
fd = conn.create(
dir_fd = conn.create(
dirname,
DesiredAccess=sec.SEC_FILE_WRITE_ATTRIBUTE|
sec.SEC_STD_DELETE,
CreateDisposition=libsmb.FILE_CREATE,
CreateOptions=libsmb.FILE_DIRECTORY_FILE)
b = reparse_symlink.put(0x80000025, 0, b'asdfasdfasdfasdfasdfasdf')
conn.fsctl(fd, libsmb.FSCTL_SET_REPARSE_POINT, b, 0)
conn.delete_on_close(fd, 1)
conn.fsctl(dir_fd, libsmb.FSCTL_SET_REPARSE_POINT, b, 0)
with self.assertRaises(NTSTATUSError) as e:
fd = conn.create(
filename,
DesiredAccess=sec.SEC_STD_DELETE,
CreateDisposition=libsmb.FILE_CREATE)
self.assertEqual(
e.args[0], ntstatus.NT_STATUS_IO_REPARSE_TAG_NOT_HANDLED)
conn.delete_on_close(dir_fd, 1)
conn.close(dir_fd);
# Only empty directories can carry reparse points