* patch based on work by Jim Myers to unify the ioctl handling to be
authorAndrew Tridgell <tridge@samba.org>
Thu, 4 Dec 2003 02:03:06 +0000 (02:03 +0000)
committerAndrew Tridgell <tridge@samba.org>
Thu, 4 Dec 2003 02:03:06 +0000 (02:03 +0000)
  more like the other major SMB functions

* added SMBntrename code
(This used to be commit f2d3dc9893fa0e089c407fa16ce9ff13587e70cd)

13 files changed:
source4/include/ntvfs.h
source4/include/smb_interfaces.h
source4/libcli/raw/rawioctl.c
source4/ntvfs/cifs/vfs_cifs.c
source4/ntvfs/ipc/vfs_ipc.c
source4/ntvfs/print/vfs_print.c
source4/ntvfs/simple/vfs_simple.c
source4/smbd/process.c
source4/smbd/reply.c
source4/torture/raw/ioctl.c
source4/torture/raw/seek.c
source4/torture/torture.c
source4/torture/torture_util.c

index af23f1060705601ee3509c55b451c6e7d10d2b8f..6628402a970cb45ddf67a9c8055fe485b90a0373 100644 (file)
@@ -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);
index 52df49f01b085590750560aa49c9084eeed9376c..4bf557359ef473ce5930c44e5f952d66578e6967 100644 (file)
@@ -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;
 };
 
-
index 506bddd4979a9d1f520cf0d5878f8c7a8ddd9896..2ea2cabb8994d5d16d2b5cb0d918f818a7d506e6 100644 (file)
@@ -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
 } 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);
 }
index 3903203505a3f46ce3d6aaefe45d222365dac037..c61749e2ad5caf28fa98b97b5a916245e3881b63 100644 (file)
@@ -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;
index da5c42507a1005050170fdaf0f5bd23cbffb1b2f..7ada031bd57fd50526b0939c7fce2eb9d930bc7a 100644 (file)
@@ -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;
 }
index 82829d759a8ec3e6a93b47639e61c172364378f1..a9484d4329e0c04059b20a849df44584e9e1bf65 100644 (file)
@@ -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);
index f7ba41522cde0a4d780f5cf1e6021a33461de5e1..261ce4a19a9d3397bc16ec6473392570d10a7b6a 100644 (file)
@@ -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;
 }
index cf357ef547c926125eba15616791c4094aac5949..81c658af06d6fdc085ead5d2c18cc91063c620e5 100644 (file)
@@ -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 },
index f4dd4cb50aac81278542d4c0b28a5257f68eaf19..3d237d964d543d1d2e2e660878fbcb7cabe2ec82 100644 (file)
@@ -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;
@@ -1628,6 +1630,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)
 ****************************************************************************/
index d55db4c1e62e3cc6e2d27bc90a89477a4a137169..5bc2a679032a052515eaee92291d5c305da589b7 100644 (file)
@@ -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));
index ec3b7125c9487091065e20a6f3a49017b157b126..85ca9f28694d77f5d2d9f4a1898b1b16c7fc26bf 100644 (file)
@@ -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));
index 3851337b8ec496bf84087698ac180b02e60a5f69..cc0a83fe80b79925c157f6b845867355943a2437 100644 (file)
@@ -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);
                        }
                }
        }
index 27c2892c474405c8d2497c399739e486a05b90b4..8dbec60b123200a6a9cad6fced7de5b161501b78 100644 (file)
@@ -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;
 }