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

smbtorture: verify attributes on fake quota file handle

The expected DOS attributes are taken from a Windows 2016 server. The expected
timestamps are what Samba has returned before commit 572d4e3a56eef00e29f9348:
NTTIME(0), ie no value.

The upcoming fix will restore this behaviour. Windows of course does
return *some* timestamps, but as it's neither documented nor was I able to
figure out where they would be coming from, as well as the Windows client apparently
doesn't care, I didn't bother with implementing some sophisticated heuristic to
return some timestamps.

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

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
This commit is contained in:
Ralph Boehme 2021-06-07 19:03:05 +02:00 committed by Jeremy Allison
parent 694dc56faf
commit 1e338d5160
3 changed files with 66 additions and 0 deletions

View File

@ -144,6 +144,7 @@
^samba4.raw.acls.*.create_owner_file
^samba4.smb2.create.*.acldir
^samba4.smb2.create.*.impersonation
^samba4.smb2.create.quota-fake-file\(ad_dc_ntvfs\) # not supported by the NTVFS
^samba4.smb2.acls.*.generic
^samba4.smb2.acls.*.inheritflags
^samba4.smb2.acls.*.owner

View File

@ -0,0 +1,2 @@
^samba3.smb2.create.quota-fake-file\(nt4_dc\)
^samba3.smb2.create.quota-fake-file\(ad_dc\)

View File

@ -2707,6 +2707,68 @@ done:
return ret;
}
/*
test opening quota fakefile handle and returned attributes
*/
static bool test_smb2_open_quota_fake_file(struct torture_context *tctx,
struct smb2_tree *tree)
{
const char *fname = "$Extend\\$Quota:$Q:$INDEX_ALLOCATION";
struct smb2_create create;
struct smb2_handle h = {{0}};
NTSTATUS status;
bool ret = true;
create = (struct smb2_create) {
.in.desired_access = SEC_RIGHTS_FILE_READ,
.in.file_attributes = FILE_ATTRIBUTE_NORMAL,
.in.share_access = NTCREATEX_SHARE_ACCESS_MASK,
.in.create_disposition = NTCREATEX_DISP_OPEN,
.in.impersonation_level = SMB2_IMPERSONATION_ANONYMOUS,
.in.fname = fname,
};
status = smb2_create(tree, tree, &create);
torture_assert_ntstatus_ok_goto(tctx, status, ret, done,
"smb2_create failed\n");
h = create.out.file.handle;
torture_assert_u64_equal_goto(tctx,
create.out.file_attr,
FILE_ATTRIBUTE_HIDDEN
| FILE_ATTRIBUTE_SYSTEM
| FILE_ATTRIBUTE_DIRECTORY
| FILE_ATTRIBUTE_ARCHIVE,
ret,
done,
"Wrong attributes\n");
torture_assert_u64_equal_goto(tctx,
create.out.create_time, 0,
ret,
done,
"create_time is not 0\n");
torture_assert_u64_equal_goto(tctx,
create.out.access_time, 0,
ret,
done,
"access_time is not 0\n");
torture_assert_u64_equal_goto(tctx,
create.out.write_time, 0,
ret,
done,
"write_time is not 0\n");
torture_assert_u64_equal_goto(tctx,
create.out.change_time, 0,
ret,
done,
"change_time is not 0\n");
done:
smb2_util_close(tree, h);
return ret;
}
/*
basic testing of SMB2 read
*/
@ -2727,6 +2789,7 @@ struct torture_suite *torture_smb2_create_init(TALLOC_CTX *ctx)
torture_suite_add_1smb2_test(suite, "nulldacl", test_create_null_dacl);
torture_suite_add_1smb2_test(suite, "mkdir-dup", test_mkdir_dup);
torture_suite_add_1smb2_test(suite, "dir-alloc-size", test_dir_alloc_size);
torture_suite_add_1smb2_test(suite, "quota-fake-file", test_smb2_open_quota_fake_file);
suite->description = talloc_strdup(suite, "SMB2-CREATE tests");