summaryrefslogtreecommitdiff
path: root/source4/torture/raw
diff options
context:
space:
mode:
authorTim Potter <tpot@samba.org>2004-02-08 00:51:07 +0000
committerTim Potter <tpot@samba.org>2004-02-08 00:51:07 +0000
commit4639eb5a58f8c0906afdc8e8f8f67f82e9547f75 (patch)
tree2115d25166961cea7d49836d53a05e98c796ff8a /source4/torture/raw
parentf0c9a54b30cfa627b4ddcbc24fe943b21472df34 (diff)
downloadsamba-4639eb5a58f8c0906afdc8e8f8f67f82e9547f75.tar.gz
samba-4639eb5a58f8c0906afdc8e8f8f67f82e9547f75.tar.bz2
samba-4639eb5a58f8c0906afdc8e8f8f67f82e9547f75.zip
Convert libcli routines to use cli_tree instead of cli_state. Port
smbtorture to use the new interface. Part 2 will be to eliminate cli_state from smbtorture as this is now the only place where it is used. (This used to be commit db1cc96af62ea42837d60592877fc3f93cef143b)
Diffstat (limited to 'source4/torture/raw')
-rw-r--r--source4/torture/raw/chkpath.c12
-rw-r--r--source4/torture/raw/close.c8
-rw-r--r--source4/torture/raw/context.c20
-rw-r--r--source4/torture/raw/ioctl.c16
-rw-r--r--source4/torture/raw/lock.c54
-rw-r--r--source4/torture/raw/mkdir.c12
-rw-r--r--source4/torture/raw/mux.c30
-rw-r--r--source4/torture/raw/notify.c10
-rw-r--r--source4/torture/raw/open.c162
-rw-r--r--source4/torture/raw/oplock.c16
-rw-r--r--source4/torture/raw/qfileinfo.c12
-rw-r--r--source4/torture/raw/read.c90
-rw-r--r--source4/torture/raw/rename.c34
-rw-r--r--source4/torture/raw/search.c18
-rw-r--r--source4/torture/raw/seek.c24
-rw-r--r--source4/torture/raw/setfileinfo.c30
-rw-r--r--source4/torture/raw/unlink.c14
-rw-r--r--source4/torture/raw/write.c102
18 files changed, 332 insertions, 332 deletions
diff --git a/source4/torture/raw/chkpath.c b/source4/torture/raw/chkpath.c
index 3364c39a73..6e128a01a4 100644
--- a/source4/torture/raw/chkpath.c
+++ b/source4/torture/raw/chkpath.c
@@ -49,7 +49,7 @@ static BOOL test_chkpath(struct cli_state *cli, TALLOC_CTX *mem_ctx)
fnum = create_complex_file(cli, mem_ctx, BASEDIR "\\test.txt");
if (fnum == -1) {
- printf("failed to open test.txt - %s\n", cli_errstr(cli));
+ printf("failed to open test.txt - %s\n", cli_errstr(cli->tree));
ret = False;
goto done;
}
@@ -101,7 +101,7 @@ static BOOL test_chkpath(struct cli_state *cli, TALLOC_CTX *mem_ctx)
CHECK_STATUS(status, NT_STATUS_OK);
done:
- cli_close(cli, fnum);
+ cli_close(cli->tree, fnum);
return ret;
}
@@ -120,12 +120,12 @@ BOOL torture_raw_chkpath(int dummy)
mem_ctx = talloc_init("torture_raw_chkpath");
- if (cli_deltree(cli, BASEDIR) == -1) {
+ if (cli_deltree(cli->tree, BASEDIR) == -1) {
printf("Failed to clean " BASEDIR "\n");
return False;
}
- if (!cli_mkdir(cli, BASEDIR)) {
- printf("Failed to create " BASEDIR " - %s\n", cli_errstr(cli));
+ if (!cli_mkdir(cli->tree, BASEDIR)) {
+ printf("Failed to create " BASEDIR " - %s\n", cli_errstr(cli->tree));
return False;
}
@@ -134,7 +134,7 @@ BOOL torture_raw_chkpath(int dummy)
}
smb_raw_exit(cli->session);
- cli_deltree(cli, BASEDIR);
+ cli_deltree(cli->tree, BASEDIR);
torture_close_connection(cli);
talloc_destroy(mem_ctx);
diff --git a/source4/torture/raw/close.c b/source4/torture/raw/close.c
index 40bb57f303..909c8f6c95 100644
--- a/source4/torture/raw/close.c
+++ b/source4/torture/raw/close.c
@@ -100,7 +100,7 @@ BOOL torture_raw_close(int dummy)
}
- cli_unlink(cli, fname);
+ cli_unlink(cli->tree, fname);
REOPEN;
finfo2.generic.in.fname = fname;
@@ -137,7 +137,7 @@ BOOL torture_raw_close(int dummy)
CHECK_STATUS(status, NT_STATUS_UNSUCCESSFUL);
printf("testing flush\n");
- cli_close(cli, fnum);
+ cli_close(cli->tree, fnum);
io_flush.in.fnum = fnum;
status = smb_raw_flush(cli->tree, &io_flush);
@@ -162,8 +162,8 @@ BOOL torture_raw_close(int dummy)
done:
- cli_close(cli, fnum);
- cli_unlink(cli, fname);
+ cli_close(cli->tree, fnum);
+ cli_unlink(cli->tree, fname);
torture_close_connection(cli);
talloc_destroy(mem_ctx);
return ret;
diff --git a/source4/torture/raw/context.c b/source4/torture/raw/context.c
index c19fea458d..4fc9b3788e 100644
--- a/source4/torture/raw/context.c
+++ b/source4/torture/raw/context.c
@@ -59,9 +59,9 @@ static BOOL test_session(struct cli_state *cli, TALLOC_CTX *mem_ctx)
printf("TESTING SESSION HANDLING\n");
- if (cli_deltree(cli, BASEDIR) == -1 ||
- !cli_mkdir(cli, BASEDIR)) {
- printf("Unable to setup %s - %s\n", BASEDIR, cli_errstr(cli));
+ if (cli_deltree(cli->tree, BASEDIR) == -1 ||
+ !cli_mkdir(cli->tree, BASEDIR)) {
+ printf("Unable to setup %s - %s\n", BASEDIR, cli_errstr(cli->tree));
return False;
}
@@ -167,9 +167,9 @@ static BOOL test_tree(struct cli_state *cli, TALLOC_CTX *mem_ctx)
printf("TESTING TREE HANDLING\n");
- if (cli_deltree(cli, BASEDIR) == -1 ||
- !cli_mkdir(cli, BASEDIR)) {
- printf("Unable to setup %s - %s\n", BASEDIR, cli_errstr(cli));
+ if (cli_deltree(cli->tree, BASEDIR) == -1 ||
+ !cli_mkdir(cli->tree, BASEDIR)) {
+ printf("Unable to setup %s - %s\n", BASEDIR, cli_errstr(cli->tree));
return False;
}
@@ -269,9 +269,9 @@ static BOOL test_pid(struct cli_state *cli, TALLOC_CTX *mem_ctx)
printf("TESTING PID HANDLING\n");
- if (cli_deltree(cli, BASEDIR) == -1 ||
- !cli_mkdir(cli, BASEDIR)) {
- printf("Unable to setup %s - %s\n", BASEDIR, cli_errstr(cli));
+ if (cli_deltree(cli->tree, BASEDIR) == -1 ||
+ !cli_mkdir(cli->tree, BASEDIR)) {
+ printf("Unable to setup %s - %s\n", BASEDIR, cli_errstr(cli->tree));
return False;
}
@@ -380,7 +380,7 @@ BOOL torture_raw_context(int dummy)
}
smb_raw_exit(cli->session);
- cli_deltree(cli, BASEDIR);
+ cli_deltree(cli->tree, BASEDIR);
torture_close_connection(cli);
talloc_destroy(mem_ctx);
diff --git a/source4/torture/raw/ioctl.c b/source4/torture/raw/ioctl.c
index 5bc2a67903..a7787b6d28 100644
--- a/source4/torture/raw/ioctl.c
+++ b/source4/torture/raw/ioctl.c
@@ -45,7 +45,7 @@ static BOOL test_ioctl(struct cli_state *cli, TALLOC_CTX *mem_ctx)
fnum = create_complex_file(cli, mem_ctx, fname);
if (fnum == -1) {
- printf("Failed to create test.dat - %s\n", cli_errstr(cli));
+ printf("Failed to create test.dat - %s\n", cli_errstr(cli->tree));
ret = False;
goto done;
}
@@ -64,7 +64,7 @@ static BOOL test_ioctl(struct cli_state *cli, TALLOC_CTX *mem_ctx)
CHECK_STATUS(status, NT_STATUS_UNSUCCESSFUL);
done:
- cli_close(cli, fnum);
+ cli_close(cli->tree, fnum);
return ret;
}
@@ -81,7 +81,7 @@ static BOOL test_fsctl(struct cli_state *cli, TALLOC_CTX *mem_ctx)
fnum = create_complex_file(cli, mem_ctx, fname);
if (fnum == -1) {
- printf("Failed to create test.dat - %s\n", cli_errstr(cli));
+ printf("Failed to create test.dat - %s\n", cli_errstr(cli->tree));
ret = False;
goto done;
}
@@ -114,7 +114,7 @@ static BOOL test_fsctl(struct cli_state *cli, TALLOC_CTX *mem_ctx)
#endif
done:
- cli_close(cli, fnum);
+ cli_close(cli->tree, fnum);
return ret;
}
@@ -133,12 +133,12 @@ BOOL torture_raw_ioctl(int dummy)
mem_ctx = talloc_init("torture_raw_ioctl");
- if (cli_deltree(cli, BASEDIR) == -1) {
+ if (cli_deltree(cli->tree, BASEDIR) == -1) {
printf("Failed to clean " BASEDIR "\n");
return False;
}
- if (!cli_mkdir(cli, BASEDIR)) {
- printf("Failed to create " BASEDIR " - %s\n", cli_errstr(cli));
+ if (!cli_mkdir(cli->tree, BASEDIR)) {
+ printf("Failed to create " BASEDIR " - %s\n", cli_errstr(cli->tree));
return False;
}
@@ -151,7 +151,7 @@ BOOL torture_raw_ioctl(int dummy)
}
smb_raw_exit(cli->session);
- cli_deltree(cli, BASEDIR);
+ cli_deltree(cli->tree, BASEDIR);
torture_close_connection(cli);
talloc_destroy(mem_ctx);
diff --git a/source4/torture/raw/lock.c b/source4/torture/raw/lock.c
index 56dc1ec163..e36f9edddf 100644
--- a/source4/torture/raw/lock.c
+++ b/source4/torture/raw/lock.c
@@ -50,18 +50,18 @@ static BOOL test_lock(struct cli_state *cli, TALLOC_CTX *mem_ctx)
int fnum;
const char *fname = BASEDIR "\\test.txt";
- if (cli_deltree(cli, BASEDIR) == -1 ||
- !cli_mkdir(cli, BASEDIR)) {
- printf("Unable to setup %s - %s\n", BASEDIR, cli_errstr(cli));
+ if (cli_deltree(cli->tree, BASEDIR) == -1 ||
+ !cli_mkdir(cli->tree, BASEDIR)) {
+ printf("Unable to setup %s - %s\n", BASEDIR, cli_errstr(cli->tree));
return False;
}
printf("Testing RAW_LOCK_LOCK\n");
io.generic.level = RAW_LOCK_LOCK;
- fnum = cli_open(cli, fname, O_RDWR|O_CREAT, DENY_NONE);
+ fnum = cli_open(cli->tree, fname, O_RDWR|O_CREAT, DENY_NONE);
if (fnum == -1) {
- printf("Failed to create %s - %s\n", fname, cli_errstr(cli));
+ printf("Failed to create %s - %s\n", fname, cli_errstr(cli->tree));
ret = False;
goto done;
}
@@ -133,9 +133,9 @@ static BOOL test_lock(struct cli_state *cli, TALLOC_CTX *mem_ctx)
CHECK_STATUS(status, NT_STATUS_OK);
done:
- cli_close(cli, fnum);
+ cli_close(cli->tree, fnum);
smb_raw_exit(cli->session);
- cli_deltree(cli, BASEDIR);
+ cli_deltree(cli->tree, BASEDIR);
return ret;
}
@@ -152,18 +152,18 @@ static BOOL test_lockx(struct cli_state *cli, TALLOC_CTX *mem_ctx)
int fnum;
const char *fname = BASEDIR "\\test.txt";
- if (cli_deltree(cli, BASEDIR) == -1 ||
- !cli_mkdir(cli, BASEDIR)) {
- printf("Unable to setup %s - %s\n", BASEDIR, cli_errstr(cli));
+ if (cli_deltree(cli->tree, BASEDIR) == -1 ||
+ !cli_mkdir(cli->tree, BASEDIR)) {
+ printf("Unable to setup %s - %s\n", BASEDIR, cli_errstr(cli->tree));
return False;
}
printf("Testing RAW_LOCK_LOCKX\n");
io.generic.level = RAW_LOCK_LOCKX;
- fnum = cli_open(cli, fname, O_RDWR|O_CREAT, DENY_NONE);
+ fnum = cli_open(cli->tree, fname, O_RDWR|O_CREAT, DENY_NONE);
if (fnum == -1) {
- printf("Failed to create %s - %s\n", fname, cli_errstr(cli));
+ printf("Failed to create %s - %s\n", fname, cli_errstr(cli->tree));
ret = False;
goto done;
}
@@ -182,9 +182,9 @@ static BOOL test_lockx(struct cli_state *cli, TALLOC_CTX *mem_ctx)
CHECK_STATUS(status, NT_STATUS_OK);
done:
- cli_close(cli, fnum);
+ cli_close(cli->tree, fnum);
smb_raw_exit(cli->session);
- cli_deltree(cli, BASEDIR);
+ cli_deltree(cli->tree, BASEDIR);
return ret;
}
@@ -202,9 +202,9 @@ static BOOL test_pidhigh(struct cli_state *cli, TALLOC_CTX *mem_ctx)
const char *fname = BASEDIR "\\test.txt";
char c = 1;
- if (cli_deltree(cli, BASEDIR) == -1 ||
- !cli_mkdir(cli, BASEDIR)) {
- printf("Unable to setup %s - %s\n", BASEDIR, cli_errstr(cli));
+ if (cli_deltree(cli->tree, BASEDIR) == -1 ||
+ !cli_mkdir(cli->tree, BASEDIR)) {
+ printf("Unable to setup %s - %s\n", BASEDIR, cli_errstr(cli->tree));
return False;
}
@@ -213,15 +213,15 @@ static BOOL test_pidhigh(struct cli_state *cli, TALLOC_CTX *mem_ctx)
cli->session->pid = 1;
- fnum = cli_open(cli, fname, O_RDWR|O_CREAT, DENY_NONE);
+ fnum = cli_open(cli->tree, fname, O_RDWR|O_CREAT, DENY_NONE);
if (fnum == -1) {
- printf("Failed to create %s - %s\n", fname, cli_errstr(cli));
+ printf("Failed to create %s - %s\n", fname, cli_errstr(cli->tree));
ret = False;
goto done;
}
- if (cli_write(cli, fnum, 0, &c, 0, 1) != 1) {
- printf("Failed to write 1 byte - %s\n", cli_errstr(cli));
+ if (cli_write(cli->tree, fnum, 0, &c, 0, 1) != 1) {
+ printf("Failed to write 1 byte - %s\n", cli_errstr(cli->tree));
ret = False;
goto done;
}
@@ -239,8 +239,8 @@ static BOOL test_pidhigh(struct cli_state *cli, TALLOC_CTX *mem_ctx)
status = smb_raw_lock(cli->tree, &io);
CHECK_STATUS(status, NT_STATUS_OK);
- if (cli_read(cli, fnum, &c, 0, 1) != 1) {
- printf("Failed to read 1 byte - %s\n", cli_errstr(cli));
+ if (cli_read(cli->tree, fnum, &c, 0, 1) != 1) {
+ printf("Failed to read 1 byte - %s\n", cli_errstr(cli->tree));
ret = False;
goto done;
}
@@ -249,7 +249,7 @@ static BOOL test_pidhigh(struct cli_state *cli, TALLOC_CTX *mem_ctx)
cli->session->pid = 2;
- if (cli_read(cli, fnum, &c, 0, 1) == 1) {
+ if (cli_read(cli->tree, fnum, &c, 0, 1) == 1) {
printf("pid is incorrect handled for read with lock!\n");
ret = False;
goto done;
@@ -257,7 +257,7 @@ static BOOL test_pidhigh(struct cli_state *cli, TALLOC_CTX *mem_ctx)
cli->session->pid = 0x10001;
- if (cli_read(cli, fnum, &c, 0, 1) != 1) {
+ if (cli_read(cli->tree, fnum, &c, 0, 1) != 1) {
printf("High pid is used on this server!\n");
ret = False;
} else {
@@ -265,9 +265,9 @@ static BOOL test_pidhigh(struct cli_state *cli, TALLOC_CTX *mem_ctx)
}
done:
- cli_close(cli, fnum);
+ cli_close(cli->tree, fnum);
smb_raw_exit(cli->session);
- cli_deltree(cli, BASEDIR);
+ cli_deltree(cli->tree, BASEDIR);
return ret;
}
diff --git a/source4/torture/raw/mkdir.c b/source4/torture/raw/mkdir.c
index 52120f0542..b614800106 100644
--- a/source4/torture/raw/mkdir.c
+++ b/source4/torture/raw/mkdir.c
@@ -40,8 +40,8 @@ static BOOL test_mkdir(struct cli_state *cli, TALLOC_CTX *mem_ctx)
BOOL ret = True;
/* cleanup */
- cli_rmdir(cli, path);
- cli_unlink(cli, path);
+ cli_rmdir(cli->tree, path);
+ cli_unlink(cli->tree, path);
/*
basic mkdir
@@ -69,7 +69,7 @@ static BOOL test_mkdir(struct cli_state *cli, TALLOC_CTX *mem_ctx)
printf("testing mkdir collision with file\n");
/* name collision with a file */
- cli_close(cli, create_complex_file(cli, mem_ctx, path));
+ cli_close(cli->tree, create_complex_file(cli, mem_ctx, path));
status = smb_raw_mkdir(cli->tree, &md);
CHECK_STATUS(status, NT_STATUS_OBJECT_NAME_COLLISION);
@@ -79,7 +79,7 @@ static BOOL test_mkdir(struct cli_state *cli, TALLOC_CTX *mem_ctx)
status = smb_raw_rmdir(cli->tree, &rd);
CHECK_STATUS(status, NT_STATUS_NOT_A_DIRECTORY);
- cli_unlink(cli, path);
+ cli_unlink(cli->tree, path);
printf("testing invalid dir\n");
@@ -110,8 +110,8 @@ static BOOL test_mkdir(struct cli_state *cli, TALLOC_CTX *mem_ctx)
done:
- cli_rmdir(cli, path);
- cli_unlink(cli, path);
+ cli_rmdir(cli->tree, path);
+ cli_unlink(cli->tree, path);
return ret;
}
diff --git a/source4/torture/raw/mux.c b/source4/torture/raw/mux.c
index 05c5e3de09..70e6c09d9e 100644
--- a/source4/torture/raw/mux.c
+++ b/source4/torture/raw/mux.c
@@ -74,13 +74,13 @@ static BOOL test_mux_open(struct cli_state *cli, TALLOC_CTX *mem_ctx)
req = smb_raw_open_send(cli->tree, &io);
/* and close the file */
- cli_close(cli, fnum);
+ cli_close(cli->tree, fnum);
/* see if the async open succeeded */
status = smb_raw_open_recv(req, mem_ctx, &io);
CHECK_STATUS(status, NT_STATUS_OK);
- cli_close(cli, io.ntcreatex.out.fnum);
+ cli_close(cli->tree, io.ntcreatex.out.fnum);
done:
return ret;
@@ -100,9 +100,9 @@ static BOOL test_mux_write(struct cli_state *cli, TALLOC_CTX *mem_ctx)
printf("testing multiplexed lock/write/close\n");
- fnum = cli_open(cli, BASEDIR "\\write.dat", O_RDWR | O_CREAT, DENY_NONE);
+ fnum = cli_open(cli->tree, BASEDIR "\\write.dat", O_RDWR | O_CREAT, DENY_NONE);
if (fnum == -1) {
- printf("open failed in mux_write - %s\n", cli_errstr(cli));
+ printf("open failed in mux_write - %s\n", cli_errstr(cli->tree));
ret = False;
goto done;
}
@@ -110,8 +110,8 @@ static BOOL test_mux_write(struct cli_state *cli, TALLOC_CTX *mem_ctx)
cli->session->pid = 1;
/* lock a range */
- if (!cli_lock(cli, fnum, 0, 4, 0, WRITE_LOCK)) {
- printf("lock failed in mux_write - %s\n", cli_errstr(cli));
+ if (!cli_lock(cli->tree, fnum, 0, 4, 0, WRITE_LOCK)) {
+ printf("lock failed in mux_write - %s\n", cli_errstr(cli->tree));
ret = False;
goto done;
}
@@ -130,13 +130,13 @@ static BOOL test_mux_write(struct cli_state *cli, TALLOC_CTX *mem_ctx)
/* unlock the range */
cli->session->pid = 1;
- cli_unlock(cli, fnum, 0, 4);
+ cli_unlock(cli->tree, fnum, 0, 4);
/* and recv the async write reply */
status = smb_raw_write_recv(req, &io);
CHECK_STATUS(status, NT_STATUS_FILE_LOCK_CONFLICT);
- cli_close(cli, fnum);
+ cli_close(cli->tree, fnum);
done:
return ret;
@@ -157,9 +157,9 @@ static BOOL test_mux_lock(struct cli_state *cli, TALLOC_CTX *mem_ctx)
printf("TESTING MULTIPLEXED LOCK/LOCK/UNLOCK\n");
- fnum = cli_open(cli, BASEDIR "\\write.dat", O_RDWR | O_CREAT, DENY_NONE);
+ fnum = cli_open(cli->tree, BASEDIR "\\write.dat", O_RDWR | O_CREAT, DENY_NONE);
if (fnum == -1) {
- printf("open failed in mux_write - %s\n", cli_errstr(cli));
+ printf("open failed in mux_write - %s\n", cli_errstr(cli->tree));
ret = False;
goto done;
}
@@ -202,7 +202,7 @@ static BOOL test_mux_lock(struct cli_state *cli, TALLOC_CTX *mem_ctx)
printf("reopening with an exit\n");
smb_raw_exit(cli->session);
- fnum = cli_open(cli, BASEDIR "\\write.dat", O_RDWR | O_CREAT, DENY_NONE);
+ fnum = cli_open(cli->tree, BASEDIR "\\write.dat", O_RDWR | O_CREAT, DENY_NONE);
printf("Now trying with a cancel\n");
@@ -240,7 +240,7 @@ static BOOL test_mux_lock(struct cli_state *cli, TALLOC_CTX *mem_ctx)
status = cli_request_simple_recv(req);
CHECK_STATUS(status, NT_STATUS_FILE_LOCK_CONFLICT);
- cli_close(cli, fnum);
+ cli_close(cli->tree, fnum);
done:
return ret;
@@ -264,14 +264,14 @@ BOOL torture_raw_mux(int dummy)
mem_ctx = talloc_init("torture_raw_mux");
/* cleanup */
- if (cli_deltree(cli, BASEDIR) == -1) {
+ if (cli_deltree(cli->tree, BASEDIR) == -1) {
printf("Failed to cleanup " BASEDIR "\n");
ret = False;
goto done;
}
- if (!cli_mkdir(cli, BASEDIR)) {
+ if (!cli_mkdir(cli->tree, BASEDIR)) {
printf("Failed to create %s\n", BASEDIR);
ret = False;
goto done;
@@ -291,7 +291,7 @@ BOOL torture_raw_mux(int dummy)
done:
smb_raw_exit(cli->session);
- cli_deltree(cli, BASEDIR);
+ cli_deltree(cli->tree, BASEDIR);
torture_close_connection(cli);
talloc_destroy(mem_ctx);
return ret;
diff --git a/source4/torture/raw/notify.c b/source4/torture/raw/notify.c
index a123dc6702..b94474aa43 100644
--- a/source4/torture/raw/notify.c
+++ b/source4/torture/raw/notify.c
@@ -68,7 +68,7 @@ BOOL torture_raw_notify(int dummy)
mem_ctx = talloc_init("torture_raw_notify");
/* cleanup */
- if (cli_deltree(cli, BASEDIR) == -1) {
+ if (cli_deltree(cli->tree, BASEDIR) == -1) {
printf("Failed to cleanup " BASEDIR "\n");
ret = False;
goto done;
@@ -103,7 +103,7 @@ BOOL torture_raw_notify(int dummy)
printf("testing notify mkdir\n");
req = smb_raw_changenotify_send(cli->tree, &notify);
- cli_mkdir(cli, BASEDIR "\\subdir-name");
+ cli_mkdir(cli->tree, BASEDIR "\\subdir-name");
status = smb_raw_changenotify_recv(req, mem_ctx, &notify);
CHECK_STATUS(status, NT_STATUS_OK);
@@ -115,7 +115,7 @@ BOOL torture_raw_notify(int dummy)
printf("testing notify rmdir\n");
req = smb_raw_changenotify_send(cli->tree, &notify);
- cli_rmdir(cli, BASEDIR "\\subdir-name");
+ cli_rmdir(cli->tree, BASEDIR "\\subdir-name");
status = smb_raw_changenotify_recv(req, mem_ctx, &notify);
CHECK_STATUS(status, NT_STATUS_OK);
@@ -127,13 +127,13 @@ BOOL torture_raw_notify(int dummy)
req = smb_raw_changenotify_send(cli->tree, &notify);
smb_raw_ntcancel(req);
- cli_mkdir(cli, BASEDIR "\\subdir-name");
+ cli_mkdir(cli->tree, BASEDIR "\\subdir-name");
status = smb_raw_changenotify_recv(req, mem_ctx, &notify);
CHECK_STATUS(status, NT_STATUS_CANCELLED);
done:
smb_raw_exit(cli->session);
- cli_deltree(cli, BASEDIR);
+ cli_deltree(cli->tree, BASEDIR);
torture_close_connection(cli);
talloc_destroy(mem_ctx);
return ret;
diff --git a/source4/torture/raw/open.c b/source4/torture/raw/open.c
index 3e28322f37..567940b2e8 100644
--- a/source4/torture/raw/open.c
+++ b/source4/torture/raw/open.c
@@ -28,11 +28,11 @@ enum rdwr_mode {RDWR_NONE, RDWR_RDONLY, RDWR_WRONLY, RDWR_RDWR};
/*
check if a open file can be read/written
*/
-static enum rdwr_mode check_rdwr(struct cli_state *cli, int fnum)
+static enum rdwr_mode check_rdwr(struct cli_tree *tree, int fnum)
{
char c = 1;
- BOOL can_read = (cli_read(cli, fnum, &c, 0, 1) == 1);
- BOOL can_write = (cli_write(cli, fnum, 0, &c, 0, 1) == 1);
+ BOOL can_read = (cli_read(tree, fnum, &c, 0, 1) == 1);
+ BOOL can_write = (cli_write(tree, fnum, 0, &c, 0, 1) == 1);
if ( can_read && can_write) return RDWR_RDWR;
if ( can_read && !can_write) return RDWR_RDONLY;
if (!can_read && can_write) return RDWR_WRONLY;
@@ -64,13 +64,13 @@ static const char *rdwr_string(enum rdwr_mode m)
#define CREATE_FILE do { \
fnum = create_complex_file(cli, mem_ctx, fname); \
if (fnum == -1) { \
- printf("(%d) Failed to create %s - %s\n", __LINE__, fname, cli_errstr(cli)); \
+ printf("(%d) Failed to create %s - %s\n", __LINE__, fname, cli_errstr(cli->tree)); \
ret = False; \
goto done; \
}} while (0)
#define CHECK_RDWR(fnum, correct) do { \
- enum rdwr_mode m = check_rdwr(cli, fnum); \
+ enum rdwr_mode m = check_rdwr(cli->tree, fnum); \
if (m != correct) { \
printf("(%d) Incorrect readwrite mode %s - expected %s\n", \
__LINE__, rdwr_string(m), rdwr_string(correct)); \
@@ -163,9 +163,9 @@ static BOOL test_open(struct cli_state *cli, TALLOC_CTX *mem_ctx)
CHECK_STATUS(status, NT_STATUS_OBJECT_NAME_NOT_FOUND);
fnum = io.open.out.fnum;
- cli_unlink(cli, fname);
+ cli_unlink(cli->tree, fname);
CREATE_FILE;
- cli_close(cli, fnum);
+ cli_close(cli->tree, fnum);
status = smb_raw_open(cli->tree, mem_ctx, &io);
CHECK_STATUS(status, NT_STATUS_OK);
@@ -176,8 +176,8 @@ static BOOL test_open(struct cli_state *cli, TALLOC_CTX *mem_ctx)
CHECK_STATUS(status, NT_STATUS_OK);
fnum2 = io.open.out.fnum;
CHECK_RDWR(fnum2, RDWR_RDWR);
- cli_close(cli, fnum2);
- cli_close(cli, fnum);
+ cli_close(cli->tree, fnum2);
+ cli_close(cli->tree, fnum);
/* check the read/write modes */
io.open.level = RAW_OPEN_OPEN;
@@ -189,21 +189,21 @@ static BOOL test_open(struct cli_state *cli, TALLOC_CTX *mem_ctx)
CHECK_STATUS(status, NT_STATUS_OK);
fnum = io.open.out.fnum;
CHECK_RDWR(fnum, RDWR_RDONLY);
- cli_close(cli, fnum);
+ cli_close(cli->tree, fnum);
io.open.in.flags = OPEN_FLAGS_OPEN_WRITE;
status = smb_raw_open(cli->tree, mem_ctx, &io);
CHECK_STATUS(status, NT_STATUS_OK);
fnum = io.open.out.fnum;
CHECK_RDWR(fnum, RDWR_WRONLY);
- cli_close(cli, fnum);
+ cli_close(cli->tree, fnum);
io.open.in.flags = OPEN_FLAGS_OPEN_RDWR;
status = smb_raw_open(cli->tree, mem_ctx, &io);
CHECK_STATUS(status, NT_STATUS_OK);
fnum = io.open.out.fnum;
CHECK_RDWR(fnum, RDWR_RDWR);
- cli_close(cli, fnum);
+ cli_close(cli->tree, fnum);
/* check the share modes roughly - not a complete matrix */
io.open.in.flags = OPEN_FLAGS_OPEN_RDWR | OPEN_FLAGS_DENY_WRITE;
@@ -226,8 +226,8 @@ static BOOL test_open(struct cli_state *cli, TALLOC_CTX *mem_ctx)
CHECK_STATUS(status, NT_STATUS_OK);
fnum2 = io.open.out.fnum;
CHECK_RDWR(fnum2, RDWR_RDONLY);
- cli_close(cli, fnum);
- cli_close(cli, fnum2);
+ cli_close(cli->tree, fnum);
+ cli_close(cli->tree, fnum2);
/* check the returned write time */
@@ -245,8 +245,8 @@ static BOOL test_open(struct cli_state *cli, TALLOC_CTX *mem_ctx)
CHECK_ALL_INFO(io.open.out.attrib, attrib);
done:
- cli_close(cli, fnum);
- cli_unlink(cli, fname);
+ cli_close(cli->tree, fnum);
+ cli_unlink(cli->tree, fname);
return ret;
}
@@ -284,7 +284,7 @@ static BOOL test_openx(struct cli_state *cli, TALLOC_CTX *mem_ctx)
};
printf("Checking RAW_OPEN_OPENX\n");
- cli_unlink(cli, fname);
+ cli_unlink(cli->tree, fname);
io.openx.level = RAW_OPEN_OPENX;
io.openx.in.fname = fname;
@@ -301,11 +301,11 @@ static BOOL test_openx(struct cli_state *cli, TALLOC_CTX *mem_ctx)
if (open_funcs[i].with_file) {
fnum = create_complex_file(cli, mem_ctx, fname);
if (fnum == -1) {
- d_printf("Failed to create file %s - %s\n", fname, cli_errstr(cli));
+ d_printf("Failed to create file %s - %s\n", fname, cli_errstr(cli->tree));
ret = False;
goto done;
}
- cli_close(cli, fnum);
+ cli_close(cli->tree, fnum);
}
io.openx.in.open_func = open_funcs[i].open_func;
status = smb_raw_open(cli->tree, mem_ctx, &io);
@@ -316,8 +316,8 @@ static BOOL test_openx(struct cli_state *cli, TALLOC_CTX *mem_ctx)
ret = False;
}
if (NT_STATUS_IS_OK(status) || open_funcs[i].with_file) {
- cli_close(cli, io.openx.out.fnum);
- cli_unlink(cli, fname);
+ cli_close(cli->tree, io.openx.out.fnum);
+ cli_unlink(cli->tree, fname);
}
}
@@ -336,8 +336,8 @@ static BOOL test_openx(struct cli_state *cli, TALLOC_CTX *mem_ctx)
CHECK_VAL(io.openx.out.ftype, 0);
CHECK_VAL(io.openx.out.devstate, 0);
CHECK_VAL(io.openx.out.action, OPENX_ACTION_CREATED);
- cli_close(cli, fnum);
- cli_unlink(cli, fname);
+ cli_close(cli->tree, fnum);
+ cli_unlink(cli->tree, fname);
/* check the fields when the file already existed */
fnum2 = create_complex_file(cli, mem_ctx, fname);
@@ -345,7 +345,7 @@ static BOOL test_openx(struct cli_state *cli, TALLOC_CTX *mem_ctx)
ret = False;
goto done;
}
- cli_close(cli, fnum2);
+ cli_close(cli->tree, fnum2);
io.openx.in.open_func = OPENX_OPEN_FUNC_OPEN;
status = smb_raw_open(cli->tree, mem_ctx, &io);
@@ -357,7 +357,7 @@ static BOOL test_openx(struct cli_state *cli, TALLOC_CTX *mem_ctx)
CHECK_VAL(io.openx.out.action, OPENX_ACTION_EXISTED);
CHECK_VAL(io.openx.out.unknown, 0);
CHECK_ALL_INFO(io.openx.out.attrib, attrib);
- cli_close(cli, fnum);
+ cli_close(cli->tree, fnum);
/* now check the search attrib for hidden files - win2003 ignores this? */
SET_ATTRIB(FILE_ATTRIBUTE_HIDDEN);
@@ -366,15 +366,15 @@ static BOOL test_openx(struct cli_state *cli, TALLOC_CTX *mem_ctx)
io.openx.in.search_attrs = FILE_ATTRIBUTE_HIDDEN;
status = smb_raw_open(cli->tree, mem_ctx, &io);
CHECK_STATUS(status, NT_STATUS_OK);
- cli_close(cli, io.openx.out.fnum);
+ cli_close(cli->tree, io.openx.out.fnum);
io.openx.in.search_attrs = 0;
status = smb_raw_open(cli->tree, mem_ctx, &io);
CHECK_STATUS(status, NT_STATUS_OK);
- cli_close(cli, io.openx.out.fnum);
+ cli_close(cli->tree, io.openx.out.fnum);
SET_ATTRIB(FILE_ATTRIBUTE_NORMAL);
- cli_unlink(cli, fname);
+ cli_unlink(cli->tree, fname);
/* and check attrib on create */
io.openx.in.open_func = OPENX_OPEN_FUNC_FAIL | OPENX_OPEN_FUNC_CREATE;
@@ -383,8 +383,8 @@ static BOOL test_openx(struct cli_state *cli, TALLOC_CTX *mem_ctx)
status = smb_raw_open(cli->tree, mem_ctx, &io);
CHECK_STATUS(status, NT_STATUS_OK);
CHECK_ALL_INFO(FILE_ATTRIBUTE_SYSTEM | FILE_ATTRIBUTE_ARCHIVE, attrib);
- cli_close(cli, io.openx.out.fnum);
- cli_unlink(cli, fname);
+ cli_close(cli->tree, io.openx.out.fnum);
+ cli_unlink(cli->tree, fname);
/* check timeout on create - win2003 ignores the timeout! */
io.openx.in.open_func = OPENX_OPEN_FUNC_OPEN | OPENX_OPEN_FUNC_CREATE;
@@ -404,8 +404,8 @@ static BOOL test_openx(struct cli_state *cli, TALLOC_CTX *mem_ctx)
__LINE__, (int)end_timer());
ret = False;
}
- cli_close(cli, fnum);
- cli_unlink(cli, fname);
+ cli_close(cli->tree, fnum);
+ cli_unlink(cli->tree, fname);
/* now this is a really weird one - open for execute implies create?! */
io.openx.in.fname = fname;
@@ -419,7 +419,7 @@ static BOOL test_openx(struct cli_state *cli, TALLOC_CTX *mem_ctx)
io.openx.in.timeout = 0;
status = smb_raw_open(cli->tree, mem_ctx, &io);
CHECK_STATUS(status, NT_STATUS_OK);
- cli_close(cli, io.openx.out.fnum);
+ cli_close(cli->tree, io.openx.out.fnum);
/* check the extended return flag */
io.openx.in.flags = OPENX_FLAGS_ADDITIONAL_INFO | OPENX_FLAGS_EXTENDED_RETURN;
@@ -427,11 +427,11 @@ static BOOL test_openx(struct cli_state *cli, TALLOC_CTX *mem_ctx)
status = smb_raw_open(cli->tree, mem_ctx, &io);
CHECK_STATUS(status, NT_STATUS_OK);
CHECK_VAL(io.openx.out.access_mask, STD_RIGHT_ALL_ACCESS);
- cli_close(cli, io.openx.out.fnum);
+ cli_close(cli->tree, io.openx.out.fnum);
done:
- cli_close(cli, fnum);
- cli_unlink(cli, fname);
+ cli_close(cli->tree, fnum);
+ cli_unlink(cli->tree, fname);
return ret;
}
@@ -496,11 +496,11 @@ static BOOL test_t2open(struct cli_state *cli, TALLOC_CTX *mem_ctx)
if (open_funcs[i].with_file) {
fnum = create_complex_file(cli, mem_ctx, fname);
if (fnum == -1) {
- d_printf("Failed to create file %s - %s\n", fname, cli_errstr(cli));
+ d_printf("Failed to create file %s - %s\n", fname, cli_errstr(cli->tree));
ret = False;
goto done;
}
- cli_close(cli, fnum);
+ cli_close(cli->tree, fnum);
}
io.t2open.in.open_func = open_funcs[i].open_func;
status = smb_raw_open(cli->tree, mem_ctx, &io);
@@ -511,14 +511,14 @@ static BOOL test_t2open(struct cli_state *cli, TALLOC_CTX *mem_ctx)
ret = False;
}
if (NT_STATUS_IS_OK(status) || open_funcs[i].with_file) {
- cli_close(cli, io.t2open.out.fnum);
- cli_unlink(cli, fname);
+ cli_close(cli->tree, io.t2open.out.fnum);
+ cli_unlink(cli->tree, fname);
}
}
/* check the basic return fields */
fnum = create_complex_file(cli, mem_ctx, fname);
- cli_close(cli, fnum);
+ cli_close(cli->tree, fnum);
io.t2open.in.open_func = OPENX_OPEN_FUNC_OPEN | OPENX_OPEN_FUNC_CREATE;
status = smb_raw_open(cli->tree, mem_ctx, &io);
CHECK_STATUS(status, NT_STATUS_OK);
@@ -531,7 +531,7 @@ static BOOL test_t2open(struct cli_state *cli, TALLOC_CTX *mem_ctx)
CHECK_VAL(io.t2open.out.ftype, 0);
CHECK_VAL(io.t2open.out.devstate, 0);
CHECK_VAL(io.t2open.out.action, OPENX_ACTION_EXISTED);
- cli_close(cli, fnum);
+ cli_close(cli->tree, fnum);
/* now check the search attrib for hidden files - win2003 ignores this? */
SET_ATTRIB(FILE_ATTRIBUTE_HIDDEN);
@@ -539,14 +539,14 @@ static BOOL test_t2open(struct cli_state *cli, TALLOC_CTX *mem_ctx)
status = smb_raw_open(cli->tree, mem_ctx, &io);
CHECK_STATUS(status, NT_STATUS_OK);
- cli_close(cli, io.t2open.out.fnum);
+ cli_close(cli->tree, io.t2open.out.fnum);
status = smb_raw_open(cli->tree, mem_ctx, &io);
CHECK_STATUS(status, NT_STATUS_OK);
- cli_close(cli, io.t2open.out.fnum);
+ cli_close(cli->tree, io.t2open.out.fnum);
SET_ATTRIB(FILE_ATTRIBUTE_NORMAL);
- cli_unlink(cli, fname);
+ cli_unlink(cli->tree, fname);
/* and check attrib on create */
io.t2open.in.open_func = OPENX_OPEN_FUNC_FAIL | OPENX_OPEN_FUNC_CREATE;
@@ -562,8 +562,8 @@ static BOOL test_t2open(struct cli_state *cli, TALLOC_CTX *mem_ctx)
CHECK_STATUS(status, NT_STATUS_ACCESS_DENIED);
done:
- cli_close(cli, fnum);
- cli_unlink(cli, fname);
+ cli_close(cli->tree, fnum);
+ cli_unlink(cli->tree, fname);
return ret;
}
@@ -622,13 +622,13 @@ static BOOL test_ntcreatex(struct cli_state *cli, TALLOC_CTX *mem_ctx)
/* test the open disposition */
for (i=0; i<ARRAY_SIZE(open_funcs); i++) {
if (open_funcs[i].with_file) {
- fnum = cli_open(cli, fname, O_CREAT|O_RDWR|O_TRUNC, DENY_NONE);
+ fnum = cli_open(cli->tree, fname, O_CREAT|O_RDWR|O_TRUNC, DENY_NONE);
if (fnum == -1) {
- d_printf("Failed to create file %s - %s\n", fname, cli_errstr(cli));
+ d_printf("Failed to create file %s - %s\n", fname, cli_errstr(cli->tree));
ret = False;
goto done;
}
- cli_close(cli, fnum);
+ cli_close(cli->tree, fnum);
}
io.ntcreatex.in.open_disposition = open_funcs[i].open_disp;
status = smb_raw_open(cli->tree, mem_ctx, &io);
@@ -639,8 +639,8 @@ static BOOL test_ntcreatex(struct cli_state *cli, TALLOC_CTX *mem_ctx)
ret = False;
}
if (NT_STATUS_IS_OK(status) || open_funcs[i].with_file) {
- cli_close(cli, io.ntcreatex.out.fnum);
- cli_unlink(cli, fname);
+ cli_close(cli->tree, io.ntcreatex.out.fnum);
+ cli_unlink(cli->tree, fname);
}
}
@@ -664,14 +664,14 @@ static BOOL test_ntcreatex(struct cli_state *cli, TALLOC_CTX *mem_ctx)
CHECK_VAL(io.ntcreatex.out.file_type, FILE_TYPE_DISK);
/* check fields when the file already existed */
- cli_close(cli, fnum);
- cli_unlink(cli, fname);
+ cli_close(cli->tree, fnum);
+ cli_unlink(cli->tree, fname);
fnum = create_complex_file(cli, mem_ctx, fname);
if (fnum == -1) {
ret = False;
goto done;
}
- cli_close(cli, fnum);
+ cli_close(cli->tree, fnum);
io.ntcreatex.in.open_disposition = NTCREATEX_DISP_OPEN;
status = smb_raw_open(cli->tree, mem_ctx, &io);
@@ -689,8 +689,8 @@ static BOOL test_ntcreatex(struct cli_state *cli, TALLOC_CTX *mem_ctx)
CHECK_ALL_INFO(io.ntcreatex.out.size, size);
CHECK_ALL_INFO(io.ntcreatex.out.is_directory, directory);
CHECK_VAL(io.ntcreatex.out.file_type, FILE_TYPE_DISK);
- cli_close(cli, fnum);
- cli_unlink(cli, fname);
+ cli_close(cli->tree, fnum);
+ cli_unlink(cli->tree, fname);
/* create a directory */
@@ -704,8 +704,8 @@ static BOOL test_ntcreatex(struct cli_state *cli, TALLOC_CTX *mem_ctx)
io.ntcreatex.in.fname = dname;
fname = dname;
- cli_rmdir(cli, fname);
- cli_unlink(cli, fname);
+ cli_rmdir(cli->tree, fname);
+ cli_unlink(cli->tree, fname);
io.ntcreatex.in.access_mask = SEC_RIGHT_MAXIMUM_ALLOWED;
io.ntcreatex.in.create_options = NTCREATEX_OPTIONS_DIRECTORY;
@@ -730,12 +730,12 @@ static BOOL test_ntcreatex(struct cli_state *cli, TALLOC_CTX *mem_ctx)
CHECK_VAL(io.ntcreatex.out.size, 0);
CHECK_VAL(io.ntcreatex.out.alloc_size, 0);
CHECK_VAL(io.ntcreatex.out.file_type, FILE_TYPE_DISK);
- cli_unlink(cli, fname);
+ cli_unlink(cli->tree, fname);
done:
- cli_close(cli, fnum);
- cli_unlink(cli, fname);
+ cli_close(cli->tree, fnum);
+ cli_unlink(cli->tree, fname);
return ret;
}
@@ -767,8 +767,8 @@ static BOOL test_mknew(struct cli_state *cli, TALLOC_CTX *mem_ctx)
status = smb_raw_open(cli->tree, mem_ctx, &io);
CHECK_STATUS(status, NT_STATUS_OBJECT_NAME_COLLISION);
- cli_close(cli, fnum);
- cli_unlink(cli, fname);
+ cli_close(cli->tree, fnum);
+ cli_unlink(cli->tree, fname);
/* make sure write_time works */
io.mknew.in.write_time = basetime;
@@ -777,8 +777,8 @@ static BOOL test_mknew(struct cli_state *cli, TALLOC_CTX *mem_ctx)
fnum = io.mknew.out.fnum;
CHECK_TIME(basetime, write_time);
- cli_close(cli, fnum);
- cli_unlink(cli, fname);
+ cli_close(cli->tree, fnum);
+ cli_unlink(cli->tree, fname);
/* make sure file_attrs works */
io.mknew.in.attrib = FILE_ATTRIBUTE_HIDDEN;
@@ -788,8 +788,8 @@ static BOOL test_mknew(struct cli_state *cli, TALLOC_CTX *mem_ctx)
CHECK_ALL_INFO(FILE_ATTRIBUTE_HIDDEN | FILE_ATTRIBUTE_ARCHIVE, attrib);
done:
- cli_close(cli, fnum);
- cli_unlink(cli, fname);
+ cli_close(cli->tree, fnum);
+ cli_unlink(cli->tree, fname);
return ret;
}
@@ -821,9 +821,9 @@ static BOOL test_create(struct cli_state *cli, TALLOC_CTX *mem_ctx)
status = smb_raw_open(cli->tree, mem_ctx, &io);
CHECK_STATUS(status, NT_STATUS_OK);
- cli_close(cli, io.create.out.fnum);
- cli_close(cli, fnum);
- cli_unlink(cli, fname);
+ cli_close(cli->tree, io.create.out.fnum);
+ cli_close(cli->tree, fnum);
+ cli_unlink(cli->tree, fname);
/* make sure write_time works */
io.create.in.write_time = basetime;
@@ -832,8 +832,8 @@ static BOOL test_create(struct cli_state *cli, TALLOC_CTX *mem_ctx)
fnum = io.create.out.fnum;
CHECK_TIME(basetime, write_time);
- cli_close(cli, fnum);
- cli_unlink(cli, fname);
+ cli_close(cli->tree, fnum);
+ cli_unlink(cli->tree, fname);
/* make sure file_attrs works */
io.create.in.attrib = FILE_ATTRIBUTE_HIDDEN;
@@ -843,8 +843,8 @@ static BOOL test_create(struct cli_state *cli, TALLOC_CTX *mem_ctx)
CHECK_ALL_INFO(FILE_ATTRIBUTE_HIDDEN | FILE_ATTRIBUTE_ARCHIVE, attrib);
done:
- cli_close(cli, fnum);
- cli_unlink(cli, fname);
+ cli_close(cli->tree, fnum);
+ cli_unlink(cli->tree, fname);
return ret;
}
@@ -886,9 +886,9 @@ static BOOL test_ctemp(struct cli_state *cli, TALLOC_CTX *mem_ctx)
CHECK_TIME(basetime, write_time);
done:
- cli_close(cli, fnum);
+ cli_close(cli->tree, fnum);
if (fname) {
- cli_unlink(cli, fname);
+ cli_unlink(cli->tree, fname);
}
return ret;
@@ -908,12 +908,12 @@ BOOL torture_raw_open(int dummy)
mem_ctx = talloc_init("torture_raw_open");
- if (cli_deltree(cli, BASEDIR) == -1) {
+ if (cli_deltree(cli->tree, BASEDIR) == -1) {
printf("Failed to clean " BASEDIR "\n");
return False;
}
- if (!cli_mkdir(cli, BASEDIR)) {
- printf("Failed to create " BASEDIR " - %s\n", cli_errstr(cli));
+ if (!cli_mkdir(cli->tree, BASEDIR)) {
+ printf("Failed to create " BASEDIR " - %s\n", cli_errstr(cli->tree));
return False;
}
@@ -946,7 +946,7 @@ BOOL torture_raw_open(int dummy)
}
smb_raw_exit(cli->session);
- cli_deltree(cli, BASEDIR);
+ cli_deltree(cli->tree, BASEDIR);
torture_close_connection(cli);
talloc_destroy(mem_ctx);
diff --git a/source4/torture/raw/oplock.c b/source4/torture/raw/oplock.c
index 888fcbdc13..dc8c883f76 100644
--- a/source4/torture/raw/oplock.c
+++ b/source4/torture/raw/oplock.c
@@ -98,7 +98,7 @@ static BOOL test_oplock(struct cli_state *cli, TALLOC_CTX *mem_ctx)
uint16 fnum, fnum2;
/* cleanup */
- cli_unlink(cli, fname);
+ cli_unlink(cli->tree, fname);
cli_oplock_handler(cli->transport, oplock_handler_ack, cli->tree);
@@ -133,7 +133,7 @@ static BOOL test_oplock(struct cli_state *cli, TALLOC_CTX *mem_ctx)
CHECK_STATUS(status, NT_STATUS_SHARING_VIOLATION);
CHECK_VAL(break_info.count, 0);
- cli_close(cli, fnum);
+ cli_close(cli->tree, fnum);
/*
with a batch oplock we get a break
@@ -159,7 +159,7 @@ static BOOL test_oplock(struct cli_state *cli, TALLOC_CTX *mem_ctx)
CHECK_VAL(break_info.count, 1);
- cli_close(cli, fnum);
+ cli_close(cli->tree, fnum);
printf("if we close on break then the unlink can succeed\n");
ZERO_STRUCT(break_info);
@@ -184,7 +184,7 @@ static BOOL test_oplock(struct cli_state *cli, TALLOC_CTX *mem_ctx)
printf("a self read should not cause a break\n");
ZERO_STRUCT(break_info);
- cli_close(cli, fnum);
+ cli_close(cli->tree, fnum);
cli_oplock_handler(cli->transport, oplock_handler_ack, cli->tree);
io.ntcreatex.in.flags = NTCREATEX_FLAGS_EXTENDED |
@@ -207,7 +207,7 @@ static BOOL test_oplock(struct cli_state *cli, TALLOC_CTX *mem_ctx)
printf("a 2nd open should give a break\n");
ZERO_STRUCT(break_info);
- cli_close(cli, fnum);
+ cli_close(cli->tree, fnum);
cli_oplock_handler(cli->transport, oplock_handler_ack, cli->tree);
io.ntcreatex.in.flags = NTCREATEX_FLAGS_EXTENDED |
@@ -230,7 +230,7 @@ static BOOL test_oplock(struct cli_state *cli, TALLOC_CTX *mem_ctx)
printf("a 2nd open should get an oplock when we close instead of ack\n");
ZERO_STRUCT(break_info);
- cli_close(cli, fnum);
+ cli_close(cli->tree, fnum);
cli_oplock_handler(cli->transport, oplock_handler_close, cli->tree);
io.ntcreatex.in.flags = NTCREATEX_FLAGS_EXTENDED |
@@ -257,8 +257,8 @@ static BOOL test_oplock(struct cli_state *cli, TALLOC_CTX *mem_ctx)
done:
- cli_close(cli, fnum);
- cli_unlink(cli, fname);
+ cli_close(cli->tree, fnum);
+ cli_unlink(cli->tree, fname);
return ret;
}
diff --git a/source4/torture/raw/qfileinfo.c b/source4/torture/raw/qfileinfo.c
index 881916c2f7..15e358673d 100644
--- a/source4/torture/raw/qfileinfo.c
+++ b/source4/torture/raw/qfileinfo.c
@@ -171,7 +171,7 @@ BOOL torture_raw_qfileinfo(int dummy)
fnum = create_complex_file(cli, mem_ctx, fname);
if (fnum == -1) {
- printf("ERROR: open of %s failed (%s)\n", fname, cli_errstr(cli));
+ printf("ERROR: open of %s failed (%s)\n", fname, cli_errstr(cli->tree));
ret = False;
goto done;
}
@@ -552,8 +552,8 @@ BOOL torture_raw_qfileinfo(int dummy)
NAME_CHECK("ALT_NAME_INFORMATION", alt_name_info, fname, STR_UNICODE);
/* and make sure we can open by alternate name */
- cli_close(cli, fnum);
- fnum = cli_nt_create_full(cli, correct_name, 0, GENERIC_RIGHTS_FILE_ALL_ACCESS,
+ cli_close(cli->tree, fnum);
+ fnum = cli_nt_create_full(cli->tree, correct_name, 0, GENERIC_RIGHTS_FILE_ALL_ACCESS,
FILE_ATTRIBUTE_NORMAL,
NTCREATEX_SHARE_ACCESS_DELETE|
NTCREATEX_SHARE_ACCESS_READ|
@@ -561,7 +561,7 @@ BOOL torture_raw_qfileinfo(int dummy)
NTCREATEX_DISP_OVERWRITE_IF,
0, 0);
if (fnum == -1) {
- printf("Unable to open by alt_name - %s\n", cli_errstr(cli));
+ printf("Unable to open by alt_name - %s\n", cli_errstr(cli->tree));
ret = False;
}
@@ -704,8 +704,8 @@ BOOL torture_raw_qfileinfo(int dummy)
done:
- cli_close(cli, fnum);
- cli_unlink(cli, fname);
+ cli_close(cli->tree, fnum);
+ cli_unlink(cli->tree, fname);
torture_close_connection(cli);
talloc_destroy(mem_ctx);
diff --git a/source4/torture/raw/read.c b/source4/torture/raw/read.c
index e0432651dc..0836b4d021 100644
--- a/source4/torture/raw/read.c
+++ b/source4/torture/raw/read.c
@@ -90,18 +90,18 @@ static BOOL test_read(struct cli_state *cli, TALLOC_CTX *mem_ctx)
buf = talloc_zero(mem_ctx, maxsize);
- if (cli_deltree(cli, BASEDIR) == -1 ||
- !cli_mkdir(cli, BASEDIR)) {
- printf("Unable to setup %s - %s\n", BASEDIR, cli_errstr(cli));
+ if (cli_deltree(cli->tree, BASEDIR) == -1 ||
+ !cli_mkdir(cli->tree, BASEDIR)) {
+ printf("Unable to setup %s - %s\n", BASEDIR, cli_errstr(cli->tree));
return False;
}
printf("Testing RAW_READ_READ\n");
io.generic.level = RAW_READ_READ;
- fnum = cli_open(cli, fname, O_RDWR|O_CREAT, DENY_NONE);
+ fnum = cli_open(cli->tree, fname, O_RDWR|O_CREAT, DENY_NONE);
if (fnum == -1) {
- printf("Failed to create %s - %s\n", fname, cli_errstr(cli));
+ printf("Failed to create %s - %s\n", fname, cli_errstr(cli->tree));
ret = False;
goto done;
}
@@ -129,7 +129,7 @@ static BOOL test_read(struct cli_state *cli, TALLOC_CTX *mem_ctx)
CHECK_STATUS(status, NT_STATUS_INVALID_HANDLE);
io.read.in.fnum = fnum;
- cli_write(cli, fnum, 0, test_data, 0, strlen(test_data));
+ cli_write(cli->tree, fnum, 0, test_data, 0, strlen(test_data));
printf("Trying small read\n");
io.read.in.fnum = fnum;
@@ -165,7 +165,7 @@ static BOOL test_read(struct cli_state *cli, TALLOC_CTX *mem_ctx)
CHECK_VALUE(io.read.out.nread, 0);
setup_buffer(buf, seed, maxsize);
- cli_write(cli, fnum, 0, buf, 0, maxsize);
+ cli_write(cli->tree, fnum, 0, buf, 0, maxsize);
memset(buf, 0, maxsize);
printf("Trying large read\n");
@@ -178,7 +178,7 @@ static BOOL test_read(struct cli_state *cli, TALLOC_CTX *mem_ctx)
printf("Trying locked region\n");
cli->session->pid++;
- if (!cli_lock(cli, fnum, 103, 1, 0, WRITE_LOCK)) {
+ if (!cli_lock(cli->tree, fnum, 103, 1, 0, WRITE_LOCK)) {
printf("Failed to lock file at %d\n", __LINE__);
ret = False;
goto done;
@@ -192,9 +192,9 @@ static BOOL test_read(struct cli_state *cli, TALLOC_CTX *mem_ctx)
done:
- cli_close(cli, fnum);
+ cli_close(cli->tree, fnum);
smb_raw_exit(cli->session);
- cli_deltree(cli, BASEDIR);
+ cli_deltree(cli->tree, BASEDIR);
return ret;
}
@@ -216,18 +216,18 @@ static BOOL test_lockread(struct cli_state *cli, TALLOC_CTX *mem_ctx)
buf = talloc_zero(mem_ctx, maxsize);
- if (cli_deltree(cli, BASEDIR) == -1 ||
- !cli_mkdir(cli, BASEDIR)) {
- printf("Unable to setup %s - %s\n", BASEDIR, cli_errstr(cli));
+ if (cli_deltree(cli->tree, BASEDIR) == -1 ||
+ !cli_mkdir(cli->tree, BASEDIR)) {
+ printf("Unable to setup %s - %s\n", BASEDIR, cli_errstr(cli->tree));
return False;
}
printf("Testing RAW_READ_LOCKREAD\n");
io.generic.level = RAW_READ_LOCKREAD;
- fnum = cli_open(cli, fname, O_RDWR|O_CREAT, DENY_NONE);
+ fnum = cli_open(cli->tree, fname, O_RDWR|O_CREAT, DENY_NONE);
if (fnum == -1) {
- printf("Failed to create %s - %s\n", fname, cli_errstr(cli));
+ printf("Failed to create %s - %s\n", fname, cli_errstr(cli->tree));
ret = False;
goto done;
}
@@ -260,7 +260,7 @@ static BOOL test_lockread(struct cli_state *cli, TALLOC_CTX *mem_ctx)
CHECK_STATUS(status, NT_STATUS_INVALID_HANDLE);
io.lockread.in.fnum = fnum;
- cli_write(cli, fnum, 0, test_data, 0, strlen(test_data));
+ cli_write(cli->tree, fnum, 0, test_data, 0, strlen(test_data));
printf("Trying small read\n");
io.lockread.in.fnum = fnum;
@@ -270,7 +270,7 @@ static BOOL test_lockread(struct cli_state *cli, TALLOC_CTX *mem_ctx)
status = smb_raw_read(cli->tree, &io);
CHECK_STATUS(status, NT_STATUS_FILE_LOCK_CONFLICT);
- cli_unlock(cli, fnum, 0, 1);
+ cli_unlock(cli->tree, fnum, 0, 1);
status = smb_raw_read(cli->tree, &io);
CHECK_STATUS(status, NT_STATUS_OK);
@@ -286,7 +286,7 @@ static BOOL test_lockread(struct cli_state *cli, TALLOC_CTX *mem_ctx)
io.lockread.in.count = strlen(test_data);
status = smb_raw_read(cli->tree, &io);
CHECK_STATUS(status, NT_STATUS_LOCK_NOT_GRANTED);
- cli_unlock(cli, fnum, 0, strlen(test_data));
+ cli_unlock(cli->tree, fnum, 0, strlen(test_data));
status = smb_raw_read(cli->tree, &io);
CHECK_STATUS(status, NT_STATUS_OK);
@@ -305,7 +305,7 @@ static BOOL test_lockread(struct cli_state *cli, TALLOC_CTX *mem_ctx)
CHECK_VALUE(io.lockread.out.nread, 0);
setup_buffer(buf, seed, maxsize);
- cli_write(cli, fnum, 0, buf, 0, maxsize);
+ cli_write(cli->tree, fnum, 0, buf, 0, maxsize);
memset(buf, 0, maxsize);
printf("Trying large read\n");
@@ -313,16 +313,16 @@ static BOOL test_lockread(struct cli_state *cli, TALLOC_CTX *mem_ctx)
io.lockread.in.count = ~0;
status = smb_raw_read(cli->tree, &io);
CHECK_STATUS(status, NT_STATUS_LOCK_NOT_GRANTED);
- cli_unlock(cli, fnum, 1, strlen(test_data));
+ cli_unlock(cli->tree, fnum, 1, strlen(test_data));
status = smb_raw_read(cli->tree, &io);
CHECK_STATUS(status, NT_STATUS_OK);
CHECK_BUFFER(buf, seed, io.lockread.out.nread);
- cli_unlock(cli, fnum, 0, 0xFFFF);
+ cli_unlock(cli->tree, fnum, 0, 0xFFFF);
printf("Trying locked region\n");
cli->session->pid++;
- if (!cli_lock(cli, fnum, 103, 1, 0, WRITE_LOCK)) {
+ if (!cli_lock(cli->tree, fnum, 103, 1, 0, WRITE_LOCK)) {
printf("Failed to lock file at %d\n", __LINE__);
ret = False;
goto done;
@@ -336,8 +336,8 @@ static BOOL test_lockread(struct cli_state *cli, TALLOC_CTX *mem_ctx)
done:
- cli_close(cli, fnum);
- cli_deltree(cli, BASEDIR);
+ cli_close(cli->tree, fnum);
+ cli_deltree(cli->tree, BASEDIR);
return ret;
}
@@ -359,17 +359,17 @@ static BOOL test_readx(struct cli_state *cli, TALLOC_CTX *mem_ctx)
buf = talloc_zero(mem_ctx, maxsize);
- if (cli_deltree(cli, BASEDIR) == -1 ||
- !cli_mkdir(cli, BASEDIR)) {
- printf("Unable to setup %s - %s\n", BASEDIR, cli_errstr(cli));
+ if (cli_deltree(cli->tree, BASEDIR) == -1 ||
+ !cli_mkdir(cli->tree, BASEDIR)) {
+ printf("Unable to setup %s - %s\n", BASEDIR, cli_errstr(cli->tree));
return False;
}
printf("Testing RAW_READ_READX\n");
- fnum = cli_open(cli, fname, O_RDWR|O_CREAT, DENY_NONE);
+ fnum = cli_open(cli->tree, fname, O_RDWR|O_CREAT, DENY_NONE);
if (fnum == -1) {
- printf("Failed to create %s - %s\n", fname, cli_errstr(cli));
+ printf("Failed to create %s - %s\n", fname, cli_errstr(cli->tree));
ret = False;
goto done;
}
@@ -404,7 +404,7 @@ static BOOL test_readx(struct cli_state *cli, TALLOC_CTX *mem_ctx)
CHECK_STATUS(status, NT_STATUS_INVALID_HANDLE);
io.readx.in.fnum = fnum;
- cli_write(cli, fnum, 0, test_data, 0, strlen(test_data));
+ cli_write(cli->tree, fnum, 0, test_data, 0, strlen(test_data));
printf("Trying small read\n");
io.readx.in.fnum = fnum;
@@ -449,7 +449,7 @@ static BOOL test_readx(struct cli_state *cli, TALLOC_CTX *mem_ctx)
CHECK_VALUE(io.readx.out.compaction_mode, 0);
setup_buffer(buf, seed, maxsize);
- cli_write(cli, fnum, 0, buf, 0, maxsize);
+ cli_write(cli->tree, fnum, 0, buf, 0, maxsize);
memset(buf, 0, maxsize);
printf("Trying large read\n");
@@ -489,7 +489,7 @@ static BOOL test_readx(struct cli_state *cli, TALLOC_CTX *mem_ctx)
printf("Trying locked region\n");
cli->session->pid++;
- if (!cli_lock(cli, fnum, 103, 1, 0, WRITE_LOCK)) {
+ if (!cli_lock(cli->tree, fnum, 103, 1, 0, WRITE_LOCK)) {
printf("Failed to lock file at %d\n", __LINE__);
ret = False;
goto done;
@@ -511,7 +511,7 @@ static BOOL test_readx(struct cli_state *cli, TALLOC_CTX *mem_ctx)
CHECK_STATUS(status, NT_STATUS_OK);
CHECK_VALUE(io.readx.out.nread, 0);
- if (!cli_lock64(cli, fnum, io.readx.in.offset, 1, 0, WRITE_LOCK)) {
+ if (!cli_lock64(cli->tree, fnum, io.readx.in.offset, 1, 0, WRITE_LOCK)) {
printf("Failed to lock file at %d\n", __LINE__);
ret = False;
goto done;
@@ -523,8 +523,8 @@ static BOOL test_readx(struct cli_state *cli, TALLOC_CTX *mem_ctx)
#endif
done:
- cli_close(cli, fnum);
- cli_deltree(cli, BASEDIR);
+ cli_close(cli->tree, fnum);
+ cli_deltree(cli->tree, BASEDIR);
return ret;
}
@@ -546,17 +546,17 @@ static BOOL test_readbraw(struct cli_state *cli, TALLOC_CTX *mem_ctx)
buf = talloc_zero(mem_ctx, maxsize);
- if (cli_deltree(cli, BASEDIR) == -1 ||
- !cli_mkdir(cli, BASEDIR)) {
- printf("Unable to setup %s - %s\n", BASEDIR, cli_errstr(cli));
+ if (cli_deltree(cli->tree, BASEDIR) == -1 ||
+ !cli_mkdir(cli->tree, BASEDIR)) {
+ printf("Unable to setup %s - %s\n", BASEDIR, cli_errstr(cli->tree));
return False;
}
printf("Testing RAW_READ_READBRAW\n");
- fnum = cli_open(cli, fname, O_RDWR|O_CREAT, DENY_NONE);
+ fnum = cli_open(cli->tree, fname, O_RDWR|O_CREAT, DENY_NONE);
if (fnum == -1) {
- printf("Failed to create %s - %s\n", fname, cli_errstr(cli));
+ printf("Failed to create %s - %s\n", fname, cli_errstr(cli->tree));
ret = False;
goto done;
}
@@ -588,7 +588,7 @@ static BOOL test_readbraw(struct cli_state *cli, TALLOC_CTX *mem_ctx)
CHECK_VALUE(io.readbraw.out.nread, 0);
io.readbraw.in.fnum = fnum;
- cli_write(cli, fnum, 0, test_data, 0, strlen(test_data));
+ cli_write(cli->tree, fnum, 0, test_data, 0, strlen(test_data));
printf("Trying small read\n");
io.readbraw.in.fnum = fnum;
@@ -626,7 +626,7 @@ static BOOL test_readbraw(struct cli_state *cli, TALLOC_CTX *mem_ctx)
CHECK_VALUE(io.readbraw.out.nread, 0);
setup_buffer(buf, seed, maxsize);
- cli_write(cli, fnum, 0, buf, 0, maxsize);
+ cli_write(cli->tree, fnum, 0, buf, 0, maxsize);
memset(buf, 0, maxsize);
printf("Trying large read\n");
@@ -660,7 +660,7 @@ static BOOL test_readbraw(struct cli_state *cli, TALLOC_CTX *mem_ctx)
printf("Trying locked region\n");
cli->session->pid++;
- if (!cli_lock(cli, fnum, 103, 1, 0, WRITE_LOCK)) {
+ if (!cli_lock(cli->tree, fnum, 103, 1, 0, WRITE_LOCK)) {
printf("Failed to lock file at %d\n", __LINE__);
ret = False;
goto done;
@@ -696,8 +696,8 @@ static BOOL test_readbraw(struct cli_state *cli, TALLOC_CTX *mem_ctx)
#endif
done:
- cli_close(cli, fnum);
- cli_deltree(cli, BASEDIR);
+ cli_close(cli->tree, fnum);
+ cli_deltree(cli->tree, BASEDIR);
return ret;
}
diff --git a/source4/torture/raw/rename.c b/source4/torture/raw/rename.c
index b997c2f310..d2f922cdfd 100644
--- a/source4/torture/raw/rename.c
+++ b/source4/torture/raw/rename.c
@@ -51,9 +51,9 @@ static BOOL test_mv(struct cli_state *cli, TALLOC_CTX *mem_ctx)
printf("Testing SMBmv\n");
- if (cli_deltree(cli, BASEDIR) == -1 ||
- !cli_mkdir(cli, BASEDIR)) {
- printf("Unable to setup %s - %s\n", BASEDIR, cli_errstr(cli));
+ if (cli_deltree(cli->tree, BASEDIR) == -1 ||
+ !cli_mkdir(cli->tree, BASEDIR)) {
+ printf("Unable to setup %s - %s\n", BASEDIR, cli_errstr(cli->tree));
return False;
}
@@ -118,9 +118,9 @@ static BOOL test_mv(struct cli_state *cli, TALLOC_CTX *mem_ctx)
CHECK_STATUS(status, NT_STATUS_OK);
done:
- cli_close(cli, fnum);
+ cli_close(cli->tree, fnum);
smb_raw_exit(cli->session);
- cli_deltree(cli, BASEDIR);
+ cli_deltree(cli->tree, BASEDIR);
return ret;
}
@@ -141,9 +141,9 @@ static BOOL test_ntrename(struct cli_state *cli, TALLOC_CTX *mem_ctx)
printf("Testing SMBntrename\n");
- if (cli_deltree(cli, BASEDIR) == -1 ||
- !cli_mkdir(cli, BASEDIR)) {
- printf("Unable to setup %s - %s\n", BASEDIR, cli_errstr(cli));
+ if (cli_deltree(cli->tree, BASEDIR) == -1 ||
+ !cli_mkdir(cli->tree, BASEDIR)) {
+ printf("Unable to setup %s - %s\n", BASEDIR, cli_errstr(cli->tree));
return False;
}
@@ -222,7 +222,7 @@ static BOOL test_ntrename(struct cli_state *cli, TALLOC_CTX *mem_ctx)
torture_set_file_attribute(cli->tree, fname1, FILE_ATTRIBUTE_NORMAL);
- cli_unlink(cli, fname2);
+ cli_unlink(cli->tree, fname2);
finfo.generic.in.fname = fname1;
status = smb_raw_pathinfo(cli->tree, mem_ctx, &finfo);
@@ -254,7 +254,7 @@ static BOOL test_ntrename(struct cli_state *cli, TALLOC_CTX *mem_ctx)
torture_set_file_attribute(cli->tree, fname1, FILE_ATTRIBUTE_NORMAL);
- cli_unlink(cli, fname2);
+ cli_unlink(cli->tree, fname2);
finfo.generic.in.fname = fname1;
status = smb_raw_pathinfo(cli->tree, mem_ctx, &finfo);
@@ -303,15 +303,15 @@ static BOOL test_ntrename(struct cli_state *cli, TALLOC_CTX *mem_ctx)
#if 0
{
char buf[16384];
- fnum = cli_open(cli, fname1, O_RDWR, DENY_NONE);
+ fnum = cli_open(cli->tree, fname1, O_RDWR, DENY_NONE);
memset(buf, 1, sizeof(buf));
- cli_write(cli, fnum, 0, buf, 0, sizeof(buf));
- cli_close(cli, fnum);
+ cli_write(cli->tree, fnum, 0, buf, 0, sizeof(buf));
+ cli_close(cli->tree, fnum);
- fnum = cli_open(cli, fname2, O_RDWR, DENY_NONE);
+ fnum = cli_open(cli->tree, fname2, O_RDWR, DENY_NONE);
memset(buf, 1, sizeof(buf));
- cli_write(cli, fnum, 0, buf, 0, sizeof(buf)-1);
- cli_close(cli, fnum);
+ cli_write(cli->tree, fnum, 0, buf, 0, sizeof(buf)-1);
+ cli_close(cli->tree, fnum);
torture_all_info(cli->tree, fname1);
torture_all_info(cli->tree, fname2);
@@ -353,7 +353,7 @@ static BOOL test_ntrename(struct cli_state *cli, TALLOC_CTX *mem_ctx)
done:
smb_raw_exit(cli->session);
- cli_deltree(cli, BASEDIR);
+ cli_deltree(cli->tree, BASEDIR);
return ret;
}
diff --git a/source4/torture/raw/search.c b/source4/torture/raw/search.c
index 301a9f0077..164c9bb4d8 100644
--- a/source4/torture/raw/search.c
+++ b/source4/torture/raw/search.c
@@ -116,7 +116,7 @@ static BOOL test_one_file(struct cli_state *cli, TALLOC_CTX *mem_ctx)
fnum = create_complex_file(cli, mem_ctx, fname);
if (fnum == -1) {
- printf("ERROR: open of %s failed (%s)\n", fname, cli_errstr(cli));
+ printf("ERROR: open of %s failed (%s)\n", fname, cli_errstr(cli->tree));
ret = False;
goto done;
}
@@ -338,7 +338,7 @@ static BOOL test_one_file(struct cli_state *cli, TALLOC_CTX *mem_ctx)
done:
smb_raw_exit(cli->session);
- cli_unlink(cli, fname);
+ cli_unlink(cli->tree, fname);
return ret;
}
@@ -550,9 +550,9 @@ static BOOL test_many_files(struct cli_state *cli, TALLOC_CTX *mem_ctx)
{"SEARCH", "ID", RAW_SEARCH_SEARCH, CONT_RESUME_KEY}
};
- if (cli_deltree(cli, BASEDIR) == -1 ||
- !cli_mkdir(cli, BASEDIR)) {
- printf("Failed to create " BASEDIR " - %s\n", cli_errstr(cli));
+ if (cli_deltree(cli->tree, BASEDIR) == -1 ||
+ !cli_mkdir(cli->tree, BASEDIR)) {
+ printf("Failed to create " BASEDIR " - %s\n", cli_errstr(cli->tree));
return False;
}
@@ -560,14 +560,14 @@ static BOOL test_many_files(struct cli_state *cli, TALLOC_CTX *mem_ctx)
for (i=0;i<num_files;i++) {
asprintf(&fname, BASEDIR "\\t%03d-%d.txt", i, i);
- fnum = cli_open(cli, fname, O_CREAT|O_RDWR, DENY_NONE);
+ fnum = cli_open(cli->tree, fname, O_CREAT|O_RDWR, DENY_NONE);
if (fnum == -1) {
- printf("Failed to create %s - %s\n", fname, cli_errstr(cli));
+ printf("Failed to create %s - %s\n", fname, cli_errstr(cli->tree));
ret = False;
goto done;
}
free(fname);
- cli_close(cli, fnum);
+ cli_close(cli->tree, fnum);
}
@@ -627,7 +627,7 @@ static BOOL test_many_files(struct cli_state *cli, TALLOC_CTX *mem_ctx)
done:
smb_raw_exit(cli->session);
- cli_deltree(cli, BASEDIR);
+ cli_deltree(cli->tree, BASEDIR);
return ret;
}
diff --git a/source4/torture/raw/seek.c b/source4/torture/raw/seek.c
index 85ca9f2869..fa95156969 100644
--- a/source4/torture/raw/seek.c
+++ b/source4/torture/raw/seek.c
@@ -52,15 +52,15 @@ static BOOL test_seek(struct cli_state *cli, TALLOC_CTX *mem_ctx)
const char *fname = BASEDIR "\\test.txt";
char c[2];
- if (cli_deltree(cli, BASEDIR) == -1 ||
- !cli_mkdir(cli, BASEDIR)) {
- printf("Unable to setup %s - %s\n", BASEDIR, cli_errstr(cli));
+ if (cli_deltree(cli->tree, BASEDIR) == -1 ||
+ !cli_mkdir(cli->tree, BASEDIR)) {
+ printf("Unable to setup %s - %s\n", BASEDIR, cli_errstr(cli->tree));
return False;
}
- fnum = cli_open(cli, fname, O_RDWR|O_CREAT|O_TRUNC, DENY_NONE);
+ fnum = cli_open(cli->tree, fname, O_RDWR|O_CREAT|O_TRUNC, DENY_NONE);
if (fnum == -1) {
- printf("Failed to open test.txt - %s\n", cli_errstr(cli));
+ printf("Failed to open test.txt - %s\n", cli_errstr(cli->tree));
ret = False;
goto done;
}
@@ -138,8 +138,8 @@ static BOOL test_seek(struct cli_state *cli, TALLOC_CTX *mem_ctx)
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));
+ if (cli_write(cli->tree, fnum, 0, c, 0, 2) != 2) {
+ printf("Write failed - %s\n", cli_errstr(cli->tree));
ret = False;
goto done;
}
@@ -158,8 +158,8 @@ static BOOL test_seek(struct cli_state *cli, TALLOC_CTX *mem_ctx)
CHECK_STATUS(status, NT_STATUS_OK);
CHECK_VALUE(io.out.offset, 2);
- if (cli_read(cli, fnum, c, 0, 1) != 1) {
- printf("Read failed - %s\n", cli_errstr(cli));
+ if (cli_read(cli->tree, fnum, c, 0, 1) != 1) {
+ printf("Read failed - %s\n", cli_errstr(cli->tree));
ret = False;
goto done;
}
@@ -176,9 +176,9 @@ static BOOL test_seek(struct cli_state *cli, TALLOC_CTX *mem_ctx)
CHECK_VALUE(io.out.offset, 1);
printf("Testing position information\n");
- fnum2 = cli_open(cli, fname, O_RDWR, DENY_NONE);
+ fnum2 = cli_open(cli->tree, fname, O_RDWR, DENY_NONE);
if (fnum2 == -1) {
- printf("2nd open failed - %s\n", cli_errstr(cli));
+ printf("2nd open failed - %s\n", cli_errstr(cli->tree));
ret = False;
goto done;
}
@@ -223,7 +223,7 @@ static BOOL test_seek(struct cli_state *cli, TALLOC_CTX *mem_ctx)
done:
smb_raw_exit(cli->session);
- cli_deltree(cli, BASEDIR);
+ cli_deltree(cli->tree, BASEDIR);
return ret;
}
diff --git a/source4/torture/raw/setfileinfo.c b/source4/torture/raw/setfileinfo.c
index 9da75596c5..f82a63180a 100644
--- a/source4/torture/raw/setfileinfo.c
+++ b/source4/torture/raw/setfileinfo.c
@@ -55,22 +55,22 @@ BOOL torture_raw_sfileinfo(int dummy)
mem_ctx = talloc_init("torture_sfileinfo");
- cli_deltree(cli, BASEDIR);
- cli_mkdir(cli, BASEDIR);
+ cli_deltree(cli->tree, BASEDIR);
+ cli_mkdir(cli->tree, BASEDIR);
#define RECREATE_FILE(fname) do { \
- if (fnum != -1) cli_close(cli, fnum); \
+ if (fnum != -1) cli_close(cli->tree, fnum); \
fnum = create_complex_file(cli, mem_ctx, fname); \
if (fnum == -1) { \
printf("(%d) ERROR: open of %s failed (%s)\n", \
- __LINE__, fname, cli_errstr(cli)); \
+ __LINE__, fname, cli_errstr(cli->tree)); \
ret = False; \
goto done; \
}} while (0)
#define RECREATE_BOTH do { \
RECREATE_FILE(path_fname); \
- cli_close(cli, fnum); \
+ cli_close(cli->tree, fnum); \
RECREATE_FILE(fnum_fname); \
} while (0)
@@ -408,8 +408,8 @@ BOOL torture_raw_sfileinfo(int dummy)
CHECK_VALUE(MODE_INFORMATION, mode_information, mode, 0);
#if 1
printf("finally the rename_information level\n");
- cli_close(cli, create_complex_file(cli, mem_ctx, fnum_fname_new));
- cli_close(cli, create_complex_file(cli, mem_ctx, path_fname_new));
+ cli_close(cli->tree, create_complex_file(cli, mem_ctx, fnum_fname_new));
+ cli_close(cli->tree, create_complex_file(cli, mem_ctx, path_fname_new));
sfinfo.rename_information.in.overwrite = 0;
sfinfo.rename_information.in.root_fid = 0;
@@ -444,7 +444,7 @@ BOOL torture_raw_sfileinfo(int dummy)
printf("Trying rename with dest file open and delete_on_close\n");
CHECK_CALL_FNUM(RENAME_INFORMATION, NT_STATUS_ACCESS_DENIED);
- cli_close(cli, fnum2);
+ cli_close(cli->tree, fnum2);
CHECK_CALL_FNUM(RENAME_INFORMATION, NT_STATUS_OK);
CHECK_STR(NAME_INFO, name_info, fname.s, fnum_fname);
@@ -459,7 +459,7 @@ BOOL torture_raw_sfileinfo(int dummy)
sfinfo.rename_information.in.overwrite = 0;
CHECK_CALL_FNUM(RENAME_INFORMATION, NT_STATUS_OK);
CHECK_STR(NAME_INFO, name_info, fname.s, fnum_fname_new);
- cli_close(cli, fnum2);
+ cli_close(cli->tree, fnum2);
sfinfo.rename_information.in.new_name = fnum_fname+strlen(BASEDIR)+1;
sfinfo.rename_information.in.overwrite = 0;
@@ -499,12 +499,12 @@ BOOL torture_raw_sfileinfo(int dummy)
done:
smb_raw_exit(cli->session);
- cli_close(cli, fnum);
- if (!cli_unlink(cli, fnum_fname)) {
- printf("Failed to delete %s - %s\n", fnum_fname, cli_errstr(cli));
+ cli_close(cli->tree, fnum);
+ if (!cli_unlink(cli->tree, fnum_fname)) {
+ printf("Failed to delete %s - %s\n", fnum_fname, cli_errstr(cli->tree));
}
- if (!cli_unlink(cli, path_fname)) {
- printf("Failed to delete %s - %s\n", path_fname, cli_errstr(cli));
+ if (!cli_unlink(cli->tree, path_fname)) {
+ printf("Failed to delete %s - %s\n", path_fname, cli_errstr(cli->tree));
}
torture_close_connection(cli);
@@ -532,7 +532,7 @@ BOOL torture_raw_sfileinfo_bug(int dummy)
mem_ctx = talloc_init("torture_sfileinfo");
fnum = create_complex_file(cli, mem_ctx, fname);
- cli_close(cli, fnum);
+ cli_close(cli->tree, fnum);
sfinfo.generic.level = RAW_SFILEINFO_STANDARD;
sfinfo.generic.file.fname = fname;
diff --git a/source4/torture/raw/unlink.c b/source4/torture/raw/unlink.c
index 889e25777c..741f8c61f7 100644
--- a/source4/torture/raw/unlink.c
+++ b/source4/torture/raw/unlink.c
@@ -40,9 +40,9 @@ static BOOL test_unlink(struct cli_state *cli, TALLOC_CTX *mem_ctx)
BOOL ret = True;
const char *fname = BASEDIR "\\test.txt";
- if (cli_deltree(cli, BASEDIR) == -1 ||
- !cli_mkdir(cli, BASEDIR)) {
- printf("Unable to setup %s - %s\n", BASEDIR, cli_errstr(cli));
+ if (cli_deltree(cli->tree, BASEDIR) == -1 ||
+ !cli_mkdir(cli->tree, BASEDIR)) {
+ printf("Unable to setup %s - %s\n", BASEDIR, cli_errstr(cli->tree));
return False;
}
@@ -52,7 +52,7 @@ static BOOL test_unlink(struct cli_state *cli, TALLOC_CTX *mem_ctx)
status = smb_raw_unlink(cli->tree, &io);
CHECK_STATUS(status, NT_STATUS_OBJECT_NAME_NOT_FOUND);
- cli_close(cli, cli_open(cli, fname, O_RDWR|O_CREAT, DENY_NONE));
+ cli_close(cli->tree, cli_open(cli->tree, fname, O_RDWR|O_CREAT, DENY_NONE));
io.in.pattern = fname;
io.in.attrib = 0;
@@ -60,7 +60,7 @@ static BOOL test_unlink(struct cli_state *cli, TALLOC_CTX *mem_ctx)
CHECK_STATUS(status, NT_STATUS_OK);
printf("Trying a hidden file\n");
- cli_close(cli, cli_open(cli, fname, O_RDWR|O_CREAT, DENY_NONE));
+ cli_close(cli->tree, cli_open(cli->tree, fname, O_RDWR|O_CREAT, DENY_NONE));
torture_set_file_attribute(cli->tree, fname, FILE_ATTRIBUTE_HIDDEN);
io.in.pattern = fname;
@@ -101,7 +101,7 @@ static BOOL test_unlink(struct cli_state *cli, TALLOC_CTX *mem_ctx)
CHECK_STATUS(status, NT_STATUS_FILE_IS_A_DIRECTORY);
printf("Trying wildcards\n");
- cli_close(cli, cli_open(cli, fname, O_RDWR|O_CREAT, DENY_NONE));
+ cli_close(cli->tree, cli_open(cli->tree, fname, O_RDWR|O_CREAT, DENY_NONE));
io.in.pattern = BASEDIR "\\t*.t";
io.in.attrib = 0;
status = smb_raw_unlink(cli->tree, &io);
@@ -128,7 +128,7 @@ static BOOL test_unlink(struct cli_state *cli, TALLOC_CTX *mem_ctx)
done:
smb_raw_exit(cli->session);
- cli_deltree(cli, BASEDIR);
+ cli_deltree(cli->tree, BASEDIR);
return ret;
}
diff --git a/source4/torture/raw/write.c b/source4/torture/raw/write.c
index 644a5579c8..3b356f1095 100644
--- a/source4/torture/raw/write.c
+++ b/source4/torture/raw/write.c
@@ -103,18 +103,18 @@ static BOOL test_write(struct cli_state *cli, TALLOC_CTX *mem_ctx)
buf = talloc_zero(mem_ctx, maxsize);
- if (cli_deltree(cli, BASEDIR) == -1 ||
- !cli_mkdir(cli, BASEDIR)) {
- printf("Unable to setup %s - %s\n", BASEDIR, cli_errstr(cli));
+ if (cli_deltree(cli->tree, BASEDIR) == -1 ||
+ !cli_mkdir(cli->tree, BASEDIR)) {
+ printf("Unable to setup %s - %s\n", BASEDIR, cli_errstr(cli->tree));
return False;
}
printf("Testing RAW_WRITE_WRITE\n");
io.generic.level = RAW_WRITE_WRITE;
- fnum = cli_open(cli, fname, O_RDWR|O_CREAT, DENY_NONE);
+ fnum = cli_open(cli->tree, fname, O_RDWR|O_CREAT, DENY_NONE);
if (fnum == -1) {
- printf("Failed to create %s - %s\n", fname, cli_errstr(cli));
+ printf("Failed to create %s - %s\n", fname, cli_errstr(cli->tree));
ret = False;
goto done;
}
@@ -140,7 +140,7 @@ static BOOL test_write(struct cli_state *cli, TALLOC_CTX *mem_ctx)
CHECK_VALUE(io.write.out.nwritten, io.write.in.count);
memset(buf, 0, maxsize);
- if (cli_read(cli, fnum, buf, 0, 13) != 13) {
+ if (cli_read(cli->tree, fnum, buf, 0, 13) != 13) {
printf("read failed at %d\n", __LINE__);
ret = False;
goto done;
@@ -159,7 +159,7 @@ static BOOL test_write(struct cli_state *cli, TALLOC_CTX *mem_ctx)
CHECK_VALUE(io.write.out.nwritten, 4000);
memset(buf, 0, maxsize);
- if (cli_read(cli, fnum, buf, 0, 4000) != 4000) {
+ if (cli_read(cli->tree, fnum, buf, 0, 4000) != 4000) {
printf("read failed at %d\n", __LINE__);
ret = False;
goto done;
@@ -190,7 +190,7 @@ static BOOL test_write(struct cli_state *cli, TALLOC_CTX *mem_ctx)
CHECK_ALL_INFO(io.write.in.count + (SMB_BIG_UINT)io.write.in.offset, size);
memset(buf, 0, maxsize);
- if (cli_read(cli, fnum, buf, io.write.in.offset, 4000) != 4000) {
+ if (cli_read(cli->tree, fnum, buf, io.write.in.offset, 4000) != 4000) {
printf("read failed at %d\n", __LINE__);
ret = False;
goto done;
@@ -198,9 +198,9 @@ static BOOL test_write(struct cli_state *cli, TALLOC_CTX *mem_ctx)
CHECK_BUFFER(buf, seed, 4000);
done:
- cli_close(cli, fnum);
+ cli_close(cli->tree, fnum);
smb_raw_exit(cli->session);
- cli_deltree(cli, BASEDIR);
+ cli_deltree(cli->tree, BASEDIR);
return ret;
}
@@ -222,18 +222,18 @@ static BOOL test_writex(struct cli_state *cli, TALLOC_CTX *mem_ctx)
buf = talloc_zero(mem_ctx, maxsize);
- if (cli_deltree(cli, BASEDIR) == -1 ||
- !cli_mkdir(cli, BASEDIR)) {
- printf("Unable to setup %s - %s\n", BASEDIR, cli_errstr(cli));
+ if (cli_deltree(cli->tree, BASEDIR) == -1 ||
+ !cli_mkdir(cli->tree, BASEDIR)) {
+ printf("Unable to setup %s - %s\n", BASEDIR, cli_errstr(cli->tree));
return False;
}
printf("Testing RAW_WRITE_WRITEX\n");
io.generic.level = RAW_WRITE_WRITEX;
- fnum = cli_open(cli, fname, O_RDWR|O_CREAT, DENY_NONE);
+ fnum = cli_open(cli->tree, fname, O_RDWR|O_CREAT, DENY_NONE);
if (fnum == -1) {
- printf("Failed to create %s - %s\n", fname, cli_errstr(cli));
+ printf("Failed to create %s - %s\n", fname, cli_errstr(cli->tree));
ret = False;
goto done;
}
@@ -260,7 +260,7 @@ static BOOL test_writex(struct cli_state *cli, TALLOC_CTX *mem_ctx)
CHECK_VALUE(io.writex.out.nwritten, io.writex.in.count);
memset(buf, 0, maxsize);
- if (cli_read(cli, fnum, buf, 0, 13) != 13) {
+ if (cli_read(cli->tree, fnum, buf, 0, 13) != 13) {
printf("read failed at %d\n", __LINE__);
ret = False;
goto done;
@@ -279,7 +279,7 @@ static BOOL test_writex(struct cli_state *cli, TALLOC_CTX *mem_ctx)
CHECK_VALUE(io.writex.out.nwritten, 4000);
memset(buf, 0, maxsize);
- if (cli_read(cli, fnum, buf, 0, 4000) != 4000) {
+ if (cli_read(cli->tree, fnum, buf, 0, 4000) != 4000) {
printf("read failed at %d\n", __LINE__);
ret = False;
goto done;
@@ -312,7 +312,7 @@ static BOOL test_writex(struct cli_state *cli, TALLOC_CTX *mem_ctx)
printf("Trying locked region\n");
cli->session->pid++;
- if (!cli_lock(cli, fnum, 3, 1, 0, WRITE_LOCK)) {
+ if (!cli_lock(cli->tree, fnum, 3, 1, 0, WRITE_LOCK)) {
printf("Failed to lock file at %d\n", __LINE__);
ret = False;
goto done;
@@ -340,7 +340,7 @@ static BOOL test_writex(struct cli_state *cli, TALLOC_CTX *mem_ctx)
CHECK_ALL_INFO(io.writex.in.count + (SMB_BIG_UINT)io.writex.in.offset, size);
memset(buf, 0, maxsize);
- if (cli_read(cli, fnum, buf, io.writex.in.offset, 4000) != 4000) {
+ if (cli_read(cli->tree, fnum, buf, io.writex.in.offset, 4000) != 4000) {
printf("read failed at %d\n", __LINE__);
ret = False;
goto done;
@@ -360,7 +360,7 @@ static BOOL test_writex(struct cli_state *cli, TALLOC_CTX *mem_ctx)
CHECK_ALL_INFO(io.writex.in.count + (SMB_BIG_UINT)io.writex.in.offset, size);
memset(buf, 0, maxsize);
- if (cli_read(cli, fnum, buf, io.writex.in.offset, 4000) != 4000) {
+ if (cli_read(cli->tree, fnum, buf, io.writex.in.offset, 4000) != 4000) {
printf("read failed at %d\n", __LINE__);
ret = False;
goto done;
@@ -372,9 +372,9 @@ static BOOL test_writex(struct cli_state *cli, TALLOC_CTX *mem_ctx)
setup_buffer(buf, seed, maxsize);
done:
- cli_close(cli, fnum);
+ cli_close(cli->tree, fnum);
smb_raw_exit(cli->session);
- cli_deltree(cli, BASEDIR);
+ cli_deltree(cli->tree, BASEDIR);
return ret;
}
@@ -396,18 +396,18 @@ static BOOL test_writeunlock(struct cli_state *cli, TALLOC_CTX *mem_ctx)
buf = talloc_zero(mem_ctx, maxsize);
- if (cli_deltree(cli, BASEDIR) == -1 ||
- !cli_mkdir(cli, BASEDIR)) {
- printf("Unable to setup %s - %s\n", BASEDIR, cli_errstr(cli));
+ if (cli_deltree(cli->tree, BASEDIR) == -1 ||
+ !cli_mkdir(cli->tree, BASEDIR)) {
+ printf("Unable to setup %s - %s\n", BASEDIR, cli_errstr(cli->tree));
return False;
}
printf("Testing RAW_WRITE_WRITEUNLOCK\n");
io.generic.level = RAW_WRITE_WRITEUNLOCK;
- fnum = cli_open(cli, fname, O_RDWR|O_CREAT, DENY_NONE);
+ fnum = cli_open(cli->tree, fname, O_RDWR|O_CREAT, DENY_NONE);
if (fnum == -1) {
- printf("Failed to create %s - %s\n", fname, cli_errstr(cli));
+ printf("Failed to create %s - %s\n", fname, cli_errstr(cli->tree));
ret = False;
goto done;
}
@@ -430,7 +430,7 @@ static BOOL test_writeunlock(struct cli_state *cli, TALLOC_CTX *mem_ctx)
io.writeunlock.in.data = buf;
status = smb_raw_write(cli->tree, &io);
CHECK_STATUS(status, NT_STATUS_RANGE_NOT_LOCKED);
- if (cli_read(cli, fnum, buf, 0, 13) != 13) {
+ if (cli_read(cli->tree, fnum, buf, 0, 13) != 13) {
printf("read failed at %d\n", __LINE__);
ret = False;
goto done;
@@ -439,14 +439,14 @@ static BOOL test_writeunlock(struct cli_state *cli, TALLOC_CTX *mem_ctx)
CHECK_VALUE(IVAL(buf,0), 0);
setup_buffer(buf, seed, maxsize);
- cli_lock(cli, fnum, io.writeunlock.in.offset, io.writeunlock.in.count,
+ cli_lock(cli->tree, fnum, io.writeunlock.in.offset, io.writeunlock.in.count,
0, WRITE_LOCK);
status = smb_raw_write(cli->tree, &io);
CHECK_STATUS(status, NT_STATUS_OK);
CHECK_VALUE(io.writeunlock.out.nwritten, io.writeunlock.in.count);
memset(buf, 0, maxsize);
- if (cli_read(cli, fnum, buf, 0, 13) != 13) {
+ if (cli_read(cli->tree, fnum, buf, 0, 13) != 13) {
printf("read failed at %d\n", __LINE__);
ret = False;
goto done;
@@ -460,7 +460,7 @@ static BOOL test_writeunlock(struct cli_state *cli, TALLOC_CTX *mem_ctx)
io.writeunlock.in.count = 4000;
io.writeunlock.in.offset = 0;
io.writeunlock.in.data = buf;
- cli_lock(cli, fnum, io.writeunlock.in.offset, io.writeunlock.in.count,
+ cli_lock(cli->tree, fnum, io.writeunlock.in.offset, io.writeunlock.in.count,
0, WRITE_LOCK);
status = smb_raw_write(cli->tree, &io);
CHECK_STATUS(status, NT_STATUS_OK);
@@ -470,7 +470,7 @@ static BOOL test_writeunlock(struct cli_state *cli, TALLOC_CTX *mem_ctx)
CHECK_STATUS(status, NT_STATUS_RANGE_NOT_LOCKED);
memset(buf, 0, maxsize);
- if (cli_read(cli, fnum, buf, 0, 4000) != 4000) {
+ if (cli_read(cli->tree, fnum, buf, 0, 4000) != 4000) {
printf("read failed at %d\n", __LINE__);
ret = False;
goto done;
@@ -495,7 +495,7 @@ static BOOL test_writeunlock(struct cli_state *cli, TALLOC_CTX *mem_ctx)
io.writeunlock.in.count = 4000;
io.writeunlock.in.offset = 0xFFFFFFFF - 2000;
io.writeunlock.in.data = buf;
- cli_lock(cli, fnum, io.writeunlock.in.offset, io.writeunlock.in.count,
+ cli_lock(cli->tree, fnum, io.writeunlock.in.offset, io.writeunlock.in.count,
0, WRITE_LOCK);
status = smb_raw_write(cli->tree, &io);
CHECK_STATUS(status, NT_STATUS_OK);
@@ -503,7 +503,7 @@ static BOOL test_writeunlock(struct cli_state *cli, TALLOC_CTX *mem_ctx)
CHECK_ALL_INFO(io.writeunlock.in.count + (SMB_BIG_UINT)io.writeunlock.in.offset, size);
memset(buf, 0, maxsize);
- if (cli_read(cli, fnum, buf, io.writeunlock.in.offset, 4000) != 4000) {
+ if (cli_read(cli->tree, fnum, buf, io.writeunlock.in.offset, 4000) != 4000) {
printf("read failed at %d\n", __LINE__);
ret = False;
goto done;
@@ -511,9 +511,9 @@ static BOOL test_writeunlock(struct cli_state *cli, TALLOC_CTX *mem_ctx)
CHECK_BUFFER(buf, seed, 4000);
done:
- cli_close(cli, fnum);
+ cli_close(cli->tree, fnum);
smb_raw_exit(cli->session);
- cli_deltree(cli, BASEDIR);
+ cli_deltree(cli->tree, BASEDIR);
return ret;
}
@@ -535,18 +535,18 @@ static BOOL test_writeclose(struct cli_state *cli, TALLOC_CTX *mem_ctx)
buf = talloc_zero(mem_ctx, maxsize);
- if (cli_deltree(cli, BASEDIR) == -1 ||
- !cli_mkdir(cli, BASEDIR)) {
- printf("Unable to setup %s - %s\n", BASEDIR, cli_errstr(cli));
+ if (cli_deltree(cli->tree, BASEDIR) == -1 ||
+ !cli_mkdir(cli->tree, BASEDIR)) {
+ printf("Unable to setup %s - %s\n", BASEDIR, cli_errstr(cli->tree));
return False;
}
printf("Testing RAW_WRITE_WRITECLOSE\n");
io.generic.level = RAW_WRITE_WRITECLOSE;
- fnum = cli_open(cli, fname, O_RDWR|O_CREAT, DENY_NONE);
+ fnum = cli_open(cli->tree, fname, O_RDWR|O_CREAT, DENY_NONE);
if (fnum == -1) {
- printf("Failed to create %s - %s\n", fname, cli_errstr(cli));
+ printf("Failed to create %s - %s\n", fname, cli_errstr(cli->tree));
ret = False;
goto done;
}
@@ -577,10 +577,10 @@ static BOOL test_writeclose(struct cli_state *cli, TALLOC_CTX *mem_ctx)
status = smb_raw_write(cli->tree, &io);
CHECK_STATUS(status, NT_STATUS_INVALID_HANDLE);
- fnum = cli_open(cli, fname, O_RDWR, DENY_NONE);
+ fnum = cli_open(cli->tree, fname, O_RDWR, DENY_NONE);
io.writeclose.in.fnum = fnum;
- if (cli_read(cli, fnum, buf, 0, 13) != 13) {
+ if (cli_read(cli->tree, fnum, buf, 0, 13) != 13) {
printf("read failed at %d\n", __LINE__);
ret = False;
goto done;
@@ -593,11 +593,11 @@ static BOOL test_writeclose(struct cli_state *cli, TALLOC_CTX *mem_ctx)
CHECK_STATUS(status, NT_STATUS_OK);
CHECK_VALUE(io.writeclose.out.nwritten, io.writeclose.in.count);
- fnum = cli_open(cli, fname, O_RDWR, DENY_NONE);
+ fnum = cli_open(cli->tree, fname, O_RDWR, DENY_NONE);
io.writeclose.in.fnum = fnum;
memset(buf, 0, maxsize);
- if (cli_read(cli, fnum, buf, 0, 13) != 13) {
+ if (cli_read(cli->tree, fnum, buf, 0, 13) != 13) {
printf("read failed at %d\n", __LINE__);
ret = False;
goto done;
@@ -618,11 +618,11 @@ static BOOL test_writeclose(struct cli_state *cli, TALLOC_CTX *mem_ctx)
status = smb_raw_write(cli->tree, &io);
CHECK_STATUS(status, NT_STATUS_INVALID_HANDLE);
- fnum = cli_open(cli, fname, O_RDWR, DENY_NONE);
+ fnum = cli_open(cli->tree, fname, O_RDWR, DENY_NONE);
io.writeclose.in.fnum = fnum;
memset(buf, 0, maxsize);
- if (cli_read(cli, fnum, buf, 0, 4000) != 4000) {
+ if (cli_read(cli->tree, fnum, buf, 0, 4000) != 4000) {
printf("read failed at %d\n", __LINE__);
ret = False;
goto done;
@@ -652,11 +652,11 @@ static BOOL test_writeclose(struct cli_state *cli, TALLOC_CTX *mem_ctx)
CHECK_VALUE(io.writeclose.out.nwritten, 4000);
CHECK_ALL_INFO(io.writeclose.in.count + (SMB_BIG_UINT)io.writeclose.in.offset, size);
- fnum = cli_open(cli, fname, O_RDWR, DENY_NONE);
+ fnum = cli_open(cli->tree, fname, O_RDWR, DENY_NONE);
io.writeclose.in.fnum = fnum;
memset(buf, 0, maxsize);
- if (cli_read(cli, fnum, buf, io.writeclose.in.offset, 4000) != 4000) {
+ if (cli_read(cli->tree, fnum, buf, io.writeclose.in.offset, 4000) != 4000) {
printf("read failed at %d\n", __LINE__);
ret = False;
goto done;
@@ -664,9 +664,9 @@ static BOOL test_writeclose(struct cli_state *cli, TALLOC_CTX *mem_ctx)
CHECK_BUFFER(buf, seed, 4000);
done:
- cli_close(cli, fnum);
+ cli_close(cli->tree, fnum);
smb_raw_exit(cli->session);
- cli_deltree(cli, BASEDIR);
+ cli_deltree(cli->tree, BASEDIR);
return ret;
}