1
0
mirror of https://github.com/samba-team/samba.git synced 2024-12-25 23:21:54 +03:00

s4:torture/smb2: add smb2_create_simple_file() and torture_setup_simple_file()

Instead of the *_complex_file() versions these don't use EA's nor
complex timestamps.

A lot of tests currently using *_complex_file() only fail because
smbd doesn't implement the correct 'change_time' update behavior.
That should not be the reason why all smb2 related tests fail.

Timestamps should be tested in dedicated tests.

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
This commit is contained in:
Stefan Metzmacher 2019-02-12 16:51:20 +01:00 committed by Jeremy Allison
parent e6fa76b651
commit 4ffb517ffd

View File

@ -595,6 +595,40 @@ NTSTATUS torture_smb2_testdir(struct smb2_tree *tree, const char *fname,
SEC_RIGHTS_DIR_ALL);
}
/*
create a simple file using the SMB2 protocol
*/
NTSTATUS smb2_create_simple_file(struct torture_context *tctx,
struct smb2_tree *tree, const char *fname,
struct smb2_handle *handle)
{
char buf[7] = "abc";
NTSTATUS status;
smb2_util_unlink(tree, fname);
status = torture_smb2_testfile_access(tree,
fname, handle,
SEC_FLAG_MAXIMUM_ALLOWED);
NT_STATUS_NOT_OK_RETURN(status);
status = smb2_util_write(tree, *handle, buf, 0, sizeof(buf));
NT_STATUS_NOT_OK_RETURN(status);
return NT_STATUS_OK;
}
/*
create a simple file using SMB2.
*/
NTSTATUS torture_setup_simple_file(struct torture_context *tctx,
struct smb2_tree *tree, const char *fname)
{
struct smb2_handle handle;
NTSTATUS status = smb2_create_simple_file(tctx, tree, fname, &handle);
NT_STATUS_NOT_OK_RETURN(status);
return smb2_util_close(tree, handle);
}
/*
create a complex file using SMB2, to make it easier to
find fields in SMB2 getinfo levels