1
0
mirror of https://github.com/samba-team/samba.git synced 2025-01-08 21:18:16 +03:00

CI: add test "smb2.async_dosmode"

Verifies async-dosmode sync fallback works with shadow_copy2 which returns
ENOSYS for SMB_VFS_GET_DOS_ATTRIBUTES_SEND().

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

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
This commit is contained in:
Ralph Boehme 2022-01-25 17:59:37 +01:00 committed by Jeremy Allison
parent ecf56c1d9b
commit ffdb1c3e00
6 changed files with 84 additions and 0 deletions

View File

@ -0,0 +1 @@
^samba3.smb2.async_dosmode.async_dosmode\(simpleserver\)

View File

@ -1642,6 +1642,12 @@ sub setup_simpleserver
aio_pthread:aio open = yes
smbd async dosmode = yes
[async_dosmode_shadow_copy2]
path = $prefix_abs/share
read only = no
vfs objects = shadow_copy2 xattr_tdb
smbd async dosmode = yes
[vfs_aio_fork]
path = $prefix_abs/share
vfs objects = aio_fork

View File

@ -989,6 +989,10 @@ for t in tests:
plansmbtorture4testsuite(t, "fileserver", '//$SERVER_IP/tmp -U$USERNAME%$PASSWORD')
elif t == "smb2.acls_non_canonical":
plansmbtorture4testsuite(t, "nt4_dc", '//$SERVER_IP/acls_non_canonical -U$USERNAME%$PASSWORD')
elif t == "smb2.async_dosmode":
plansmbtorture4testsuite("smb2.async_dosmode",
"simpleserver",
"//$SERVER_IP/async_dosmode_shadow_copy2 -U$USERNAME%$PASSWORD")
elif t == "rpc.wkssvc":
plansmbtorture4testsuite(t, "ad_member", '//$SERVER/tmp -U$DC_USERNAME%$DC_PASSWORD')
elif t == "rpc.srvsvc":

View File

@ -379,6 +379,7 @@ smb2_s3only = [
"smb2.fileid",
"smb2.fileid_unique",
"smb2.timestamps",
"smb2.async_dosmode",
]
smb2 = [x for x in smbtorture4_testsuites("smb2.") if x not in smb2_s3only]

View File

@ -181,3 +181,74 @@ done:
smb2_deltree(tree, dname);
return ret;
}
bool torture_smb2_async_dosmode(struct torture_context *tctx)
{
bool ret = true;
NTSTATUS status;
struct smb2_tree *tree = NULL;
const char *dname = "torture_dosmode";
const char *fname = "torture_dosmode\\file";
struct smb2_handle h = {{0}};
struct smb2_create io;
union smb_setfileinfo sfinfo;
struct smb2_find f;
union smb_search_data *d;
unsigned int count;
if (!torture_smb2_connection(tctx, &tree)) {
return false;
}
smb2_deltree(tree, dname);
status = torture_smb2_testdir(tree, dname, &h);
torture_assert_ntstatus_ok_goto(tctx, status, ret, done,
"torture_smb2_testdir failed");
ZERO_STRUCT(io);
io.in.desired_access = SEC_FLAG_MAXIMUM_ALLOWED;
io.in.file_attributes = FILE_ATTRIBUTE_NORMAL;
io.in.create_disposition = NTCREATEX_DISP_CREATE;
io.in.create_options = 0;
io.in.fname = fname;
status = smb2_create(tree, tctx, &io);
torture_assert_ntstatus_ok_goto(tctx, status, ret, done,
"smb2_create failed");
ZERO_STRUCT(sfinfo);
sfinfo.basic_info.in.attrib = FILE_ATTRIBUTE_HIDDEN;
sfinfo.generic.level = RAW_SFILEINFO_BASIC_INFORMATION;
sfinfo.generic.in.file.handle = io.out.file.handle;
status = smb2_setinfo_file(tree, &sfinfo);
torture_assert_ntstatus_ok_goto(tctx, status, ret, done,
"smb2_setinfo_filefailed");
smb2_util_close(tree, io.out.file.handle);
ZERO_STRUCT(f);
f.in.file.handle = h;
f.in.pattern = "file";
f.in.continue_flags = SMB2_CONTINUE_FLAG_RESTART;
f.in.max_response_size = 0x1000;
f.in.level = SMB2_FIND_BOTH_DIRECTORY_INFO;
status = smb2_find_level(tree, tree, &f, &count, &d);
torture_assert_ntstatus_ok_goto(tctx, status, ret, done, "");
smb2_util_close(tree, h);
ZERO_STRUCT(h);
torture_assert_goto(tctx,
d->both_directory_info.attrib & FILE_ATTRIBUTE_HIDDEN,
ret, done,
"FILE_ATTRIBUTE_HIDDEN is not set\n");
done:
if (!smb2_util_handle_empty(h)) {
smb2_util_close(tree, h);
}
smb2_deltree(tree, dname);
return ret;
}

View File

@ -188,6 +188,7 @@ NTSTATUS torture_smb2_init(TALLOC_CTX *ctx)
torture_suite_add_suite(suite, torture_smb2_session_init(suite));
torture_suite_add_suite(suite, torture_smb2_replay_init(suite));
torture_suite_add_simple_test(suite, "dosmode", torture_smb2_dosmode);
torture_suite_add_simple_test(suite, "async_dosmode", torture_smb2_async_dosmode);
torture_suite_add_simple_test(suite, "maxfid", torture_smb2_maxfid);
torture_suite_add_simple_test(suite, "hold-sharemode",
torture_smb2_hold_sharemode);