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);
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);
}
/*
- 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;
}
/*
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);