From: Stefan Metzmacher Date: Tue, 12 Feb 2019 15:51:20 +0000 (+0100) Subject: s4:torture/smb2: add smb2_create_simple_file() and torture_setup_simple_file() X-Git-Tag: tdb-1.4.1~590 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=4ffb517ffd9cee0ad433e3f58f659f8445fa2166;p=thirdparty%2Fsamba.git 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 Reviewed-by: Jeremy Allison --- diff --git a/source4/torture/smb2/util.c b/source4/torture/smb2/util.c index ac8a0d5df77..04212650c30 100644 --- a/source4/torture/smb2/util.c +++ b/source4/torture/smb2/util.c @@ -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