summaryrefslogtreecommitdiff
path: root/source4
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>2003-12-04 02:03:06 +0000
committerAndrew Tridgell <tridge@samba.org>2003-12-04 02:03:06 +0000
commit926240428c0646aabb13539745940b61a7cf44a9 (patch)
tree102988d47fab4a56b59161409dddc9c9dfa86ed5 /source4
parentb8cbd9181efabbc360ef335e214a696011839b41 (diff)
downloadsamba-926240428c0646aabb13539745940b61a7cf44a9.tar.gz
samba-926240428c0646aabb13539745940b61a7cf44a9.tar.bz2
samba-926240428c0646aabb13539745940b61a7cf44a9.zip
* patch based on work by Jim Myers to unify the ioctl handling to be
more like the other major SMB functions * added SMBntrename code (This used to be commit f2d3dc9893fa0e089c407fa16ce9ff13587e70cd)
Diffstat (limited to 'source4')
-rw-r--r--source4/include/ntvfs.h2
-rw-r--r--source4/include/smb_interfaces.h73
-rw-r--r--source4/libcli/raw/rawioctl.c105
-rw-r--r--source4/ntvfs/cifs/vfs_cifs.c2
-rw-r--r--source4/ntvfs/ipc/vfs_ipc.c2
-rw-r--r--source4/ntvfs/print/vfs_print.c14
-rw-r--r--source4/ntvfs/simple/vfs_simple.c2
-rw-r--r--source4/smbd/process.c2
-rw-r--r--source4/smbd/reply.c52
-rw-r--r--source4/torture/raw/ioctl.c33
-rw-r--r--source4/torture/raw/seek.c2
-rw-r--r--source4/torture/torture.c11
-rw-r--r--source4/torture/torture_util.c24
13 files changed, 224 insertions, 100 deletions
diff --git a/source4/include/ntvfs.h b/source4/include/ntvfs.h
index af23f10607..6628402a97 100644
--- a/source4/include/ntvfs.h
+++ b/source4/include/ntvfs.h
@@ -58,7 +58,7 @@ struct ntvfs_ops {
NTSTATUS (*search_close)(struct request_context *req, union smb_search_close *io);
/* operations on open files */
- NTSTATUS (*ioctl)(struct request_context *req, struct smb_ioctl *io);
+ NTSTATUS (*ioctl)(struct request_context *req, union smb_ioctl *io);
NTSTATUS (*read)(struct request_context *req, union smb_read *io);
NTSTATUS (*write)(struct request_context *req, union smb_write *io);
NTSTATUS (*seek)(struct request_context *req, struct smb_seek *io);
diff --git a/source4/include/smb_interfaces.h b/source4/include/smb_interfaces.h
index 52df49f01b..4bf557359e 100644
--- a/source4/include/smb_interfaces.h
+++ b/source4/include/smb_interfaces.h
@@ -2,6 +2,7 @@
Unix SMB/CIFS implementation.
SMB request interface structures
Copyright (C) Andrew Tridgell 2003
+ Copyright (C) James J Myers 2003 <myersjj@samba.org>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -28,7 +29,7 @@ typedef struct GUID
uint8 info[GUID_SIZE];
} GUID;
-/* 64 bit time (100usec) 1601 - cifs6.txt, section 3.5, page 30 */
+/* 64 bit time (100 nanosec) 1601 - cifs6.txt, section 3.5, page 30 */
typedef struct nttime_info
{
uint32 low;
@@ -78,7 +79,7 @@ struct smb_seek {
int32 offset; /* signed */
} in;
struct {
- uint32 offset;
+ int32 offset;
} out;
};
@@ -1573,16 +1574,44 @@ union smb_lpq {
} retq;
};
+enum ioctl_level {RAW_IOCTL_IOCTL, RAW_IOCTL_NTIOCTL};
-/* struct for SMBioctl */
-struct smb_ioctl {
+/*
+ union for ioctl() backend
+*/
+union smb_ioctl {
+ /* generic interface */
struct {
- uint16 fnum;
- uint32 request;
- } in;
+ enum ioctl_level level;
+
+ } generic;
+
+ /* struct for SMBioctl */
struct {
- DATA_BLOB blob;
- } out;
+ enum ioctl_level level;
+ struct {
+ uint16 fnum;
+ uint32 request;
+ } in;
+ struct {
+ DATA_BLOB blob;
+ } out;
+ } ioctl;
+
+
+ /* struct for NT ioctl call */
+ struct {
+ enum ioctl_level level;
+ struct {
+ uint32 function;
+ uint16 fnum;
+ BOOL fsctl;
+ uint8 filter;
+ } in;
+ struct {
+ DATA_BLOB blob;
+ } out;
+ } ntioctl;
};
/* struct for SMBflush */
@@ -1671,19 +1700,10 @@ struct smb_notify {
} out;
};
-/* struct for NT ioctl call */
-struct smb_ntioctl {
- struct {
- uint32 function;
- uint16 fnum;
- BOOL fsctl;
- uint8 filter;
- } in;
-};
-
enum search_level {RAW_SEARCH_GENERIC = 0xF000,
RAW_SEARCH_SEARCH, /* SMBsearch */
+ RAW_SEARCH_FCLOSE, /* SMBfclose */
RAW_SEARCH_STANDARD = SMB_FIND_STANDARD,
RAW_SEARCH_EA_SIZE = SMB_FIND_EA_SIZE,
RAW_SEARCH_DIRECTORY_INFO = SMB_FIND_DIRECTORY_INFO,
@@ -1914,6 +1934,20 @@ union smb_search_close {
enum search_close_level level;
} generic;
+ /* SMBfclose (old search) interface */
+ struct {
+ enum search_level level;
+
+ struct {
+ uint16 max_count;
+ uint16 search_attrib;
+ DATA_BLOB search_id;
+ } in;
+ struct {
+ uint16 count;
+ } out;
+ } search_next;
+
/* SMBfindclose interface */
struct {
enum search_close_level level;
@@ -1924,4 +1958,3 @@ union smb_search_close {
} findclose;
};
-
diff --git a/source4/libcli/raw/rawioctl.c b/source4/libcli/raw/rawioctl.c
index 506bddd497..2ea2cabb89 100644
--- a/source4/libcli/raw/rawioctl.c
+++ b/source4/libcli/raw/rawioctl.c
@@ -2,6 +2,7 @@
Unix SMB/CIFS implementation.
client file operations
Copyright (C) Andrew Tridgell 2003
+ Copyright (C) James J Myers 2003 <myersjj@samba.org>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -26,16 +27,17 @@
} while (0)
/*
- send a raw ioctl - async send
+ send a raw smb ioctl - async send
*/
-struct cli_request *smb_raw_ioctl_send(struct cli_tree *tree, struct smb_ioctl *parms)
+static struct cli_request *smb_raw_smbioctl_send(struct cli_tree *tree,
+ union smb_ioctl *parms)
{
struct cli_request *req;
SETUP_REQUEST(SMBioctl, 3, 0);
- SSVAL(req->out.vwv, VWV(0), parms->in.fnum);
- SIVAL(req->out.vwv, VWV(1), parms->in.request);
+ SSVAL(req->out.vwv, VWV(0), parms->ioctl.in.fnum);
+ SIVAL(req->out.vwv, VWV(1), parms->ioctl.in.request);
if (!cli_request_send(req)) {
cli_request_destroy(req);
@@ -46,36 +48,28 @@ struct cli_request *smb_raw_ioctl_send(struct cli_tree *tree, struct smb_ioctl *
}
/*
- send a raw ioctl - async recv
+ send a raw smb ioctl - async recv
*/
-NTSTATUS smb_raw_ioctl_recv(struct cli_request *req, TALLOC_CTX *mem_ctx, struct smb_ioctl *parms)
+static NTSTATUS smb_raw_smbioctl_recv(struct cli_request *req,
+ TALLOC_CTX *mem_ctx,
+ union smb_ioctl *parms)
{
if (!cli_request_receive(req) ||
cli_request_is_error(req)) {
return cli_request_destroy(req);
}
- parms->out.blob = cli_req_pull_blob(req, mem_ctx, req->in.data, -1);
+ parms->ioctl.out.blob = cli_req_pull_blob(req, mem_ctx, req->in.data, -1);
return cli_request_destroy(req);
}
-/*
- send a raw ioctl - sync interface
-*/
-NTSTATUS smb_raw_ioctl(struct cli_tree *tree, TALLOC_CTX *mem_ctx, struct smb_ioctl *parms)
-{
- struct cli_request *req = smb_raw_ioctl_send(tree, parms);
- return smb_raw_ioctl_recv(req, mem_ctx, parms);
-}
-
-
/****************************************************************************
NT ioctl (async send)
****************************************************************************/
-struct cli_request *smb_raw_ntioctl_send(struct cli_tree *tree,
- struct smb_ntioctl *parms)
+static struct cli_request *smb_raw_ntioctl_send(struct cli_tree *tree,
+ union smb_ioctl *parms)
{
struct smb_nttrans nt;
uint16 setup[4];
@@ -85,10 +79,10 @@ struct cli_request *smb_raw_ntioctl_send(struct cli_tree *tree,
nt.in.max_data = 0;
nt.in.setup_count = 4;
nt.in.setup = setup;
- SIVAL(setup, 0, parms->in.function);
- SSVAL(setup, 4, parms->in.fnum);
- SCVAL(setup, 6, parms->in.fsctl);
- SCVAL(setup, 7, parms->in.filter);
+ SIVAL(setup, 0, parms->ntioctl.in.function);
+ SSVAL(setup, 4, parms->ntioctl.in.fnum);
+ SCVAL(setup, 6, parms->ntioctl.in.fsctl);
+ SCVAL(setup, 7, parms->ntioctl.in.filter);
nt.in.function = NT_TRANSACT_IOCTL;
nt.in.params = data_blob(NULL, 0);
nt.in.data = data_blob(NULL, 0);
@@ -99,20 +93,63 @@ struct cli_request *smb_raw_ntioctl_send(struct cli_tree *tree,
/****************************************************************************
NT ioctl (async recv)
****************************************************************************/
-NTSTATUS smb_raw_ntioctl_recv(struct cli_request *req,
- struct smb_ntioctl *parms)
+static NTSTATUS smb_raw_ntioctl_recv(struct cli_request *req,
+ TALLOC_CTX *mem_ctx,
+ union smb_ioctl *parms)
{
- struct smb_nttrans nt;
+ if (!cli_request_receive(req) ||
+ cli_request_is_error(req)) {
+ return cli_request_destroy(req);
+ }
- return smb_raw_nttrans_recv(req, req->mem_ctx, &nt);
+ parms->ntioctl.out.blob = cli_req_pull_blob(req, mem_ctx, req->in.data, -1);
+ return cli_request_destroy(req);
}
-/****************************************************************************
-NT ioctl (sync interface)
-****************************************************************************/
-NTSTATUS smb_raw_ntioctl(struct cli_tree *tree,
- struct smb_ntioctl *parms)
+
+/*
+ send a raw ioctl - async send
+*/
+struct cli_request *smb_raw_ioctl_send(struct cli_tree *tree, union smb_ioctl *parms)
+{
+ struct cli_request *req = NULL;
+
+ switch (parms->generic.level) {
+ case RAW_IOCTL_IOCTL:
+ req = smb_raw_smbioctl_send(tree, parms);
+ break;
+
+ case RAW_IOCTL_NTIOCTL:
+ req = smb_raw_ntioctl_send(tree, parms);
+ break;
+ }
+
+ return req;
+}
+
+/*
+ recv a raw ioctl - async recv
+*/
+NTSTATUS smb_raw_ioctl_recv(struct cli_request *req,
+ TALLOC_CTX *mem_ctx, union smb_ioctl *parms)
{
- struct cli_request *req = smb_raw_ntioctl_send(tree, parms);
- return smb_raw_ntioctl_recv(req, parms);
+ switch (parms->generic.level) {
+ case RAW_IOCTL_IOCTL:
+ return smb_raw_smbioctl_recv(req, mem_ctx, parms);
+
+ case RAW_IOCTL_NTIOCTL:
+ return smb_raw_ntioctl_recv(req, mem_ctx, parms);
+ }
+ return NT_STATUS_INVALID_LEVEL;
+}
+
+/*
+ send a raw ioctl - sync interface
+*/
+NTSTATUS smb_raw_ioctl(struct cli_tree *tree,
+ TALLOC_CTX *mem_ctx, union smb_ioctl *parms)
+{
+ struct cli_request *req;
+ req = smb_raw_ioctl_send(tree, parms);
+ return smb_raw_ioctl_recv(req, mem_ctx, parms);
}
diff --git a/source4/ntvfs/cifs/vfs_cifs.c b/source4/ntvfs/cifs/vfs_cifs.c
index 3903203505..c61749e2ad 100644
--- a/source4/ntvfs/cifs/vfs_cifs.c
+++ b/source4/ntvfs/cifs/vfs_cifs.c
@@ -247,7 +247,7 @@ static void async_ioctl(struct cli_request *c_req)
/*
ioctl interface
*/
-static NTSTATUS cvfs_ioctl(struct request_context *req, struct smb_ioctl *io)
+static NTSTATUS cvfs_ioctl(struct request_context *req, union smb_ioctl *io)
{
struct cvfs_private *private = req->conn->ntvfs_private;
struct cli_request *c_req;
diff --git a/source4/ntvfs/ipc/vfs_ipc.c b/source4/ntvfs/ipc/vfs_ipc.c
index da5c42507a..7ada031bd5 100644
--- a/source4/ntvfs/ipc/vfs_ipc.c
+++ b/source4/ntvfs/ipc/vfs_ipc.c
@@ -58,7 +58,7 @@ static NTSTATUS ipc_unlink(struct request_context *req, struct smb_unlink *unl)
/*
ioctl interface - we don't do any
*/
-static NTSTATUS ipc_ioctl(struct request_context *req, struct smb_ioctl *io)
+static NTSTATUS ipc_ioctl(struct request_context *req, union smb_ioctl *io)
{
return NT_STATUS_ACCESS_DENIED;
}
diff --git a/source4/ntvfs/print/vfs_print.c b/source4/ntvfs/print/vfs_print.c
index 82829d759a..a9484d4329 100644
--- a/source4/ntvfs/print/vfs_print.c
+++ b/source4/ntvfs/print/vfs_print.c
@@ -54,17 +54,21 @@ static NTSTATUS print_unlink(struct request_context *req, struct smb_unlink *unl
/*
ioctl - used for job query
*/
-static NTSTATUS print_ioctl(struct request_context *req, struct smb_ioctl *io)
+static NTSTATUS print_ioctl(struct request_context *req, union smb_ioctl *io)
{
char *p;
- if (io->in.request == IOCTL_QUERY_JOB_INFO) {
+ if (io->generic.level != RAW_IOCTL_IOCTL) {
+ return NT_STATUS_NOT_IMPLEMENTED;
+ }
+
+ if (io->ioctl.in.request == IOCTL_QUERY_JOB_INFO) {
/* a request for the print job id of an open print job */
- io->out.blob = data_blob_talloc(req->mem_ctx, NULL, 32);
+ io->ioctl.out.blob = data_blob_talloc(req->mem_ctx, NULL, 32);
- memset(io->out.blob.data, 0, io->out.blob.length);
+ data_blob_clear(&io->ioctl.out.blob);
- p = io->out.blob.data;
+ p = io->ioctl.out.blob.data;
SSVAL(p,0, 1 /* REWRITE: fsp->rap_print_jobid */);
push_string(NULL, p+2, lp_netbios_name(), 15, STR_TERMINATE|STR_ASCII);
push_string(NULL, p+18, lp_servicename(req->conn->service), 13, STR_TERMINATE|STR_ASCII);
diff --git a/source4/ntvfs/simple/vfs_simple.c b/source4/ntvfs/simple/vfs_simple.c
index f7ba41522c..261ce4a19a 100644
--- a/source4/ntvfs/simple/vfs_simple.c
+++ b/source4/ntvfs/simple/vfs_simple.c
@@ -95,7 +95,7 @@ static NTSTATUS svfs_unlink(struct request_context *req, struct smb_unlink *unl)
/*
ioctl interface - we don't do any
*/
-static NTSTATUS svfs_ioctl(struct request_context *req, struct smb_ioctl *io)
+static NTSTATUS svfs_ioctl(struct request_context *req, union smb_ioctl *io)
{
return NT_STATUS_INVALID_PARAMETER;
}
diff --git a/source4/smbd/process.c b/source4/smbd/process.c
index cf357ef547..81c658af06 100644
--- a/source4/smbd/process.c
+++ b/source4/smbd/process.c
@@ -320,7 +320,7 @@ static const struct smb_message_struct
/* 0xa2 */ { "SMBntcreateX", reply_ntcreate_and_X, AS_USER | CAN_IPC },
/* 0xa3 */ { NULL, NULL, 0 },
/* 0xa4 */ { "SMBntcancel", reply_ntcancel, 0 },
-/* 0xa5 */ { NULL, NULL, 0 },
+/* 0xa5 */ { "SMBntrename", reply_ntrename, 0 },
/* 0xa6 */ { NULL, NULL, 0 },
/* 0xa7 */ { NULL, NULL, 0 },
/* 0xa8 */ { NULL, NULL, 0 },
diff --git a/source4/smbd/reply.c b/source4/smbd/reply.c
index f4dd4cb50a..3d237d964d 100644
--- a/source4/smbd/reply.c
+++ b/source4/smbd/reply.c
@@ -2,6 +2,7 @@
Unix SMB/CIFS implementation.
Main SMB reply routines
Copyright (C) Andrew Tridgell 1992-2003
+ Copyright (C) James J Myers 2003 <myersjj@samba.org>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -226,17 +227,17 @@ void reply_unknown(struct request_context *req)
****************************************************************************/
static void reply_ioctl_send(struct request_context *req)
{
- struct smb_ioctl *io = req->async.private;
+ union smb_ioctl *io = req->async.private;
CHECK_ASYNC_STATUS;
/* the +1 is for nicer alignment */
- req_setup_reply(req, 8, io->out.blob.length+1);
- SSVAL(req->out.vwv, VWV(1), io->out.blob.length);
- SSVAL(req->out.vwv, VWV(5), io->out.blob.length);
+ req_setup_reply(req, 8, io->ioctl.out.blob.length+1);
+ SSVAL(req->out.vwv, VWV(1), io->ioctl.out.blob.length);
+ SSVAL(req->out.vwv, VWV(5), io->ioctl.out.blob.length);
SSVAL(req->out.vwv, VWV(6), PTR_DIFF(req->out.data, req->out.hdr) + 1);
- memcpy(req->out.data+1, io->out.blob.data, io->out.blob.length);
+ memcpy(req->out.data+1, io->ioctl.out.blob.data, io->ioctl.out.blob.length);
req_send_reply(req);
}
@@ -246,14 +247,15 @@ static void reply_ioctl_send(struct request_context *req)
****************************************************************************/
void reply_ioctl(struct request_context *req)
{
- struct smb_ioctl *io;
+ union smb_ioctl *io;
/* parse requst */
REQ_CHECK_WCT(req, 3);
REQ_TALLOC(io, sizeof(*io));
- io->in.fnum = req_fnum(req, req->in.vwv, VWV(0));
- io->in.request = IVAL(req->in.vwv, VWV(1));
+ io->ioctl.level = RAW_IOCTL_IOCTL;
+ io->ioctl.in.fnum = req_fnum(req, req->in.vwv, VWV(0));
+ io->ioctl.in.request = IVAL(req->in.vwv, VWV(1));
req->async.send_fn = reply_ioctl_send;
req->async.private = io;
@@ -1629,6 +1631,40 @@ void reply_mv(struct request_context *req)
/****************************************************************************
+ Reply to an NT rename.
+****************************************************************************/
+void reply_ntrename(struct request_context *req)
+{
+ union smb_rename *io;
+ char *p;
+
+ /* parse the request */
+ REQ_CHECK_WCT(req, 4);
+ REQ_TALLOC(io, sizeof(*io));
+
+ io->generic.level = RAW_RENAME_NTRENAME;
+ io->ntrename.in.attrib = SVAL(req->in.vwv, VWV(0));
+ io->ntrename.in.flags = SVAL(req->in.vwv, VWV(1));
+ io->ntrename.in.cluster_size = IVAL(req->in.vwv, VWV(2));
+
+ p = req->in.data;
+ p += req_pull_ascii4(req, &io->ntrename.in.old_name, p, STR_TERMINATE);
+ p += req_pull_ascii4(req, &io->ntrename.in.new_name, p, STR_TERMINATE);
+
+ if (!io->ntrename.in.old_name || !io->ntrename.in.new_name) {
+ req_reply_error(req, NT_STATUS_FOOBAR);
+ return;
+ }
+
+ req->async.send_fn = reply_simple_send;
+
+ /* call backend */
+ req->async.status = req->conn->ntvfs_ops->rename(req, io);
+
+ REQ_ASYNC_TAIL;
+}
+
+/****************************************************************************
Reply to a file copy (async reply)
****************************************************************************/
static void reply_copy_send(struct request_context *req)
diff --git a/source4/torture/raw/ioctl.c b/source4/torture/raw/ioctl.c
index d55db4c1e6..5bc2a67903 100644
--- a/source4/torture/raw/ioctl.c
+++ b/source4/torture/raw/ioctl.c
@@ -2,6 +2,7 @@
Unix SMB/CIFS implementation.
ioctl individual test suite
Copyright (C) Andrew Tridgell 2003
+ Copyright (C) James J Myers 2003 <myersjj@samba.org>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -34,7 +35,7 @@
/* test some ioctls */
static BOOL test_ioctl(struct cli_state *cli, TALLOC_CTX *mem_ctx)
{
- struct smb_ioctl ctl;
+ union smb_ioctl ctl;
int fnum;
NTSTATUS status;
BOOL ret = True;
@@ -50,14 +51,15 @@ static BOOL test_ioctl(struct cli_state *cli, TALLOC_CTX *mem_ctx)
}
printf("Trying QUERY_JOB_INFO\n");
- ctl.in.fnum = fnum;
- ctl.in.request = IOCTL_QUERY_JOB_INFO;
+ ctl.ioctl.level = RAW_IOCTL_IOCTL;
+ ctl.ioctl.in.fnum = fnum;
+ ctl.ioctl.in.request = IOCTL_QUERY_JOB_INFO;
status = smb_raw_ioctl(cli->tree, mem_ctx, &ctl);
CHECK_STATUS(status, NT_STATUS_UNSUCCESSFUL);
printf("Trying bad handle\n");
- ctl.in.fnum = fnum+1;
+ ctl.ioctl.in.fnum = fnum+1;
status = smb_raw_ioctl(cli->tree, mem_ctx, &ctl);
CHECK_STATUS(status, NT_STATUS_UNSUCCESSFUL);
@@ -73,7 +75,7 @@ static BOOL test_fsctl(struct cli_state *cli, TALLOC_CTX *mem_ctx)
NTSTATUS status;
BOOL ret = True;
const char *fname = BASEDIR "\\test.dat";
- struct smb_ntioctl nt;
+ union smb_ioctl nt;
printf("\nTESTING FSCTL FUNCTIONS\n");
@@ -85,24 +87,25 @@ static BOOL test_fsctl(struct cli_state *cli, TALLOC_CTX *mem_ctx)
}
printf("trying sparse file\n");
- nt.in.function = FSCTL_SET_SPARSE;
- nt.in.fnum = fnum;
- nt.in.fsctl = True;
- nt.in.filter = 0;
+ nt.ioctl.level = RAW_IOCTL_NTIOCTL;
+ nt.ntioctl.in.function = FSCTL_SET_SPARSE;
+ nt.ntioctl.in.fnum = fnum;
+ nt.ntioctl.in.fsctl = True;
+ nt.ntioctl.in.filter = 0;
- status = smb_raw_ntioctl(cli->tree, &nt);
+ status = smb_raw_ioctl(cli->tree, mem_ctx, &nt);
CHECK_STATUS(status, NT_STATUS_OK);
printf("Trying bad handle\n");
- nt.in.fnum = fnum+1;
- status = smb_raw_ntioctl(cli->tree, &nt);
+ nt.ntioctl.in.fnum = fnum+1;
+ status = smb_raw_ioctl(cli->tree, mem_ctx, &nt);
CHECK_STATUS(status, NT_STATUS_INVALID_HANDLE);
#if 0
- nt.in.fnum = fnum;
+ nt.ntioctl.in.fnum = fnum;
for (i=0;i<100;i++) {
- nt.in.function = FSCTL_FILESYSTEM + (i<<2);
- status = smb_raw_ntioctl(cli->tree, &nt);
+ nt.ntioctl.in.function = FSCTL_FILESYSTEM + (i<<2);
+ status = smb_raw_ioctl(cli->tree, mem_ctx, &nt);
if (!NT_STATUS_EQUAL(status, NT_STATUS_NOT_SUPPORTED)) {
printf("filesystem fsctl 0x%x - %s\n",
i, nt_errstr(status));
diff --git a/source4/torture/raw/seek.c b/source4/torture/raw/seek.c
index ec3b7125c9..85ca9f2869 100644
--- a/source4/torture/raw/seek.c
+++ b/source4/torture/raw/seek.c
@@ -136,7 +136,7 @@ static BOOL test_seek(struct cli_state *cli, TALLOC_CTX *mem_ctx)
CHECK_STATUS(status, NT_STATUS_OK);
CHECK_VALUE(finfo.position_information.out.position, 0);
- printf("trying read to update offset\n");
+ printf("trying write to update offset\n");
ZERO_STRUCT(c);
if (cli_write(cli, fnum, 0, c, 0, 2) != 2) {
printf("Write failed - %s\n", cli_errstr(cli));
diff --git a/source4/torture/torture.c b/source4/torture/torture.c
index 3851337b8e..cc0a83fe80 100644
--- a/source4/torture/torture.c
+++ b/source4/torture/torture.c
@@ -3589,9 +3589,8 @@ BOOL torture_ioctl_test(int dummy)
uint16 device, function;
int fnum;
const char *fname = "\\ioctl.dat";
- DATA_BLOB blob;
NTSTATUS status;
- struct smb_ioctl parms;
+ union smb_ioctl parms;
TALLOC_CTX *mem_ctx;
if (!torture_open_connection(&cli)) {
@@ -3610,20 +3609,20 @@ BOOL torture_ioctl_test(int dummy)
return False;
}
- parms.in.request = IOCTL_QUERY_JOB_INFO;
+ parms.ioctl.level = RAW_IOCTL_IOCTL;
+ parms.ioctl.in.request = IOCTL_QUERY_JOB_INFO;
status = smb_raw_ioctl(cli->tree, mem_ctx, &parms);
printf("ioctl job info: %s\n", cli_errstr(cli));
for (device=0;device<0x100;device++) {
printf("testing device=0x%x\n", device);
for (function=0;function<0x100;function++) {
- parms.in.request = (device << 16) | function;
+ parms.ioctl.in.request = (device << 16) | function;
status = smb_raw_ioctl(cli->tree, mem_ctx, &parms);
if (NT_STATUS_IS_OK(status)) {
printf("ioctl device=0x%x function=0x%x OK : %d bytes\n",
- device, function, blob.length);
- data_blob_free(&parms.out.blob);
+ device, function, parms.ioctl.out.blob.length);
}
}
}
diff --git a/source4/torture/torture_util.c b/source4/torture/torture_util.c
index 27c2892c47..8dbec60b12 100644
--- a/source4/torture/torture_util.c
+++ b/source4/torture/torture_util.c
@@ -331,12 +331,24 @@ BOOL torture_set_file_attribute(struct cli_tree *tree, const char *fname, uint16
*/
NTSTATUS torture_set_sparse(struct cli_tree *tree, int fnum)
{
- struct smb_ntioctl nt;
+ union smb_ioctl nt;
+ NTSTATUS status;
+ TALLOC_CTX *mem_ctx;
+
+ mem_ctx = talloc_init("torture_set_sparse");
+ if (!mem_ctx) {
+ return NT_STATUS_NO_MEMORY;
+ }
- nt.in.function = 0x900c4;
- nt.in.fnum = fnum;
- nt.in.fsctl = True;
- nt.in.filter = 0;
+ nt.ntioctl.level = RAW_IOCTL_NTIOCTL;
+ nt.ntioctl.in.function = 0x900c4;
+ nt.ntioctl.in.fnum = fnum;
+ nt.ntioctl.in.fsctl = True;
+ nt.ntioctl.in.filter = 0;
+
+ status = smb_raw_ioctl(tree, mem_ctx, &nt);
+
+ talloc_destroy(mem_ctx);
- return smb_raw_ntioctl(tree, &nt);
+ return status;
}