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

torture: Make sure that fruit_ftruncate only unlinks streams

Follow-up to

Bug: https://bugzilla.samba.org/show_bug.cgi?id=13441

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
This commit is contained in:
Volker Lendecke 2018-08-07 15:11:22 +02:00
parent 9c71f61ed8
commit c39ec64231
2 changed files with 46 additions and 0 deletions

View File

@ -1 +1,2 @@
^samba3.vfs.fruit streams_depot.OS X AppleDouble file conversion\(nt4_dc\)
^samba3.vfs.fruit .*.setinfo eof stream\(nt4_dc\)

View File

@ -4773,6 +4773,51 @@ static bool test_setinfo_stream_eof(struct torture_context *tctx,
tctx, status, NT_STATUS_OBJECT_NAME_NOT_FOUND, ret, done,
"Unexpected status\n");
torture_comment(
tctx, "Setting main file EOF to 1 to force 0-truncate\n");
status = torture_smb2_testfile_access(
tree,
fname,
&h1,
SEC_FILE_WRITE_DATA);
torture_assert_ntstatus_ok_goto(tctx, status, ret, done,
"torture_smb2_testfile failed\n");
ZERO_STRUCT(sfinfo);
sfinfo.generic.in.file.handle = h1;
sfinfo.generic.level = RAW_SFILEINFO_END_OF_FILE_INFORMATION;
sfinfo.position_information.in.position = 1;
status = smb2_setinfo_file(tree, &sfinfo);
torture_assert_ntstatus_ok_goto(
tctx,
status,
ret,
done,
"set eof 1 failed\n");
sfinfo.position_information.in.position = 0;
status = smb2_setinfo_file(tree, &sfinfo);
torture_assert_ntstatus_ok_goto(
tctx,
status,
ret,
done,
"set eof 0 failed\n");
smb2_util_close(tree, h1);
ZERO_STRUCT(create);
create.in.desired_access = SEC_FILE_READ_ATTRIBUTE;
create.in.share_access = NTCREATEX_SHARE_ACCESS_MASK;
create.in.file_attributes = FILE_ATTRIBUTE_NORMAL;
create.in.create_disposition = NTCREATEX_DISP_OPEN;
create.in.fname = fname;
status = smb2_create(tree, tctx, &create);
torture_assert_ntstatus_ok_goto(tctx, status, ret, done,
"torture_smb2_testfile failed\n");
smb2_util_close(tree, h1);
done:
smb2_util_unlink(tree, fname);
smb2_util_rmdir(tree, BASEDIR);