diff options
author | Ralph Boehme <slow@samba.org> | 2015-12-20 18:42:23 +0100 |
---|---|---|
committer | Karolin Seeger <kseeger@samba.org> | 2016-01-06 10:07:17 +0100 |
commit | a4e06390ab61ad30e8305dfd6097556304e471cb (patch) | |
tree | 95fb2c1055773de5490996c4ad1c7ce5e430bdb9 /source4/torture | |
parent | d26b979bf4f3314017c303fe62c778933b9e0746 (diff) | |
download | samba-a4e06390ab61ad30e8305dfd6097556304e471cb.tar.gz |
s4:torture:vfs_fruit: file without AFP_AfpInfo
Opening the AFP_AfpInfo on a file that doesn't have that stream must
return ENOENT.
Bug: https://bugzilla.samba.org/show_bug.cgi?id=11347
Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
(cherry picked from commit 6f8c188dfc81a6d22bd54f248327b787e0b48f09)
Diffstat (limited to 'source4/torture')
-rw-r--r-- | source4/torture/vfs/fruit.c | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/source4/torture/vfs/fruit.c b/source4/torture/vfs/fruit.c index dbce3757ef6..1474bef90cb 100644 --- a/source4/torture/vfs/fruit.c +++ b/source4/torture/vfs/fruit.c @@ -2775,6 +2775,43 @@ static bool test_rename_dir_openfile(struct torture_context *torture, return ret; } +static bool test_afpinfo_enoent(struct torture_context *tctx, + struct smb2_tree *tree) +{ + bool ret = true; + NTSTATUS status; + struct smb2_create create; + struct smb2_handle h1; + TALLOC_CTX *mem_ctx = talloc_new(tctx); + const char *fname = BASEDIR "\\file"; + const char *sname = BASEDIR "\\file" AFPINFO_STREAM_NAME; + + torture_comment(tctx, "Opening file without AFP_AfpInfo\n"); + + smb2_deltree(tree, BASEDIR); + status = torture_smb2_testdir(tree, BASEDIR, &h1); + torture_assert_ntstatus_ok_goto(tctx, status, ret, done, "torture_smb2_testdir"); + smb2_util_close(tree, h1); + ret = torture_setup_file(mem_ctx, tree, fname, false); + torture_assert_goto(tctx, ret == true, ret, done, "torture_setup_file"); + + torture_comment(tctx, "Opening not existing AFP_AfpInfo\n"); + + ZERO_STRUCT(create); + create.in.create_disposition = NTCREATEX_DISP_OPEN; + create.in.desired_access = SEC_FILE_READ_ATTRIBUTE; /* stat open */ + create.in.fname = sname; + + status = smb2_create(tree, mem_ctx, &create); + torture_assert_ntstatus_equal_goto(tctx, status, NT_STATUS_OBJECT_NAME_NOT_FOUND, + ret, done, "Got unexpected AFP_AfpInfo stream"); + +done: + smb2_util_unlink(tree, fname); + smb2_util_rmdir(tree, BASEDIR); + return ret; +} + /* * Note: This test depends on "vfs objects = catia fruit streams_xattr". For * some tests torture must be run on the host it tests and takes an additional @@ -2800,6 +2837,7 @@ struct torture_suite *torture_vfs_fruit(void) torture_suite_add_1smb2_test(suite, "truncate resource fork to 0 bytes", test_rfork_truncate); torture_suite_add_1smb2_test(suite, "opening and creating resource fork", test_rfork_create); torture_suite_add_1smb2_test(suite, "rename_dir_openfile", test_rename_dir_openfile); + torture_suite_add_1smb2_test(suite, "File without AFP_AfpInfo", test_afpinfo_enoent); return suite; } |