1
0
mirror of https://github.com/samba-team/samba.git synced 2025-03-20 22:50:26 +03:00

selftest: tests for vfs_fruite file-id behavior

The test is in its own suite because it validates
our hackish workaround rather than some reference
implementation behavior.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=12715

Signed-off-by: Uri Simchoni <uri@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>

Autobuild-User(master): Ralph Böhme <slow@samba.org>
Autobuild-Date(master): Sun Mar 26 23:31:08 CEST 2017 on sn-devel-144

(cherry picked from commit b6baf35ebde68db75515910ede26e74bb8313284)

Autobuild-User(v4-6-test): Karolin Seeger <kseeger@samba.org>
Autobuild-Date(v4-6-test): Tue Mar 28 16:14:58 CEST 2017 on sn-devel-144
This commit is contained in:
Uri Simchoni 2017-03-23 21:32:04 +02:00 committed by Karolin Seeger
parent 6b3cc69390
commit 07437b080d
3 changed files with 76 additions and 1 deletions

View File

@ -335,7 +335,7 @@ nbt = ["nbt.dgram" ]
libsmbclient = ["libsmbclient"]
vfs = ["vfs.fruit", "vfs.acl_xattr", "vfs.fruit_netatalk"]
vfs = ["vfs.fruit", "vfs.acl_xattr", "vfs.fruit_netatalk", "vfs.fruit_file_id"]
tests= base + raw + smb2 + rpc + unix + local + rap + nbt + libsmbclient + idmap + vfs
@ -423,6 +423,8 @@ for t in tests:
plansmbtorture4testsuite(t, "nt4_dc", '//$SERVER_IP/vfs_fruit_stream_depot --option=torture:share2=vfs_wo_fruit_stream_depot -U$USERNAME%$PASSWORD', 'streams_depot')
elif t == "vfs.fruit_netatalk":
plansmbtorture4testsuite(t, "nt4_dc", '//$SERVER_IP/vfs_fruit -U$USERNAME%$PASSWORD --option=torture:localdir=$SELFTEST_PREFIX/nt4_dc/share')
elif t == "vfs.fruit_file_id":
plansmbtorture4testsuite(t, "nt4_dc", '//$SERVER_IP/vfs_fruit -U$USERNAME%$PASSWORD')
elif t == "rpc.schannel_anon_setpw":
plansmbtorture4testsuite(t, "nt4_dc", '//$SERVER_IP/tmp -U$%', description="anonymous password set")
plansmbtorture4testsuite(t, "nt4_dc_schannel", '//$SERVER_IP/tmp -U$%', description="anonymous password set (schannel enforced server-side)")

View File

@ -3914,6 +3914,63 @@ done:
return ret;
}
static bool test_zero_file_id(struct torture_context *tctx,
struct smb2_tree *tree)
{
const char *fname = "filtest_file_id";
struct smb2_create create = {0};
NTSTATUS status;
bool ret = true;
uint8_t zero_file_id[8] = {0};
torture_comment(tctx, "Testing zero file id\n");
ret = torture_setup_file(tctx, tree, fname, false);
torture_assert_goto(tctx, ret == true, ret, done, "torture_setup_file");
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;
create.in.query_on_disk_id = true;
status = smb2_create(tree, tctx, &create);
torture_assert_ntstatus_equal_goto(tctx, status, NT_STATUS_OK, ret,
done,
"test file could not be opened");
torture_assert_mem_not_equal_goto(tctx, create.out.on_disk_id,
zero_file_id, 8, ret, done,
"unexpected zero file id");
smb2_util_close(tree, create.out.file.handle);
ret = enable_aapl(tctx, tree);
torture_assert(tctx, ret == true, "enable_aapl failed");
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;
create.in.query_on_disk_id = true;
status = smb2_create(tree, tctx, &create);
torture_assert_ntstatus_equal_goto(
tctx, status, NT_STATUS_OK, ret, done,
"test file could not be opened with AAPL");
torture_assert_mem_equal_goto(tctx, create.out.on_disk_id, zero_file_id,
8, ret, done, "non-zero file id");
smb2_util_close(tree, create.out.file.handle);
done:
smb2_util_unlink(tree, fname);
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
@ -3968,3 +4025,18 @@ struct torture_suite *torture_vfs_fruit_netatalk(void)
return suite;
}
struct torture_suite *torture_vfs_fruit_file_id(void)
{
struct torture_suite *suite =
torture_suite_create(talloc_autofree_context(), "fruit_file_id");
suite->description =
talloc_strdup(suite, "vfs_fruit tests for on-disk file ID that "
"require fruit:zero_file_id=yes");
torture_suite_add_1smb2_test(suite, "zero file id if AAPL negotiated",
test_zero_file_id);
return suite;
}

View File

@ -111,6 +111,7 @@ NTSTATUS torture_vfs_init(void)
torture_suite_add_suite(suite, torture_vfs_fruit());
torture_suite_add_suite(suite, torture_vfs_fruit_netatalk());
torture_suite_add_suite(suite, torture_acl_xattr());
torture_suite_add_suite(suite, torture_vfs_fruit_file_id());
torture_register_suite(suite);