Skip to content

Commit

Permalink
s4:torture/vfs/fruit: adjust test testing basefile rename to expect f…
Browse files Browse the repository at this point in the history
…ailure

Renaming a basefile that has open streams must fail with
NT_STATUS_ACCESS_DENIED.

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

Signed-off-by: Ralph Boehme <[email protected]>
Reviewed-by: Jeremy Allison <[email protected]>
  • Loading branch information
slowfranklin authored and jrasamba committed May 30, 2018
1 parent 00d19bd commit f166207
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 21 deletions.
3 changes: 3 additions & 0 deletions selftest/knownfail.d/samba3.vfs.fruit
Original file line number Diff line number Diff line change
@@ -1 +1,4 @@
^samba3.vfs.fruit streams_depot.OS X AppleDouble file conversion\(nt4_dc\)
^samba3.vfs.fruit metadata_netatalk.read open rsrc after rename\(nt4_dc\)
^samba3.vfs.fruit metadata_stream.read open rsrc after rename\(nt4_dc\)
^samba3.vfs.fruit streams_depot.read open rsrc after rename\(nt4_dc\)
25 changes: 4 additions & 21 deletions source4/torture/vfs/fruit.c
Original file line number Diff line number Diff line change
Expand Up @@ -3902,7 +3902,6 @@ static bool test_rename_and_read_rsrc(struct torture_context *tctx,
const char *fname_renamed = "test_rename_openfile_renamed";
const char *data = "1234567890";
union smb_setfileinfo sinfo;
struct smb2_read r;

ret = enable_aapl(tctx, tree);
torture_assert_goto(tctx, ret == true, ret, done, "enable_aapl failed");
Expand Down Expand Up @@ -3954,28 +3953,12 @@ static bool test_rename_and_read_rsrc(struct torture_context *tctx,
sinfo.rename_information.in.new_name = fname_renamed;

status = smb2_setinfo_file(tree, &sinfo);
torture_assert_ntstatus_ok_goto(tctx, status, ret, done, "smb2_setinfo_file failed");

smb2_util_close(tree, h2);

ZERO_STRUCT(r);
r.in.file.handle = h1;
r.in.length = 10;
r.in.offset = 0;

torture_comment(tctx, "Read resource fork of renamed file\n");

status = smb2_read(tree, tree, &r);
torture_assert_ntstatus_ok_goto(tctx, status, ret, done, "smb2_read failed");
torture_assert_ntstatus_equal_goto(
tctx, status, NT_STATUS_ACCESS_DENIED, ret, done,
"smb2_setinfo_file failed");

smb2_util_close(tree, h1);

torture_assert_goto(tctx, r.out.data.length == 10, ret, done,
talloc_asprintf(tctx, "smb2_read returned %jd bytes, expected 10\n",
(intmax_t)r.out.data.length));

torture_assert_goto(tctx, memcmp(r.out.data.data, data, 10) == 0, ret, done,
talloc_asprintf(tctx, "Bad data in stream\n"));
smb2_util_close(tree, h2);

done:
smb2_util_unlink(tree, fname);
Expand Down

0 comments on commit f166207

Please sign in to comment.