diff options
author | Andrew Tridgell <tridge@samba.org> | 2003-12-04 02:03:06 +0000 |
---|---|---|
committer | Andrew Tridgell <tridge@samba.org> | 2003-12-04 02:03:06 +0000 |
commit | 926240428c0646aabb13539745940b61a7cf44a9 (patch) | |
tree | 102988d47fab4a56b59161409dddc9c9dfa86ed5 /source4/torture | |
parent | b8cbd9181efabbc360ef335e214a696011839b41 (diff) | |
download | samba-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/torture')
-rw-r--r-- | source4/torture/raw/ioctl.c | 33 | ||||
-rw-r--r-- | source4/torture/raw/seek.c | 2 | ||||
-rw-r--r-- | source4/torture/torture.c | 11 | ||||
-rw-r--r-- | source4/torture/torture_util.c | 24 |
4 files changed, 42 insertions, 28 deletions
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; } |