summaryrefslogtreecommitdiff
path: root/source4
diff options
context:
space:
mode:
Diffstat (limited to 'source4')
-rw-r--r--source4/libcli/smb2/create.c15
-rw-r--r--source4/libcli/smb2/smb2_calls.h15
-rw-r--r--source4/torture/smb2/connect.c69
3 files changed, 52 insertions, 47 deletions
diff --git a/source4/libcli/smb2/create.c b/source4/libcli/smb2/create.c
index dc602ca71c..53476ad056 100644
--- a/source4/libcli/smb2/create.c
+++ b/source4/libcli/smb2/create.c
@@ -51,9 +51,9 @@ struct smb2_request *smb2_create_send(struct smb2_tree *tree, struct smb2_create
SIVAL(req->out.body, 0x14, io->in.unknown3[3]);
SIVAL(req->out.body, 0x18, io->in.access_mask);
SIVAL(req->out.body, 0x1C, io->in.file_attr);
- SIVAL(req->out.body, 0x20, io->in.unknown4);
+ SIVAL(req->out.body, 0x20, io->in.share_access);
SIVAL(req->out.body, 0x24, io->in.open_disposition);
- SIVAL(req->out.body, 0x28, io->in.unknown5);
+ SIVAL(req->out.body, 0x28, io->in.create_options);
SSVAL(req->out.body, 0x2C, 0x40+0x38); /* offset to fname */
SSVAL(req->out.body, 0x2E, path.length);
@@ -99,13 +99,10 @@ NTSTATUS smb2_create_recv(struct smb2_request *req, struct smb2_create *io)
io->out.access_time = smbcli_pull_nttime(req->in.body, 0x10);
io->out.write_time = smbcli_pull_nttime(req->in.body, 0x18);
io->out.change_time = smbcli_pull_nttime(req->in.body, 0x20);
- io->out.unknown3 = IVAL(req->in.body, 0x24);
- io->out.unknown4 = IVAL(req->in.body, 0x28);
- io->out.unknown5 = IVAL(req->in.body, 0x2C);
- io->out.unknown6 = IVAL(req->in.body, 0x30);
- io->out.unknown7 = IVAL(req->in.body, 0x34);
- io->out.unknown8 = IVAL(req->in.body, 0x38);
- io->out.unknown9 = IVAL(req->in.body, 0x3C);
+ io->out.alloc_size = BVAL(req->in.body, 0x28);
+ io->out.size = BVAL(req->in.body, 0x30);
+ io->out.file_attr = IVAL(req->in.body, 0x38);
+ io->out.unknown8 = IVAL(req->in.body, 0x3C);
io->out.handle.data[0] = BVAL(req->in.body, 0x40);
io->out.handle.data[1] = BVAL(req->in.body, 0x48);
io->out.unknown10 = IVAL(req->in.body, 0x50);
diff --git a/source4/libcli/smb2/smb2_calls.h b/source4/libcli/smb2/smb2_calls.h
index 7d41a06153..639a9c47c3 100644
--- a/source4/libcli/smb2/smb2_calls.h
+++ b/source4/libcli/smb2/smb2_calls.h
@@ -89,9 +89,9 @@ struct smb2_create {
uint32_t unknown3[4];
uint32_t access_mask;
uint32_t file_attr;
- uint32_t unknown4;
+ uint32_t share_access;
uint32_t open_disposition;
- uint32_t unknown5;
+ uint32_t create_options;
/* ofs/len of name here, 16 bits */
uint32_t unknown6;
const char *fname;
@@ -109,15 +109,12 @@ struct smb2_create {
NTTIME access_time;
NTTIME write_time;
NTTIME change_time;
+ uint64_t alloc_size;
+ uint64_t size;
+ uint32_t file_attr;
uint32_t unknown3;
- uint32_t unknown4;
- uint32_t unknown5;
- uint32_t unknown6;
- uint32_t unknown7;
- uint32_t unknown8;
- uint32_t unknown9;
struct smb2_handle handle;
- uint32_t unknown10;
+ uint32_t unknown4;
} out;
};
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);