From 05d79abdc01dc58e19e62a9a6d047b3344409115 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Pavel=20Filipensk=C3=BD?= Date: Thu, 2 Jan 2025 18:32:40 +0100 Subject: [PATCH] torture:fruit: Test timemachine for 0 bands MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Signed-off-by: Pavel Filipenský Reviewed-by: Ralph Boehme --- selftest/knownfail | 1 + source4/torture/vfs/fruit.c | 15 ++++++++++++--- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/selftest/knownfail b/selftest/knownfail index 51aae99d6b4..7ae2ac1bc5e 100644 --- a/selftest/knownfail +++ b/selftest/knownfail @@ -4,6 +4,7 @@ # "make test" will not report failures for tests listed here and will consider # a successful run for any of these tests an error. +^samba3.vfs.fruit_timemachine # this fails as number of band==0 causes divison by 0 ^samba3.blackbox.failure.failure # this is designed to fail, for testing our test infrastructure .*driver.add_driver_timestamps # we only can store dates, not timestamps ^samba3.smbtorture_s3.crypt_server\(nt4_dc\).SMB2-SESSION-REAUTH # expected to give ACCESS_DENIED SMB2.1 doesn't have encryption diff --git a/source4/torture/vfs/fruit.c b/source4/torture/vfs/fruit.c index c748326483a..6bad4e409c6 100644 --- a/source4/torture/vfs/fruit.c +++ b/source4/torture/vfs/fruit.c @@ -8125,15 +8125,24 @@ static bool test_timemachine_volsize(struct torture_context *tctx, torture_assert_ntstatus_ok_goto(tctx, status, ok, done, "smb2_util_mkdir\n"); + status = smb2_util_roothandle(tree, &h); + torture_assert_ntstatus_ok(tctx, status, "Unable to create root handle"); + + /* Test that smbd does not crash if number of bands is 0 */ + ZERO_STRUCT(fsinfo); + fsinfo.generic.level = RAW_QFS_SIZE_INFORMATION; + fsinfo.generic.handle = h; + + status = smb2_getinfo_fs(tree, tree, &fsinfo); + torture_assert_ntstatus_ok(tctx, status, "smb2_getinfo_fs failed"); + + /* Setup 2 bands and test again */ ok = torture_setup_file(tctx, tree, "test.sparsebundle/bands/1", false); torture_assert_goto(tctx, ok, ok, done, "torture_setup_file failed\n"); ok = torture_setup_file(tctx, tree, "test.sparsebundle/bands/2", false); torture_assert_goto(tctx, ok, ok, done, "torture_setup_file failed\n"); - status = smb2_util_roothandle(tree, &h); - torture_assert_ntstatus_ok(tctx, status, "Unable to create root handle"); - ZERO_STRUCT(fsinfo); fsinfo.generic.level = RAW_QFS_SIZE_INFORMATION; fsinfo.generic.handle = h; -- 2.47.3