summaryrefslogtreecommitdiff
path: root/source4/torture/smb2
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>2005-11-11 14:04:46 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 13:46:13 -0500
commit461ccc557b7cc4ed8b0a3f9fc9aa5f03eccbc656 (patch)
treefb6a25dd212a9722d6fc854dd55d47ad7eca4564 /source4/torture/smb2
parent1b2e8caad3fb01ea3b61bda63965d324de61c815 (diff)
downloadsamba-461ccc557b7cc4ed8b0a3f9fc9aa5f03eccbc656.tar.gz
samba-461ccc557b7cc4ed8b0a3f9fc9aa5f03eccbc656.tar.bz2
samba-461ccc557b7cc4ed8b0a3f9fc9aa5f03eccbc656.zip
r11681: filled in a few more smb2_create() fields
(This used to be commit a95413568f1e45691524dfd8e9159a3bafe358ea)
Diffstat (limited to 'source4/torture/smb2')
-rw-r--r--source4/torture/smb2/connect.c69
1 files changed, 40 insertions, 29 deletions
diff --git a/source4/torture/smb2/connect.c b/source4/torture/smb2/connect.c
index ee323a8b3a..53236d3b27 100644
--- a/source4/torture/smb2/connect.c
+++ b/source4/torture/smb2/connect.c
@@ -196,68 +196,79 @@ static struct smb2_tree *torture_smb2_tree(struct smb2_session *session,
}
/*
- send a create
+ send a close
*/
-static struct smb2_handle torture_smb2_create(struct smb2_tree *tree,
- const char *fname)
+static NTSTATUS torture_smb2_close(struct smb2_tree *tree, struct smb2_handle handle)
{
- struct smb2_create io;
+ struct smb2_close io;
NTSTATUS status;
TALLOC_CTX *tmp_ctx = talloc_new(tree);
ZERO_STRUCT(io);
- io.in.unknown1 = 0x09000039;
- io.in.access_mask = SEC_RIGHTS_FILE_ALL;
- io.in.file_attr = FILE_ATTRIBUTE_NORMAL;
- io.in.open_disposition = NTCREATEX_DISP_OVERWRITE_IF;
- io.in.fname = fname;
- status = smb2_create(tree, &io);
+ io.in.unknown1 = 0x10018;
+ io.in.handle = handle;
+ status = smb2_close(tree, &io);
if (!NT_STATUS_IS_OK(status)) {
- printf("create failed - %s\n", nt_errstr(status));
- return io.out.handle;
+ printf("close failed - %s\n", nt_errstr(status));
+ return status;
}
- printf("Open gave:\n");
+ printf("Close gave:\n");
printf("create_time = %s\n", nt_time_string(tmp_ctx, io.out.create_time));
printf("access_time = %s\n", nt_time_string(tmp_ctx, io.out.access_time));
printf("write_time = %s\n", nt_time_string(tmp_ctx, io.out.write_time));
printf("change_time = %s\n", nt_time_string(tmp_ctx, io.out.change_time));
- printf("handle = %016llx%016llx\n",
- io.out.handle.data[0],
- io.out.handle.data[1]);
talloc_free(tmp_ctx);
- return io.out.handle;
+ return status;
}
+
/*
- send a close
+ send a create
*/
-static NTSTATUS torture_smb2_close(struct smb2_tree *tree, struct smb2_handle handle)
+static struct smb2_handle torture_smb2_create(struct smb2_tree *tree,
+ const char *fname)
{
- struct smb2_close io;
+ struct smb2_create io;
NTSTATUS status;
TALLOC_CTX *tmp_ctx = talloc_new(tree);
ZERO_STRUCT(io);
- io.in.unknown1 = 0x10018;
- io.in.handle = handle;
- status = smb2_close(tree, &io);
+ io.in.unknown1 = 0x09000039; /* gets an oplock */
+ io.in.unknown1 = 0x00000039; /* no oplock */
+ io.in.access_mask = SEC_RIGHTS_FILE_ALL;
+ io.in.file_attr = FILE_ATTRIBUTE_NORMAL;
+ io.in.open_disposition = NTCREATEX_DISP_OPEN;
+ io.in.share_access =
+ NTCREATEX_SHARE_ACCESS_DELETE|
+ NTCREATEX_SHARE_ACCESS_READ|
+ NTCREATEX_SHARE_ACCESS_WRITE;
+ io.in.create_options = NTCREATEX_OPTIONS_WRITE_THROUGH;
+ io.in.fname = fname;
+
+ status = smb2_create(tree, &io);
if (!NT_STATUS_IS_OK(status)) {
- printf("close failed - %s\n", nt_errstr(status));
- return status;
+ printf("create1 failed - %s\n", nt_errstr(status));
+ return io.out.handle;
}
- printf("Close gave:\n");
+ printf("Open gave:\n");
printf("create_time = %s\n", nt_time_string(tmp_ctx, io.out.create_time));
printf("access_time = %s\n", nt_time_string(tmp_ctx, io.out.access_time));
printf("write_time = %s\n", nt_time_string(tmp_ctx, io.out.write_time));
printf("change_time = %s\n", nt_time_string(tmp_ctx, io.out.change_time));
+ printf("alloc_size = %lld\n", io.out.alloc_size);
+ printf("size = %lld\n", io.out.size);
+ printf("file_attr = 0x%x\n", io.out.file_attr);
+ printf("handle = %016llx%016llx\n",
+ io.out.handle.data[0],
+ io.out.handle.data[1]);
talloc_free(tmp_ctx);
- return status;
+ return io.out.handle;
}
/*
@@ -277,8 +288,8 @@ BOOL torture_smb2_connect(void)
transport = torture_smb2_negprot(mem_ctx, host);
session = torture_smb2_session(transport, credentials);
tree = torture_smb2_tree(session, share);
- h1 = torture_smb2_create(tree, "test1.dat");
- h2 = torture_smb2_create(tree, "test2.dat");
+ h1 = torture_smb2_create(tree, "test.dat");
+ h2 = torture_smb2_create(tree, "test1.dat");
torture_smb2_close(tree, h1);
torture_smb2_close(tree, h2);