From: Ralph Boehme Date: Tue, 25 Jan 2022 16:59:37 +0000 (+0100) Subject: CI: add test "smb2.async_dosmode" X-Git-Tag: tevent-0.12.0~629 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=ffdb1c3e00c233efc99e8f1a66a5f83beb4e07f3;p=thirdparty%2Fsamba.git 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 Reviewed-by: Jeremy Allison --- diff --git a/selftest/knownfail.d/samba3.smb2.async_dosmode.async_dosmode b/selftest/knownfail.d/samba3.smb2.async_dosmode.async_dosmode new file mode 100644 index 00000000000..a28337150c8 --- /dev/null +++ b/selftest/knownfail.d/samba3.smb2.async_dosmode.async_dosmode @@ -0,0 +1 @@ +^samba3.smb2.async_dosmode.async_dosmode\(simpleserver\) diff --git a/selftest/target/Samba3.pm b/selftest/target/Samba3.pm index 5e7f04f497d..7961676c6d4 100755 --- a/selftest/target/Samba3.pm +++ b/selftest/target/Samba3.pm @@ -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 diff --git a/source3/selftest/tests.py b/source3/selftest/tests.py index d73658da3eb..16303ab559d 100755 --- a/source3/selftest/tests.py +++ b/source3/selftest/tests.py @@ -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": diff --git a/source4/selftest/tests.py b/source4/selftest/tests.py index 829eda82979..4dfabefd9b4 100755 --- a/source4/selftest/tests.py +++ b/source4/selftest/tests.py @@ -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] diff --git a/source4/torture/smb2/dosmode.c b/source4/torture/smb2/dosmode.c index 7808ca67dba..7610a20329f 100644 --- a/source4/torture/smb2/dosmode.c +++ b/source4/torture/smb2/dosmode.c @@ -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; +} diff --git a/source4/torture/smb2/smb2.c b/source4/torture/smb2/smb2.c index 95a7b49952f..3c69d8c7fa0 100644 --- a/source4/torture/smb2/smb2.c +++ b/source4/torture/smb2/smb2.c @@ -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);