summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJelmer Vernooij <jelmer@samba.org>2007-08-28 12:54:27 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 15:03:00 -0500
commit919aa6b27e5fe49b70c814210aa026c19be66e8a (patch)
tree4f1cff79459133a014a32e3f42fa787c7d83de67
parentb42691ee167415c7dc89d50b4ba18909bacd40c1 (diff)
downloadsamba-919aa6b27e5fe49b70c814210aa026c19be66e8a.tar.gz
samba-919aa6b27e5fe49b70c814210aa026c19be66e8a.tar.bz2
samba-919aa6b27e5fe49b70c814210aa026c19be66e8a.zip
r24735: Use torture API in more places.
(This used to be commit 1319d88c099496be29dd9214fa2492c81e848369)
-rw-r--r--source4/torture/basic/base.c6
-rw-r--r--source4/torture/config.mk1
-rw-r--r--source4/torture/libnet/domain.c2
-rw-r--r--source4/torture/libnet/groupinfo.c2
-rw-r--r--source4/torture/libnet/libnet_group.c2
-rw-r--r--source4/torture/libnet/libnet_share.c2
-rw-r--r--source4/torture/libnet/libnet_user.c6
-rw-r--r--source4/torture/libnet/userinfo.c2
-rw-r--r--source4/torture/libnet/userman.c6
-rw-r--r--source4/torture/raw/acls.c28
-rw-r--r--source4/torture/raw/chkpath.c21
-rw-r--r--source4/torture/raw/close.c45
-rw-r--r--source4/torture/raw/composite.c23
-rw-r--r--source4/torture/raw/context.c35
-rw-r--r--source4/torture/raw/eas.c16
-rw-r--r--source4/torture/raw/ioctl.c24
-rw-r--r--source4/torture/raw/lock.c56
-rw-r--r--source4/torture/raw/mkdir.c19
-rw-r--r--source4/torture/raw/mux.c30
-rw-r--r--source4/torture/raw/notify.c44
-rw-r--r--source4/torture/raw/open.c38
-rw-r--r--source4/torture/raw/oplock.c4
-rw-r--r--source4/torture/raw/qfileinfo.c48
-rw-r--r--source4/torture/raw/qfsinfo.c19
-rw-r--r--source4/torture/raw/raw.c53
-rw-r--r--source4/torture/raw/read.c56
-rw-r--r--source4/torture/raw/rename.c55
-rw-r--r--source4/torture/raw/search.c151
-rw-r--r--source4/torture/raw/seek.c18
-rw-r--r--source4/torture/raw/setfileinfo.c78
-rw-r--r--source4/torture/raw/streams.c15
-rw-r--r--source4/torture/raw/unlink.c46
-rw-r--r--source4/torture/raw/write.c48
-rw-r--r--source4/torture/rpc/alter_context.c2
-rw-r--r--source4/torture/rpc/bench.c2
-rw-r--r--source4/torture/rpc/bind.c2
-rw-r--r--source4/torture/rpc/dcom.c44
-rw-r--r--source4/torture/rpc/drsuapi.c4
-rw-r--r--source4/torture/rpc/dssetup.c2
-rw-r--r--source4/torture/rpc/epmapper.c2
-rw-r--r--source4/torture/rpc/handles.c40
-rw-r--r--source4/torture/rpc/initshutdown.c2
-rw-r--r--source4/torture/rpc/lsa.c8
-rw-r--r--source4/torture/rpc/lsa_lookup.c2
-rw-r--r--source4/torture/rpc/mgmt.c12
-rw-r--r--source4/torture/rpc/netlogon.c2
-rw-r--r--source4/torture/rpc/oxidresolve.c4
-rw-r--r--source4/torture/rpc/remact.c2
-rw-r--r--source4/torture/rpc/rot.c2
-rw-r--r--source4/torture/rpc/rpc.c18
-rw-r--r--source4/torture/rpc/samba3rpc.c2
-rw-r--r--source4/torture/rpc/samlogon.c8
-rw-r--r--source4/torture/rpc/samsync.c8
-rw-r--r--source4/torture/rpc/scanner.c9
-rw-r--r--source4/torture/rpc/session_key.c2
-rw-r--r--source4/torture/rpc/spoolss.c8
-rw-r--r--source4/torture/rpc/srvsvc.c4
-rw-r--r--source4/torture/rpc/svcctl.c142
-rw-r--r--source4/torture/rpc/testjoin.c5
59 files changed, 523 insertions, 814 deletions
diff --git a/source4/torture/basic/base.c b/source4/torture/basic/base.c
index 1e03197c28..bfe1e082f1 100644
--- a/source4/torture/basic/base.c
+++ b/source4/torture/basic/base.c
@@ -381,8 +381,6 @@ static BOOL run_negprot_nowait(struct torture_context *tctx)
torture_close_connection(cli);
- torture_comment(tctx, "finished negprot nowait test\n");
-
return correct;
}
@@ -1749,8 +1747,8 @@ NTSTATUS torture_base_init(void)
torture_suite_add_1smb_test(suite, "SECLEAK", torture_sec_leak);
torture_suite_add_simple_test(suite, "DISCONNECT", torture_disconnect);
torture_suite_add_suite(suite, torture_delay_write());
- torture_suite_add_simple_test(suite, "SAMBA3ERROR", torture_samba3_errorpaths);
-
+ torture_suite_add_simple_test(suite, "SAMBA3ERROR",
+ torture_samba3_errorpaths);
torture_suite_add_1smb_test(suite, "CASETABLE", torture_casetable);
torture_suite_add_1smb_test(suite, "UTABLE", torture_utable);
torture_suite_add_simple_test(suite, "SMB", torture_smb_scan);
diff --git a/source4/torture/config.mk b/source4/torture/config.mk
index dce41fb604..fc7a3c0763 100644
--- a/source4/torture/config.mk
+++ b/source4/torture/config.mk
@@ -122,7 +122,6 @@ OBJ_FILES = \
rpc/lsa_lookup.o \
rpc/session_key.o \
rpc/echo.o \
- rpc/dcom.o \
rpc/dfs.o \
rpc/drsuapi.o \
rpc/drsuapi_cracknames.o \
diff --git a/source4/torture/libnet/domain.c b/source4/torture/libnet/domain.c
index 50b53300a4..8eaca99dc9 100644
--- a/source4/torture/libnet/domain.c
+++ b/source4/torture/libnet/domain.c
@@ -86,7 +86,7 @@ BOOL torture_domainopen(struct torture_context *torture)
evt_ctx = event_context_find(torture);
net_ctx = libnet_context_init(evt_ctx);
- status = torture_rpc_connection(mem_ctx,
+ status = torture_rpc_connection(torture,
&net_ctx->samr.pipe,
&ndr_table_samr);
diff --git a/source4/torture/libnet/groupinfo.c b/source4/torture/libnet/groupinfo.c
index 361534052d..6e02d4f05d 100644
--- a/source4/torture/libnet/groupinfo.c
+++ b/source4/torture/libnet/groupinfo.c
@@ -235,7 +235,7 @@ BOOL torture_groupinfo(struct torture_context *torture)
mem_ctx = talloc_init("test_userinfo");
binding = torture_setting_string(torture, "binding", NULL);
- status = torture_rpc_connection(mem_ctx,
+ status = torture_rpc_connection(torture,
&p,
&ndr_table_samr);
diff --git a/source4/torture/libnet/libnet_group.c b/source4/torture/libnet/libnet_group.c
index ef2c3aa206..db2952e226 100644
--- a/source4/torture/libnet/libnet_group.c
+++ b/source4/torture/libnet/libnet_group.c
@@ -220,7 +220,7 @@ BOOL torture_groupinfo_api(struct torture_context *torture)
ctx = libnet_context_init(NULL);
ctx->cred = cmdline_credentials;
- status = torture_rpc_connection(prep_mem_ctx,
+ status = torture_rpc_connection(torture,
&p,
&ndr_table_samr);
if (!NT_STATUS_IS_OK(status)) {
diff --git a/source4/torture/libnet/libnet_share.c b/source4/torture/libnet/libnet_share.c
index 720246ed7e..a4d94a6b9c 100644
--- a/source4/torture/libnet/libnet_share.c
+++ b/source4/torture/libnet/libnet_share.c
@@ -222,7 +222,7 @@ BOOL torture_delshare(struct torture_context *torture)
libnetctx = libnet_context_init(NULL);
libnetctx->cred = cmdline_credentials;
- status = torture_rpc_connection(mem_ctx,
+ status = torture_rpc_connection(torture,
&p,
&ndr_table_srvsvc);
diff --git a/source4/torture/libnet/libnet_user.c b/source4/torture/libnet/libnet_user.c
index 03092d5c67..f3371e07a7 100644
--- a/source4/torture/libnet/libnet_user.c
+++ b/source4/torture/libnet/libnet_user.c
@@ -296,7 +296,7 @@ BOOL torture_deleteuser(struct torture_context *torture)
req.in.user_name = TEST_USERNAME;
req.in.domain_name = lp_workgroup();
- status = torture_rpc_connection(prep_mem_ctx,
+ status = torture_rpc_connection(torture,
&p,
&ndr_table_samr);
if (!NT_STATUS_IS_OK(status)) {
@@ -483,7 +483,7 @@ BOOL torture_modifyuser(struct torture_context *torture)
ctx = libnet_context_init(NULL);
ctx->cred = cmdline_credentials;
- status = torture_rpc_connection(prep_mem_ctx,
+ status = torture_rpc_connection(torture,
&p,
&ndr_table_samr);
if (!NT_STATUS_IS_OK(status)) {
@@ -624,7 +624,7 @@ BOOL torture_userinfo_api(struct torture_context *torture)
ctx = libnet_context_init(NULL);
ctx->cred = cmdline_credentials;
- status = torture_rpc_connection(prep_mem_ctx,
+ status = torture_rpc_connection(torture,
&p,
&ndr_table_samr);
if (!NT_STATUS_IS_OK(status)) {
diff --git a/source4/torture/libnet/userinfo.c b/source4/torture/libnet/userinfo.c
index f7aa479952..a1603b4bfc 100644
--- a/source4/torture/libnet/userinfo.c
+++ b/source4/torture/libnet/userinfo.c
@@ -314,7 +314,7 @@ BOOL torture_userinfo(struct torture_context *torture)
mem_ctx = talloc_init("test_userinfo");
binding = torture_setting_string(torture, "binding", NULL);
- status = torture_rpc_connection(mem_ctx,
+ status = torture_rpc_connection(torture,
&p,
&ndr_table_samr);
diff --git a/source4/torture/libnet/userman.c b/source4/torture/libnet/userman.c
index cdc8bf0c52..d70fb0bc77 100644
--- a/source4/torture/libnet/userman.c
+++ b/source4/torture/libnet/userman.c
@@ -489,7 +489,7 @@ BOOL torture_useradd(struct torture_context *torture)
mem_ctx = talloc_init("test_useradd");
binding = torture_setting_string(torture, "binding", NULL);
- status = torture_rpc_connection(mem_ctx,
+ status = torture_rpc_connection(torture,
&p,
&ndr_table_samr);
@@ -548,7 +548,7 @@ BOOL torture_userdel(struct torture_context *torture)
mem_ctx = talloc_init("test_userdel");
binding = torture_setting_string(torture, "binding", NULL);
- status = torture_rpc_connection(mem_ctx,
+ status = torture_rpc_connection(torture,
&p,
&ndr_table_samr);
@@ -593,7 +593,7 @@ BOOL torture_usermod(struct torture_context *torture)
mem_ctx = talloc_init("test_userdel");
binding = torture_setting_string(torture, "binding", NULL);
- status = torture_rpc_connection(mem_ctx,
+ status = torture_rpc_connection(torture,
&p,
&ndr_table_samr);
diff --git a/source4/torture/raw/acls.c b/source4/torture/raw/acls.c
index bad98178d7..c22c9be7de 100644
--- a/source4/torture/raw/acls.c
+++ b/source4/torture/raw/acls.c
@@ -1726,35 +1726,25 @@ done:
/*
basic testing of security descriptor calls
*/
-BOOL torture_raw_acls(struct torture_context *torture)
+bool torture_raw_acls(struct torture_context *tctx, struct smbcli_state *cli)
{
- struct smbcli_state *cli;
BOOL ret = True;
- TALLOC_CTX *mem_ctx;
-
- if (!torture_open_connection(&cli, 0)) {
- return False;
- }
-
- mem_ctx = talloc_init("torture_raw_acls");
if (!torture_setup_dir(cli, BASEDIR)) {
return False;
}
- ret &= test_sd(cli, mem_ctx);
- ret &= test_nttrans_create(cli, mem_ctx);
- ret &= test_creator_sid(cli, mem_ctx);
- ret &= test_generic_bits(cli, mem_ctx);
- ret &= test_owner_bits(cli, mem_ctx);
- ret &= test_inheritance(cli, mem_ctx);
- ret &= test_inheritance_dynamic(cli, mem_ctx);
- ret &= test_sd_get_set(cli, mem_ctx);
+ ret &= test_sd(cli, tctx);
+ ret &= test_nttrans_create(cli, tctx);
+ ret &= test_creator_sid(cli, tctx);
+ ret &= test_generic_bits(cli, tctx);
+ ret &= test_owner_bits(cli, tctx);
+ ret &= test_inheritance(cli, tctx);
+ ret &= test_inheritance_dynamic(cli, tctx);
+ ret &= test_sd_get_set(cli, tctx);
smb_raw_exit(cli->session);
smbcli_deltree(cli->tree, BASEDIR);
- torture_close_connection(cli);
- talloc_free(mem_ctx);
return ret;
}
diff --git a/source4/torture/raw/chkpath.c b/source4/torture/raw/chkpath.c
index 9914fdacca..a56afee546 100644
--- a/source4/torture/raw/chkpath.c
+++ b/source4/torture/raw/chkpath.c
@@ -214,18 +214,11 @@ done:
/*
basic testing of chkpath calls
*/
-BOOL torture_raw_chkpath(struct torture_context *torture)
+bool torture_raw_chkpath(struct torture_context *torture,
+ struct smbcli_state *cli)
{
- struct smbcli_state *cli;
- BOOL ret = True;
+ bool ret = true;
int fnum;
- TALLOC_CTX *mem_ctx;
-
- if (!torture_open_connection(&cli, 0)) {
- return False;
- }
-
- mem_ctx = talloc_init("torture_raw_chkpath");
if (!torture_setup_dir(cli, BASEDIR)) {
return False;
@@ -246,23 +239,19 @@ BOOL torture_raw_chkpath(struct torture_context *torture)
return False;
}
- fnum = create_complex_file(cli, mem_ctx, BASEDIR "\\nt\\V S\\VB98\\vb6.exe");
+ fnum = create_complex_file(cli, torture, BASEDIR "\\nt\\V S\\VB98\\vb6.exe");
if (fnum == -1) {
printf("failed to open \\nt\\V S\\VB98\\vb6.exe - %s\n", smbcli_errstr(cli->tree));
ret = False;
goto done;
}
- if (!test_chkpath(cli, mem_ctx)) {
- ret = False;
- }
+ ret &= test_chkpath(cli, torture);
done:
smb_raw_exit(cli->session);
smbcli_deltree(cli->tree, BASEDIR);
- torture_close_connection(cli);
- talloc_free(mem_ctx);
return ret;
}
diff --git a/source4/torture/raw/close.c b/source4/torture/raw/close.c
index 6af234e4b4..34ac2f0db8 100644
--- a/source4/torture/raw/close.c
+++ b/source4/torture/raw/close.c
@@ -24,14 +24,13 @@
#include "libcli/libcli.h"
#include "torture/util.h"
-
-/* basic testing of all RAW_CLOSE_* calls
+/**
+ * basic testing of all RAW_CLOSE_* calls
*/
-BOOL torture_raw_close(struct torture_context *torture)
+bool torture_raw_close(struct torture_context *torture,
+ struct smbcli_state *cli)
{
- struct smbcli_state *cli;
- BOOL ret = True;
- TALLOC_CTX *mem_ctx;
+ bool ret = true;
union smb_close io;
union smb_flush io_flush;
int fnum;
@@ -40,17 +39,11 @@ BOOL torture_raw_close(struct torture_context *torture)
union smb_fileinfo finfo, finfo2;
NTSTATUS status;
- if (!torture_open_connection(&cli, 0)) {
- return False;
- }
-
- mem_ctx = talloc_init("torture_raw_close");
-
#define REOPEN do { \
- fnum = create_complex_file(cli, mem_ctx, fname); \
+ fnum = create_complex_file(cli, torture, fname); \
if (fnum == -1) { \
printf("(%d) Failed to create %s\n", __LINE__, fname); \
- ret = False; \
+ ret = false; \
goto done; \
}} while (0)
@@ -58,7 +51,7 @@ BOOL torture_raw_close(struct torture_context *torture)
if (!NT_STATUS_EQUAL(status, correct)) { \
printf("(%d) Incorrect status %s - should be %s\n", \
__LINE__, nt_errstr(status), nt_errstr(correct)); \
- ret = False; \
+ ret = false; \
goto done; \
}} while (0)
@@ -78,15 +71,15 @@ BOOL torture_raw_close(struct torture_context *torture)
/* the file should have the write time set */
finfo.generic.level = RAW_FILEINFO_ALL_INFO;
finfo.generic.in.file.path = fname;
- status = smb_raw_pathinfo(cli->tree, mem_ctx, &finfo);
+ status = smb_raw_pathinfo(cli->tree, torture, &finfo);
CHECK_STATUS(status, NT_STATUS_OK);
if (basetime != nt_time_to_unix(finfo.all_info.out.write_time)) {
printf("Incorrect write time on file - %s - %s\n",
- timestring(mem_ctx, basetime),
- nt_time_string(mem_ctx, finfo.all_info.out.write_time));
- dump_all_info(mem_ctx, &finfo);
- ret = False;
+ timestring(torture, basetime),
+ nt_time_string(torture, finfo.all_info.out.write_time));
+ dump_all_info(torture, &finfo);
+ ret = false;
}
printf("testing other times\n");
@@ -99,7 +92,7 @@ BOOL torture_raw_close(struct torture_context *torture)
nt_time_equal(&finfo.all_info.out.write_time,
&finfo.all_info.out.change_time)) {
printf("Incorrect times after close - only write time should be set\n");
- dump_all_info(mem_ctx, &finfo);
+ dump_all_info(torture, &finfo);
if (!torture_setting_bool(torture, "samba3", false)) {
/*
@@ -117,7 +110,7 @@ BOOL torture_raw_close(struct torture_context *torture)
finfo2.generic.level = RAW_FILEINFO_ALL_INFO;
finfo2.generic.in.file.path = fname;
- status = smb_raw_pathinfo(cli->tree, mem_ctx, &finfo2);
+ status = smb_raw_pathinfo(cli->tree, torture, &finfo2);
CHECK_STATUS(status, NT_STATUS_OK);
io.close.level = RAW_CLOSE_CLOSE;
@@ -129,14 +122,14 @@ BOOL torture_raw_close(struct torture_context *torture)
/* the file should have the write time set equal to access time */
finfo.generic.level = RAW_FILEINFO_ALL_INFO;
finfo.generic.in.file.path = fname;
- status = smb_raw_pathinfo(cli->tree, mem_ctx, &finfo);
+ status = smb_raw_pathinfo(cli->tree, torture, &finfo);
CHECK_STATUS(status, NT_STATUS_OK);
if (!nt_time_equal(&finfo.all_info.out.write_time,
&finfo2.all_info.out.write_time)) {
printf("Incorrect write time on file - 0 time should be ignored\n");
- dump_all_info(mem_ctx, &finfo);
- ret = False;
+ dump_all_info(torture, &finfo);
+ ret = false;
}
printf("testing splclose\n");
@@ -179,7 +172,5 @@ BOOL torture_raw_close(struct torture_context *torture)
done:
smbcli_close(cli->tree, fnum);
smbcli_unlink(cli->tree, fname);
- torture_close_connection(cli);
- talloc_free(mem_ctx);
return ret;
}
diff --git a/source4/torture/raw/composite.c b/source4/torture/raw/composite.c
index 0b7644dd03..374ff3cb98 100644
--- a/source4/torture/raw/composite.c
+++ b/source4/torture/raw/composite.c
@@ -399,31 +399,22 @@ static BOOL test_fsinfo(struct smbcli_state *cli, TALLOC_CTX *mem_ctx)
/*
basic testing of libcli composite calls
*/
-BOOL torture_raw_composite(struct torture_context *torture)
+bool torture_raw_composite(struct torture_context *tctx,
+ struct smbcli_state *cli)
{
- struct smbcli_state *cli;
- BOOL ret = True;
- TALLOC_CTX *mem_ctx;
-
- if (!torture_open_connection(&cli, 0)) {
- return False;
- }
-
- mem_ctx = talloc_init("torture_raw_composite");
+ bool ret = true;
if (!torture_setup_dir(cli, BASEDIR)) {
return False;
}
- ret &= test_fetchfile(cli, mem_ctx);
- ret &= test_loadfile(cli, mem_ctx);
- ret &= test_appendacl(cli, mem_ctx);
- ret &= test_fsinfo(cli, mem_ctx);
+ ret &= test_fetchfile(cli, tctx);
+ ret &= test_loadfile(cli, tctx);
+ ret &= test_appendacl(cli, tctx);
+ ret &= test_fsinfo(cli, tctx);
smb_raw_exit(cli->session);
smbcli_deltree(cli->tree, BASEDIR);
- torture_close_connection(cli);
- talloc_free(mem_ctx);
return ret;
}
diff --git a/source4/torture/raw/context.c b/source4/torture/raw/context.c
index 8f3695d0dc..df7f5f3851 100644
--- a/source4/torture/raw/context.c
+++ b/source4/torture/raw/context.c
@@ -865,45 +865,36 @@ done:
/*
basic testing of session/tree context calls
*/
-static BOOL torture_raw_context_int(void)
+static bool torture_raw_context_int(struct torture_context *tctx,
+ struct smbcli_state *cli)
{
- struct smbcli_state *cli;
BOOL ret = True;
- TALLOC_CTX *mem_ctx;
- if (!torture_open_connection(&cli, 0)) {
- return False;
- }
-
- mem_ctx = talloc_init("torture_raw_context");
-
- ret &= test_session(cli, mem_ctx);
- ret &= test_tree(cli, mem_ctx);
- ret &= test_tree_ulogoff(cli, mem_ctx);
- ret &= test_pid_exit_only_sees_open(cli, mem_ctx);
- ret &= test_pid_2sess(cli, mem_ctx);
- ret &= test_pid_2tcon(cli, mem_ctx);
+ ret &= test_session(cli, tctx);
+ ret &= test_tree(cli, tctx);
+ ret &= test_tree_ulogoff(cli, tctx);
+ ret &= test_pid_exit_only_sees_open(cli, tctx);
+ ret &= test_pid_2sess(cli, tctx);
+ ret &= test_pid_2tcon(cli, tctx);
smb_raw_exit(cli->session);
smbcli_deltree(cli->tree, BASEDIR);
- torture_close_connection(cli);
- talloc_free(mem_ctx);
-
return ret;
}
/*
basic testing of session/tree context calls
*/
-BOOL torture_raw_context(struct torture_context *torture)
+bool torture_raw_context(struct torture_context *torture,
+ struct smbcli_state *cli)
{
- BOOL ret = True;
+ bool ret = true;
if (lp_use_spnego()) {
- ret &= torture_raw_context_int();
+ ret &= torture_raw_context_int(torture, cli);
lp_set_cmdline("use spnego", "False");
}
- ret &= torture_raw_context_int();
+ ret &= torture_raw_context_int(torture, cli);
return ret;
}
diff --git a/source4/torture/raw/eas.c b/source4/torture/raw/eas.c
index 226c4f6052..7e9c742943 100644
--- a/source4/torture/raw/eas.c
+++ b/source4/torture/raw/eas.c
@@ -444,29 +444,19 @@ done:
/*
basic testing of EA calls
*/
-BOOL torture_raw_eas(struct torture_context *torture)
+bool torture_raw_eas(struct torture_context *torture, struct smbcli_state *cli)
{
- struct smbcli_state *cli;
BOOL ret = True;
- TALLOC_CTX *mem_ctx;
-
- if (!torture_open_connection(&cli, 0)) {
- return False;
- }
-
- mem_ctx = talloc_init("torture_raw_eas");
if (!torture_setup_dir(cli, BASEDIR)) {
return False;
}
- ret &= test_eas(cli, mem_ctx);
- ret &= test_nttrans_create(cli, mem_ctx);
+ ret &= test_eas(cli, torture);
+ ret &= test_nttrans_create(cli, torture);
smb_raw_exit(cli->session);
- torture_close_connection(cli);
- talloc_free(mem_ctx);
return ret;
}
diff --git a/source4/torture/raw/ioctl.c b/source4/torture/raw/ioctl.c
index 9208d9fa44..8e98822e11 100644
--- a/source4/torture/raw/ioctl.c
+++ b/source4/torture/raw/ioctl.c
@@ -151,34 +151,20 @@ done:
/*
basic testing of some ioctl calls
*/
-BOOL torture_raw_ioctl(struct torture_context *torture)
+bool torture_raw_ioctl(struct torture_context *torture,
+ struct smbcli_state *cli)
{
- struct smbcli_state *cli;
- BOOL ret = True;
- TALLOC_CTX *mem_ctx;
-
- if (!torture_open_connection(&cli, 0)) {
- return False;
- }
-
- mem_ctx = talloc_init("torture_raw_ioctl");
+ bool ret = true;
if (!torture_setup_dir(cli, BASEDIR)) {
return False;
}
- if (!test_ioctl(cli, mem_ctx)) {
- ret = False;
- }
-
- if (!test_fsctl(cli, mem_ctx)) {
- ret = False;
- }
+ ret &= test_ioctl(cli, torture);
+ ret &= test_fsctl(cli, torture);
smb_raw_exit(cli->session);
smbcli_deltree(cli->tree, BASEDIR);
- torture_close_connection(cli);
- talloc_free(mem_ctx);
return ret;
}
diff --git a/source4/torture/raw/lock.c b/source4/torture/raw/lock.c
index cfedb4444b..533974c9a9 100644
--- a/source4/torture/raw/lock.c
+++ b/source4/torture/raw/lock.c
@@ -42,7 +42,7 @@
/*
test SMBlock and SMBunlock ops
*/
-static BOOL test_lock(struct smbcli_state *cli, TALLOC_CTX *mem_ctx)
+static bool test_lock(struct torture_context *tctx, struct smbcli_state *cli)
{
union smb_lock io;
NTSTATUS status;
@@ -177,7 +177,7 @@ done:
/*
test locking&X ops
*/
-static BOOL test_lockx(struct smbcli_state *cli, TALLOC_CTX *mem_ctx)
+static bool test_lockx(struct torture_context *tctx, struct smbcli_state *cli)
{
union smb_lock io;
struct smb_lock_entry lock[1];
@@ -356,7 +356,8 @@ done:
/*
test high pid
*/
-static BOOL test_pidhigh(struct smbcli_state *cli, TALLOC_CTX *mem_ctx)
+static bool test_pidhigh(struct torture_context *tctx,
+ struct smbcli_state *cli)
{
union smb_lock io;
struct smb_lock_entry lock[1];
@@ -437,7 +438,8 @@ done:
/*
test locking&X async operation
*/
-static BOOL test_async(struct smbcli_state *cli, TALLOC_CTX *mem_ctx)
+static bool test_async(struct torture_context *tctx,
+ struct smbcli_state *cli)
{
struct smbcli_session *session;
struct smb_composite_sesssetup setup;
@@ -586,7 +588,7 @@ static BOOL test_async(struct smbcli_state *cli, TALLOC_CTX *mem_ctx)
}
printf("create a new sessions\n");
- session = smbcli_session_init(cli->transport, mem_ctx, False);
+ session = smbcli_session_init(cli->transport, tctx, False);
setup.in.sesskey = cli->transport->negotiate.sesskey;
setup.in.capabilities = cli->transport->negotiate.capabilities;
setup.in.workgroup = lp_workgroup();
@@ -598,13 +600,13 @@ static BOOL test_async(struct smbcli_state *cli, TALLOC_CTX *mem_ctx)
printf("create new tree context\n");
share = lp_parm_string(-1, "torture", "share");
host = lp_parm_string(-1, "torture", "host");
- tree = smbcli_tree_init(session, mem_ctx, False);
+ tree = smbcli_tree_init(session, tctx, False);
tcon.generic.level = RAW_TCON_TCONX;
tcon.tconx.in.flags = 0;
tcon.tconx.in.password = data_blob(NULL, 0);
- tcon.tconx.in.path = talloc_asprintf(mem_ctx, "\\\\%s\\%s", host, share);
+ tcon.tconx.in.path = talloc_asprintf(tctx, "\\\\%s\\%s", host, share);
tcon.tconx.in.device = "A:";
- status = smb_raw_tcon(tree, mem_ctx, &tcon);
+ status = smb_raw_tcon(tree, tctx, &tcon);
CHECK_STATUS(status, NT_STATUS_OK);
tree->tid = tcon.tconx.out.tid;
@@ -769,7 +771,8 @@ done:
/*
test NT_STATUS_LOCK_NOT_GRANTED vs. NT_STATUS_FILE_LOCK_CONFLICT
*/
-static BOOL test_errorcode(struct smbcli_state *cli, TALLOC_CTX *mem_ctx)
+static bool test_errorcode(struct torture_context *tctx,
+ struct smbcli_state *cli)
{
union smb_lock io;
union smb_open op;
@@ -812,11 +815,11 @@ next_run:
op.openx.in.size = 0;
op.openx.in.timeout = 0;
- status = smb_raw_open(cli->tree, mem_ctx, &op);
+ status = smb_raw_open(cli->tree, tctx, &op);
CHECK_STATUS(status, NT_STATUS_OK);
fnum = op.openx.out.file.fnum;
- status = smb_raw_open(cli->tree, mem_ctx, &op);
+ status = smb_raw_open(cli->tree, tctx, &op);
CHECK_STATUS(status, NT_STATUS_OK);
fnum2 = op.openx.out.file.fnum;
@@ -1250,7 +1253,8 @@ done:
/*
test LOCKING_ANDX_CHANGE_LOCKTYPE
*/
-static BOOL test_changetype(struct smbcli_state *cli, TALLOC_CTX *mem_ctx)
+static bool test_changetype(struct torture_context *tctx,
+ struct smbcli_state *cli)
{
union smb_lock io;
struct smb_lock_entry lock[2];
@@ -1315,26 +1319,16 @@ done:
/*
basic testing of lock calls
*/
-BOOL torture_raw_lock(struct torture_context *torture)
+struct torture_suite *torture_raw_lock(TALLOC_CTX *mem_ctx)
{
- struct smbcli_state *cli;
- BOOL ret = True;
- TALLOC_CTX *mem_ctx;
-
- if (!torture_open_connection(&cli, 0)) {
- return False;
- }
-
- mem_ctx = talloc_init("torture_raw_lock");
+ struct torture_suite *suite = torture_suite_create(mem_ctx, "LOCK");
- ret &= test_lockx(cli, mem_ctx);
- ret &= test_lock(cli, mem_ctx);
- ret &= test_pidhigh(cli, mem_ctx);
- ret &= test_async(cli, mem_ctx);
- ret &= test_errorcode(cli, mem_ctx);
- ret &= test_changetype(cli, mem_ctx);
+ torture_suite_add_1smb_test(suite, "lockx", test_lockx);
+ torture_suite_add_1smb_test(suite, "lock", test_lock);
+ torture_suite_add_1smb_test(suite, "pidhigh", test_pidhigh);
+ torture_suite_add_1smb_test(suite, "async", test_async);
+ torture_suite_add_1smb_test(suite, "errorcode", test_errorcode);
+ torture_suite_add_1smb_test(suite, "changetype", test_changetype);
- torture_close_connection(cli);
- talloc_free(mem_ctx);
- return ret;
+ return suite;
}
diff --git a/source4/torture/raw/mkdir.c b/source4/torture/raw/mkdir.c
index 2485fb61e8..0e2fd1afe0 100644
--- a/source4/torture/raw/mkdir.c
+++ b/source4/torture/raw/mkdir.c
@@ -160,23 +160,14 @@ done:
/*
basic testing of all RAW_MKDIR_* calls
*/
-BOOL torture_raw_mkdir(struct torture_context *torture)
+BOOL torture_raw_mkdir(struct torture_context *torture,
+ struct smbcli_state *cli)
{
- struct smbcli_state *cli;
- BOOL ret = True;
- TALLOC_CTX *mem_ctx;
-
- if (!torture_open_connection(&cli, 0)) {
- return False;
- }
-
- mem_ctx = talloc_init("torture_raw_mkdir");
+ bool ret = true;
- if (!test_mkdir(cli, mem_ctx)) {
- ret = False;
+ if (!test_mkdir(cli, torture)) {
+ ret = false;
}
- torture_close_connection(cli);
- talloc_free(mem_ctx);
return ret;
}
diff --git a/source4/torture/raw/mux.c b/source4/torture/raw/mux.c
index d61d037239..b67d756ed9 100644
--- a/source4/torture/raw/mux.c
+++ b/source4/torture/raw/mux.c
@@ -342,37 +342,19 @@ done:
/*
basic testing of multiplexing notify
*/
-BOOL torture_raw_mux(struct torture_context *torture)
+bool torture_raw_mux(struct torture_context *torture, struct smbcli_state *cli)
{
- struct smbcli_state *cli;
- BOOL ret = True;
- TALLOC_CTX *mem_ctx;
+ bool ret = true;
- if (!torture_open_connection(&cli, 0)) {
- return False;
- }
-
- mem_ctx = talloc_init("torture_raw_mux");
-
if (!torture_setup_dir(cli, BASEDIR)) {
- return False;
- }
-
- if (!test_mux_open(cli, mem_ctx)) {
- ret = False;
- }
-
- if (!test_mux_write(cli, mem_ctx)) {
- ret = False;
+ return false;
}
- if (!test_mux_lock(cli, mem_ctx)) {
- ret = False;
- }
+ ret &= test_mux_open(cli, torture);
+ ret &= test_mux_write(cli, torture);
+ ret &= test_mux_lock(cli, torture);
smb_raw_exit(cli->session);
smbcli_deltree(cli->tree, BASEDIR);
- torture_close_connection(cli);
- talloc_free(mem_ctx);
return ret;
}
diff --git a/source4/torture/raw/notify.c b/source4/torture/raw/notify.c
index 5be1b612d3..1540a4a2dd 100644
--- a/source4/torture/raw/notify.c
+++ b/source4/torture/raw/notify.c
@@ -1283,41 +1283,29 @@ done:
/*
basic testing of change notify
*/
-BOOL torture_raw_notify(struct torture_context *torture)
+bool torture_raw_notify(struct torture_context *torture,
+ struct smbcli_state *cli,
+ struct smbcli_state *cli2)
{
- struct smbcli_state *cli, *cli2;
- BOOL ret = True;
- TALLOC_CTX *mem_ctx;
+ bool ret = true;
- if (!torture_open_connection(&cli, 0)) {
- return False;
- }
- if (!torture_open_connection(&cli2, 0)) {
- return False;
- }
-
- mem_ctx = talloc_init("torture_raw_notify");
-
if (!torture_setup_dir(cli, BASEDIR)) {
- return False;
+ return false;
}
- ret &= test_notify_dir(cli, cli2, mem_ctx);
- ret &= test_notify_mask(cli, mem_ctx);
- ret &= test_notify_recursive(cli, mem_ctx);
- ret &= test_notify_mask_change(cli, mem_ctx);
- ret &= test_notify_file(cli, mem_ctx);
- ret &= test_notify_tdis(mem_ctx);
- ret &= test_notify_exit(mem_ctx);
- ret &= test_notify_ulogoff(mem_ctx);
- ret &= test_notify_tcp_dis(mem_ctx);
- ret &= test_notify_double(cli, mem_ctx);
- ret &= test_notify_tree(cli, mem_ctx);
+ ret &= test_notify_dir(cli, cli2, torture);
+ ret &= test_notify_mask(cli, torture);
+ ret &= test_notify_recursive(cli, torture);
+ ret &= test_notify_mask_change(cli, torture);
+ ret &= test_notify_file(cli, torture);
+ ret &= test_notify_tdis(torture);
+ ret &= test_notify_exit(torture);
+ ret &= test_notify_ulogoff(torture);
+ ret &= test_notify_tcp_dis(torture);
+ ret &= test_notify_double(cli, torture);
+ ret &= test_notify_tree(cli, torture);
smb_raw_exit(cli->session);
smbcli_deltree(cli->tree, BASEDIR);
- torture_close_connection(cli);
- torture_close_connection(cli2);
- talloc_free(mem_ctx);
return ret;
}
diff --git a/source4/torture/raw/open.c b/source4/torture/raw/open.c
index 4a4b97f531..f8fa4ff8fe 100644
--- a/source4/torture/raw/open.c
+++ b/source4/torture/raw/open.c
@@ -1459,39 +1459,29 @@ static BOOL test_raw_open_multi(void)
/* basic testing of all RAW_OPEN_* calls
*/
-BOOL torture_raw_open(struct torture_context *torture)
+bool torture_raw_open(struct torture_context *torture, struct smbcli_state *cli)
{
- struct smbcli_state *cli;
- BOOL ret = True;
- TALLOC_CTX *mem_ctx;
-
- if (!torture_open_connection(&cli, 0)) {
- return False;
- }
-
- mem_ctx = talloc_init("torture_raw_open");
+ bool ret = true;
if (!torture_setup_dir(cli, BASEDIR)) {
- return False;
+ return false;
}
- ret &= test_ntcreatex_brlocked(cli, mem_ctx);
- ret &= test_open(cli, mem_ctx);
+ ret &= test_ntcreatex_brlocked(cli, torture);
+ ret &= test_open(cli, torture);
ret &= test_raw_open_multi();
- ret &= test_openx(cli, mem_ctx);
- ret &= test_ntcreatex(cli, mem_ctx);
- ret &= test_nttrans_create(cli, mem_ctx);
- ret &= test_t2open(cli, mem_ctx);
- ret &= test_mknew(cli, mem_ctx);
- ret &= test_create(cli, mem_ctx);
- ret &= test_ctemp(cli, mem_ctx);
- ret &= test_chained(cli, mem_ctx);
- ret &= test_no_leading_slash(cli, mem_ctx);
+ ret &= test_openx(cli, torture);
+ ret &= test_ntcreatex(cli, torture);
+ ret &= test_nttrans_create(cli, torture);
+ ret &= test_t2open(cli, torture);
+ ret &= test_mknew(cli, torture);
+ ret &= test_create(cli, torture);
+ ret &= test_ctemp(cli, torture);
+ ret &= test_chained(cli, torture);
+ ret &= test_no_leading_slash(cli, torture);
smb_raw_exit(cli->session);
smbcli_deltree(cli->tree, BASEDIR);
- torture_close_connection(cli);
- talloc_free(mem_ctx);
return ret;
}
diff --git a/source4/torture/raw/oplock.c b/source4/torture/raw/oplock.c
index 1d6b22244a..f1779ad9cf 100644
--- a/source4/torture/raw/oplock.c
+++ b/source4/torture/raw/oplock.c
@@ -1282,9 +1282,9 @@ done:
/*
basic testing of oplocks
*/
-struct torture_suite *torture_raw_oplock(void)
+struct torture_suite *torture_raw_oplock(TALLOC_CTX *mem_ctx)
{
- struct torture_suite *suite = torture_suite_create(talloc_autofree_context(), "OPLOCK");
+ struct torture_suite *suite = torture_suite_create(mem_ctx, "OPLOCK");
torture_suite_add_2smb_test(suite, "NORMAL", test_raw_oplock_normal);
torture_suite_add_2smb_test(suite, "BATCH1", test_raw_oplock_batch1);
diff --git a/source4/torture/raw/qfileinfo.c b/source4/torture/raw/qfileinfo.c
index 6bcfdcfe09..8cb80cecc1 100644
--- a/source4/torture/raw/qfileinfo.c
+++ b/source4/torture/raw/qfileinfo.c
@@ -222,9 +222,11 @@ static union smb_fileinfo *fname_find(bool is_ipc, const char *name)
for each call we test that it succeeds, and where possible test
for consistency between the calls.
*/
-static BOOL torture_raw_qfileinfo_internals(struct torture_context *torture, TALLOC_CTX *mem_ctx,
- struct smbcli_tree *tree, int fnum, const char *fname,
- bool is_ipc)
+static BOOL torture_raw_qfileinfo_internals(struct torture_context *torture,
+ TALLOC_CTX *mem_ctx,
+ struct smbcli_tree *tree,
+ int fnum, const char *fname,
+ bool is_ipc)
{
int i;
BOOL ret = True;
@@ -816,56 +818,38 @@ done:
for each call we test that it succeeds, and where possible test
for consistency between the calls.
*/
-BOOL torture_raw_qfileinfo(struct torture_context *torture)
+bool torture_raw_qfileinfo(struct torture_context *torture,
+ struct smbcli_state *cli)
{
- struct smbcli_state *cli;
- BOOL ret = True;
- TALLOC_CTX *mem_ctx;
int fnum;
+ bool ret;
const char *fname = "\\torture_qfileinfo.txt";
- if (!torture_open_connection(&cli, 0)) {
- return False;
- }
-
- mem_ctx = talloc_init("torture_qfileinfo");
-
- fnum = create_complex_file(cli, mem_ctx, fname);
+ fnum = create_complex_file(cli, torture, fname);
if (fnum == -1) {
printf("ERROR: open of %s failed (%s)\n", fname, smbcli_errstr(cli->tree));
- ret = False;
- goto done;
+ return false;
}
- ret = torture_raw_qfileinfo_internals(torture, mem_ctx, cli->tree, fnum, fname, False /* is_ipc */);
+ ret = torture_raw_qfileinfo_internals(torture, torture, cli->tree, fnum, fname, False /* is_ipc */);
smbcli_close(cli->tree, fnum);
smbcli_unlink(cli->tree, fname);
-done:
- torture_close_connection(cli);
- talloc_free(mem_ctx);
return ret;
}
-BOOL torture_raw_qfileinfo_pipe(struct torture_context *torture)
+bool torture_raw_qfileinfo_pipe(struct torture_context *torture,
+ struct smbcli_state *cli)
{
- TALLOC_CTX *mem_ctx;
- BOOL ret = True;
+ bool ret = true;
int fnum;
const char *fname = "\\lsass";
- struct smbcli_state *cli;
struct dcerpc_pipe *p;
struct smbcli_tree *ipc_tree;
NTSTATUS status;
- if (!torture_open_connection(&cli, 0)) {
- return False;
- }
-
- mem_ctx = talloc_init("torture_qfileinfo_pipe");
-
- if (!(p = dcerpc_pipe_init(mem_ctx,
+ if (!(p = dcerpc_pipe_init(torture,
cli->tree->session->transport->socket->event.ctx))) {
return False;
}
@@ -881,7 +865,7 @@ BOOL torture_raw_qfileinfo_pipe(struct torture_context *torture)
ipc_tree = dcerpc_smb_tree(p->conn);
fnum = dcerpc_smb_fnum(p->conn);
- ret = torture_raw_qfileinfo_internals(torture, mem_ctx, ipc_tree, fnum, fname, True /* is_ipc */);
+ ret = torture_raw_qfileinfo_internals(torture, torture, ipc_tree, fnum, fname, True /* is_ipc */);
talloc_free(p);
return ret;
diff --git a/source4/torture/raw/qfsinfo.c b/source4/torture/raw/qfsinfo.c
index 982f348cd5..dc09e55b63 100644
--- a/source4/torture/raw/qfsinfo.c
+++ b/source4/torture/raw/qfsinfo.c
@@ -120,26 +120,19 @@ static union smb_fsinfo *find(const char *name)
Some of the consistency tests assume that the target filesystem is
quiescent, which is sometimes hard to achieve
*/
-BOOL torture_raw_qfsinfo(struct torture_context *torture)
+bool torture_raw_qfsinfo(struct torture_context *torture,
+ struct smbcli_state *cli)
{
- struct smbcli_state *cli;
int i;
BOOL ret = True;
int count;
union smb_fsinfo *s1, *s2;
- TALLOC_CTX *mem_ctx;
- if (!torture_open_connection(&cli, 0)) {
- return False;
- }
-
- mem_ctx = talloc_init("torture_qfsinfo");
-
/* scan all the levels, pulling the results */
for (i=0; levels[i].name; i++) {
printf("Running level %s\n", levels[i].name);
levels[i].fsinfo.generic.level = levels[i].level;
- levels[i].status = smb_raw_fsinfo(cli->tree, mem_ctx, &levels[i].fsinfo);
+ levels[i].status = smb_raw_fsinfo(cli->tree, torture, &levels[i].fsinfo);
}
/* check for completely broken levels */
@@ -158,11 +151,10 @@ BOOL torture_raw_qfsinfo(struct torture_context *torture)
}
if (count != 0) {
- ret = False;
printf("%d levels failed\n", count);
if (count > 13) {
printf("too many level failures - giving up\n");
- goto done;
+ return False;
}
}
@@ -303,8 +295,5 @@ BOOL torture_raw_qfsinfo(struct torture_context *torture)
STR_CHECK("ATTRIBUTE_INFO", attribute_info, fs_type, STR_UNICODE);
STR_CHECK("ATTRIBUTE_INFORMATION", attribute_info, fs_type, STR_UNICODE);
-done:
- torture_close_connection(cli);
- talloc_free(mem_ctx);
return ret;
}
diff --git a/source4/torture/raw/raw.c b/source4/torture/raw/raw.c
index 67d79ef78c..85db92661b 100644
--- a/source4/torture/raw/raw.c
+++ b/source4/torture/raw/raw.c
@@ -21,6 +21,7 @@
#include "torture/torture.h"
#include "libcli/raw/libcliraw.h"
#include "torture/raw/proto.h"
+#include "torture/util.h"
NTSTATUS torture_raw_init(void)
{
@@ -31,33 +32,33 @@ NTSTATUS torture_raw_init(void)
torture_suite_add_simple_test(suite, "BENCH-OPLOCK", torture_bench_oplock);
torture_suite_add_simple_test(suite, "BENCH-LOCK", torture_bench_lock);
torture_suite_add_simple_test(suite, "BENCH-OPEN", torture_bench_open);
- torture_suite_add_simple_test(suite, "QFSINFO", torture_raw_qfsinfo);
- torture_suite_add_simple_test(suite, "QFILEINFO", torture_raw_qfileinfo);
- torture_suite_add_simple_test(suite, "QFILEINFO-IPC", torture_raw_qfileinfo_pipe);
- torture_suite_add_simple_test(suite, "SFILEINFO", torture_raw_sfileinfo);
- torture_suite_add_simple_test(suite, "SFILEINFO-BUG", torture_raw_sfileinfo_bug);
- torture_suite_add_simple_test(suite, "SFILEINFO-RENAME",
+ torture_suite_add_1smb_test(suite, "QFSINFO", torture_raw_qfsinfo);
+ torture_suite_add_1smb_test(suite, "QFILEINFO", torture_raw_qfileinfo);
+ torture_suite_add_1smb_test(suite, "QFILEINFO-IPC", torture_raw_qfileinfo_pipe);
+ torture_suite_add_1smb_test(suite, "SFILEINFO", torture_raw_sfileinfo);
+ torture_suite_add_1smb_test(suite, "SFILEINFO-BUG", torture_raw_sfileinfo_bug);
+ torture_suite_add_1smb_test(suite, "SFILEINFO-RENAME",
torture_raw_sfileinfo_rename);
- torture_suite_add_simple_test(suite, "SEARCH", torture_raw_search);
- torture_suite_add_simple_test(suite, "CLOSE", torture_raw_close);
- torture_suite_add_simple_test(suite, "OPEN", torture_raw_open);
- torture_suite_add_simple_test(suite, "MKDIR", torture_raw_mkdir);
- torture_suite_add_suite(suite, torture_raw_oplock());
- torture_suite_add_simple_test(suite, "NOTIFY", torture_raw_notify);
- torture_suite_add_simple_test(suite, "MUX", torture_raw_mux);
- torture_suite_add_simple_test(suite, "IOCTL", torture_raw_ioctl);
- torture_suite_add_simple_test(suite, "CHKPATH", torture_raw_chkpath);
- torture_suite_add_simple_test(suite, "UNLINK", torture_raw_unlink);
- torture_suite_add_simple_test(suite, "READ", torture_raw_read);
- torture_suite_add_simple_test(suite, "WRITE", torture_raw_write);
- torture_suite_add_simple_test(suite, "LOCK", torture_raw_lock);
- torture_suite_add_simple_test(suite, "CONTEXT", torture_raw_context);
- torture_suite_add_simple_test(suite, "RENAME", torture_raw_rename);
- torture_suite_add_simple_test(suite, "SEEK", torture_raw_seek);
- torture_suite_add_simple_test(suite, "EAS", torture_raw_eas);
- torture_suite_add_simple_test(suite, "STREAMS", torture_raw_streams);
- torture_suite_add_simple_test(suite, "ACLS", torture_raw_acls);
- torture_suite_add_simple_test(suite, "COMPOSITE", torture_raw_composite);
+ torture_suite_add_suite(suite, torture_raw_search(suite));
+ torture_suite_add_1smb_test(suite, "CLOSE", torture_raw_close);
+ torture_suite_add_1smb_test(suite, "OPEN", torture_raw_open);
+ torture_suite_add_1smb_test(suite, "MKDIR", torture_raw_mkdir);
+ torture_suite_add_suite(suite, torture_raw_oplock(suite));
+ torture_suite_add_2smb_test(suite, "NOTIFY", torture_raw_notify);
+ torture_suite_add_1smb_test(suite, "MUX", torture_raw_mux);
+ torture_suite_add_1smb_test(suite, "IOCTL", torture_raw_ioctl);
+ torture_suite_add_1smb_test(suite, "CHKPATH", torture_raw_chkpath);
+ torture_suite_add_suite(suite, torture_raw_unlink(suite));
+ torture_suite_add_suite(suite, torture_raw_read(suite));
+ torture_suite_add_suite(suite, torture_raw_write(suite));
+ torture_suite_add_suite(suite, torture_raw_lock(suite));
+ torture_suite_add_1smb_test(suite, "CONTEXT", torture_raw_context);
+ torture_suite_add_suite(suite, torture_raw_rename(suite));
+ torture_suite_add_1smb_test(suite, "SEEK", torture_raw_seek);
+ torture_suite_add_1smb_test(suite, "EAS", torture_raw_eas);
+ torture_suite_add_1smb_test(suite, "STREAMS", torture_raw_streams);
+ torture_suite_add_1smb_test(suite, "ACLS", torture_raw_acls);
+ torture_suite_add_1smb_test(suite, "COMPOSITE", torture_raw_composite);
torture_suite_add_simple_test(suite, "SAMBA3HIDE", torture_samba3_hide);
torture_suite_add_simple_test(suite, "SAMBA3CLOSEERR", torture_samba3_closeerr);
torture_suite_add_simple_test(suite, "SAMBA3CHECKFSP", torture_samba3_checkfsp);
diff --git a/source4/torture/raw/read.c b/source4/torture/raw/read.c
index 95e9d891d9..f1048f25ac 100644
--- a/source4/torture/raw/read.c
+++ b/source4/torture/raw/read.c
@@ -81,7 +81,7 @@ static BOOL check_buffer(uint8_t *buf, uint_t seed, int len, int line)
/*
test read ops
*/
-static BOOL test_read(struct smbcli_state *cli, TALLOC_CTX *mem_ctx)
+static bool test_read(struct torture_context *tctx, struct smbcli_state *cli)
{
union smb_read io;
NTSTATUS status;
@@ -93,7 +93,7 @@ static BOOL test_read(struct smbcli_state *cli, TALLOC_CTX *mem_ctx)
const char *test_data = "TEST DATA";
uint_t seed = time(NULL);
- buf = talloc_zero_size(mem_ctx, maxsize);
+ buf = talloc_zero_size(tctx, maxsize);
if (!torture_setup_dir(cli, BASEDIR)) {
return False;
@@ -207,7 +207,8 @@ done:
/*
test lockread ops
*/
-static BOOL test_lockread(struct smbcli_state *cli, TALLOC_CTX *mem_ctx)
+static bool test_lockread(struct torture_context *tctx,
+ struct smbcli_state *cli)
{
union smb_read io;
NTSTATUS status;
@@ -219,7 +220,7 @@ static BOOL test_lockread(struct smbcli_state *cli, TALLOC_CTX *mem_ctx)
const char *test_data = "TEST DATA";
uint_t seed = time(NULL);
- buf = talloc_zero_size(mem_ctx, maxsize);
+ buf = talloc_zero_size(tctx, maxsize);
if (!torture_setup_dir(cli, BASEDIR)) {
return False;
@@ -352,7 +353,7 @@ done:
/*
test readx ops
*/
-static BOOL test_readx(struct smbcli_state *cli, TALLOC_CTX *mem_ctx)
+static bool test_readx(struct torture_context *tctx, struct smbcli_state *cli)
{
union smb_read io;
NTSTATUS status;
@@ -364,7 +365,7 @@ static BOOL test_readx(struct smbcli_state *cli, TALLOC_CTX *mem_ctx)
const char *test_data = "TEST DATA";
uint_t seed = time(NULL);
- buf = talloc_zero_size(mem_ctx, maxsize);
+ buf = talloc_zero_size(tctx, maxsize);
if (!torture_setup_dir(cli, BASEDIR)) {
return False;
@@ -590,7 +591,8 @@ done:
/*
test readbraw ops
*/
-static BOOL test_readbraw(struct smbcli_state *cli, TALLOC_CTX *mem_ctx)
+static bool test_readbraw(struct torture_context *tctx,
+ struct smbcli_state *cli)
{
union smb_read io;
NTSTATUS status;
@@ -602,7 +604,7 @@ static BOOL test_readbraw(struct smbcli_state *cli, TALLOC_CTX *mem_ctx)
const char *test_data = "TEST DATA";
uint_t seed = time(NULL);
- buf = talloc_zero_size(mem_ctx, maxsize);
+ buf = talloc_zero_size(tctx, maxsize);
if (!torture_setup_dir(cli, BASEDIR)) {
return False;
@@ -762,7 +764,8 @@ done:
/*
test read for execute
*/
-static BOOL test_read_for_execute(struct smbcli_state *cli, TALLOC_CTX *mem_ctx)
+static bool test_read_for_execute(struct torture_context *tctx,
+ struct smbcli_state *cli)
{
union smb_open op;
union smb_write wr;
@@ -775,7 +778,7 @@ static BOOL test_read_for_execute(struct smbcli_state *cli, TALLOC_CTX *mem_ctx)
const char *fname = BASEDIR "\\test.txt";
const uint8_t data[] = "TEST DATA";
- buf = talloc_zero_size(mem_ctx, maxsize);
+ buf = talloc_zero_size(tctx, maxsize);
if (!torture_setup_dir(cli, BASEDIR)) {
return False;
@@ -795,7 +798,7 @@ static BOOL test_read_for_execute(struct smbcli_state *cli, TALLOC_CTX *mem_ctx)
op.ntcreatex.in.impersonation = NTCREATEX_IMPERSONATION_ANONYMOUS;
op.ntcreatex.in.security_flags = 0;
op.ntcreatex.in.fname = fname;
- status = smb_raw_open(cli->tree, mem_ctx, &op);
+ status = smb_raw_open(cli->tree, tctx, &op);
CHECK_STATUS(status, NT_STATUS_OK);
fnum = op.ntcreatex.out.file.fnum;
@@ -826,7 +829,7 @@ static BOOL test_read_for_execute(struct smbcli_state *cli, TALLOC_CTX *mem_ctx)
op.ntcreatex.in.impersonation = NTCREATEX_IMPERSONATION_ANONYMOUS;
op.ntcreatex.in.security_flags = 0;
op.ntcreatex.in.fname = fname;
- status = smb_raw_open(cli->tree, mem_ctx, &op);
+ status = smb_raw_open(cli->tree, tctx, &op);
CHECK_STATUS(status, NT_STATUS_OK);
fnum = op.ntcreatex.out.file.fnum;
@@ -873,7 +876,7 @@ static BOOL test_read_for_execute(struct smbcli_state *cli, TALLOC_CTX *mem_ctx)
op.ntcreatex.in.impersonation = NTCREATEX_IMPERSONATION_ANONYMOUS;
op.ntcreatex.in.security_flags = 0;
op.ntcreatex.in.fname = fname;
- status = smb_raw_open(cli->tree, mem_ctx, &op);
+ status = smb_raw_open(cli->tree, tctx, &op);
CHECK_STATUS(status, NT_STATUS_OK);
fnum = op.ntcreatex.out.file.fnum;
@@ -917,25 +920,16 @@ done:
/*
basic testing of read calls
*/
-BOOL torture_raw_read(struct torture_context *torture)
+struct torture_suite *torture_raw_read(TALLOC_CTX *mem_ctx)
{
- struct smbcli_state *cli;
- BOOL ret = True;
- TALLOC_CTX *mem_ctx;
-
- if (!torture_open_connection(&cli, 0)) {
- return False;
- }
-
- mem_ctx = talloc_init("torture_raw_read");
+ struct torture_suite *suite = torture_suite_create(mem_ctx, "READ");
- ret &= test_read(cli, mem_ctx);
- ret &= test_readx(cli, mem_ctx);
- ret &= test_lockread(cli, mem_ctx);
- ret &= test_readbraw(cli, mem_ctx);
- ret &= test_read_for_execute(cli, mem_ctx);
+ torture_suite_add_1smb_test(suite, "read", test_read);
+ torture_suite_add_1smb_test(suite, "readx", test_readx);
+ torture_suite_add_1smb_test(suite, "lockread", test_lockread);
+ torture_suite_add_1smb_test(suite, "readbraw", test_readbraw);
+ torture_suite_add_1smb_test(suite, "read for execute",
+ test_read_for_execute);
- torture_close_connection(cli);
- talloc_free(mem_ctx);
- return ret;
+ return suite;
}
diff --git a/source4/torture/raw/rename.c b/source4/torture/raw/rename.c
index 6b1eb4392a..05a5320859 100644
--- a/source4/torture/raw/rename.c
+++ b/source4/torture/raw/rename.c
@@ -43,7 +43,8 @@
/*
test SMBmv ops
*/
-static BOOL test_mv(struct smbcli_state *cli, TALLOC_CTX *mem_ctx)
+static bool test_mv(struct torture_context *tctx,
+ struct smbcli_state *cli)
{
union smb_rename io;
NTSTATUS status;
@@ -78,7 +79,7 @@ static BOOL test_mv(struct smbcli_state *cli, TALLOC_CTX *mem_ctx)
op.ntcreatex.in.security_flags = 0;
op.ntcreatex.in.fname = fname1;
- status = smb_raw_open(cli->tree, mem_ctx, &op);
+ status = smb_raw_open(cli->tree, tctx, &op);
CHECK_STATUS(status, NT_STATUS_OK);
fnum = op.ntcreatex.out.file.fnum;
@@ -98,7 +99,7 @@ static BOOL test_mv(struct smbcli_state *cli, TALLOC_CTX *mem_ctx)
NTCREATEX_SHARE_ACCESS_DELETE |
NTCREATEX_SHARE_ACCESS_READ |
NTCREATEX_SHARE_ACCESS_WRITE;
- status = smb_raw_open(cli->tree, mem_ctx, &op);
+ status = smb_raw_open(cli->tree, tctx, &op);
CHECK_STATUS(status, NT_STATUS_OK);
fnum = op.ntcreatex.out.file.fnum;
@@ -119,7 +120,7 @@ static BOOL test_mv(struct smbcli_state *cli, TALLOC_CTX *mem_ctx)
finfo.generic.level = RAW_FILEINFO_ALL_INFO;
finfo.all_info.in.file.path = fname1;
- status = smb_raw_pathinfo(cli->tree, mem_ctx, &finfo);
+ status = smb_raw_pathinfo(cli->tree, tctx, &finfo);
CHECK_STATUS(status, NT_STATUS_OK);
if (strcmp(finfo.all_info.out.fname.s, Fname1) != 0) {
printf("(%s) Incorrect filename [%s] after case-changing "
@@ -191,7 +192,8 @@ done:
/*
test SMBntrename ops
*/
-static BOOL test_ntrename(struct smbcli_state *cli, TALLOC_CTX *mem_ctx)
+static bool test_ntrename(struct torture_context *tctx,
+ struct smbcli_state *cli)
{
union smb_rename io;
NTSTATUS status;
@@ -209,7 +211,7 @@ static BOOL test_ntrename(struct smbcli_state *cli, TALLOC_CTX *mem_ctx)
printf("Trying simple rename\n");
- fnum = create_complex_file(cli, mem_ctx, fname1);
+ fnum = create_complex_file(cli, tctx, fname1);
io.generic.level = RAW_RENAME_NTRENAME;
io.ntrename.in.old_name = fname1;
@@ -269,13 +271,13 @@ static BOOL test_ntrename(struct smbcli_state *cli, TALLOC_CTX *mem_ctx)
finfo.generic.level = RAW_FILEINFO_ALL_INFO;
finfo.generic.in.file.path = fname2;
- status = smb_raw_pathinfo(cli->tree, mem_ctx, &finfo);
+ status = smb_raw_pathinfo(cli->tree, tctx, &finfo);
CHECK_STATUS(status, NT_STATUS_OK);
CHECK_VALUE(finfo.all_info.out.nlink, 2);
CHECK_VALUE(finfo.all_info.out.attrib, FILE_ATTRIBUTE_SYSTEM);
finfo.generic.in.file.path = fname1;
- status = smb_raw_pathinfo(cli->tree, mem_ctx, &finfo);
+ status = smb_raw_pathinfo(cli->tree, tctx, &finfo);
CHECK_STATUS(status, NT_STATUS_OK);
CHECK_VALUE(finfo.all_info.out.nlink, 2);
CHECK_VALUE(finfo.all_info.out.attrib, FILE_ATTRIBUTE_SYSTEM);
@@ -285,7 +287,7 @@ static BOOL test_ntrename(struct smbcli_state *cli, TALLOC_CTX *mem_ctx)
smbcli_unlink(cli->tree, fname2);
finfo.generic.in.file.path = fname1;
- status = smb_raw_pathinfo(cli->tree, mem_ctx, &finfo);
+ status = smb_raw_pathinfo(cli->tree, tctx, &finfo);
CHECK_STATUS(status, NT_STATUS_OK);
CHECK_VALUE(finfo.all_info.out.nlink, 1);
CHECK_VALUE(finfo.all_info.out.attrib, FILE_ATTRIBUTE_NORMAL);
@@ -300,14 +302,14 @@ static BOOL test_ntrename(struct smbcli_state *cli, TALLOC_CTX *mem_ctx)
finfo.generic.level = RAW_FILEINFO_ALL_INFO;
finfo.generic.in.file.path = fname1;
- status = smb_raw_pathinfo(cli->tree, mem_ctx, &finfo);
+ status = smb_raw_pathinfo(cli->tree, tctx, &finfo);
CHECK_STATUS(status, NT_STATUS_OK);
CHECK_VALUE(finfo.all_info.out.nlink, 1);
CHECK_VALUE(finfo.all_info.out.attrib, FILE_ATTRIBUTE_NORMAL);
finfo.generic.level = RAW_FILEINFO_ALL_INFO;
finfo.generic.in.file.path = fname2;
- status = smb_raw_pathinfo(cli->tree, mem_ctx, &finfo);
+ status = smb_raw_pathinfo(cli->tree, tctx, &finfo);
CHECK_STATUS(status, NT_STATUS_OK);
CHECK_VALUE(finfo.all_info.out.nlink, 1);
CHECK_VALUE(finfo.all_info.out.attrib, FILE_ATTRIBUTE_NORMAL);
@@ -316,13 +318,13 @@ static BOOL test_ntrename(struct smbcli_state *cli, TALLOC_CTX *mem_ctx)
finfo.generic.level = RAW_FILEINFO_ALL_INFO;
finfo.generic.in.file.path = fname2;
- status = smb_raw_pathinfo(cli->tree, mem_ctx, &finfo);
+ status = smb_raw_pathinfo(cli->tree, tctx, &finfo);
CHECK_STATUS(status, NT_STATUS_OK);
CHECK_VALUE(finfo.all_info.out.nlink, 1);
CHECK_VALUE(finfo.all_info.out.attrib, FILE_ATTRIBUTE_NORMAL);
finfo.generic.in.file.path = fname1;
- status = smb_raw_pathinfo(cli->tree, mem_ctx, &finfo);
+ status = smb_raw_pathinfo(cli->tree, tctx, &finfo);
CHECK_STATUS(status, NT_STATUS_OK);
CHECK_VALUE(finfo.all_info.out.nlink, 1);
CHECK_VALUE(finfo.all_info.out.attrib, FILE_ATTRIBUTE_SYSTEM);
@@ -332,7 +334,7 @@ static BOOL test_ntrename(struct smbcli_state *cli, TALLOC_CTX *mem_ctx)
smbcli_unlink(cli->tree, fname2);
finfo.generic.in.file.path = fname1;
- status = smb_raw_pathinfo(cli->tree, mem_ctx, &finfo);
+ status = smb_raw_pathinfo(cli->tree, tctx, &finfo);
CHECK_STATUS(status, NT_STATUS_OK);
CHECK_VALUE(finfo.all_info.out.nlink, 1);
@@ -436,27 +438,12 @@ done:
/*
basic testing of rename calls
*/
-BOOL torture_raw_rename(struct torture_context *torture)
+struct torture_suite *torture_raw_rename(TALLOC_CTX *mem_ctx)
{
- struct smbcli_state *cli;
- BOOL ret = True;
- TALLOC_CTX *mem_ctx;
+ struct torture_suite *suite = torture_suite_create(mem_ctx, "RENAME");
- if (!torture_open_connection(&cli, 0)) {
- return False;
- }
+ torture_suite_add_1smb_test(suite, "mv", test_mv);
+ torture_suite_add_1smb_test(suite, "ntrename", test_ntrename);
- mem_ctx = talloc_init("torture_raw_rename");
-
- if (!test_mv(cli, mem_ctx)) {
- ret = False;
- }
-
- if (!test_ntrename(cli, mem_ctx)) {
- ret = False;
- }
-
- torture_close_connection(cli);
- talloc_free(mem_ctx);
- return ret;
+ return suite;
}
diff --git a/source4/torture/raw/search.c b/source4/torture/raw/search.c
index cd79b4dd3b..986da474d0 100644
--- a/source4/torture/raw/search.c
+++ b/source4/torture/raw/search.c
@@ -43,7 +43,7 @@ static BOOL single_search_callback(void *private, const union smb_search_data *f
do a single file (non-wildcard) search
*/
_PUBLIC_ NTSTATUS torture_single_search(struct smbcli_state *cli,
- TALLOC_CTX *mem_ctx,
+ TALLOC_CTX *tctx,
const char *pattern,
enum smb_search_level level,
enum smb_search_data_level data_level,
@@ -79,7 +79,7 @@ _PUBLIC_ NTSTATUS torture_single_search(struct smbcli_state *cli,
return NT_STATUS_INVALID_LEVEL;
}
- status = smb_raw_search_first(cli->tree, mem_ctx,
+ status = smb_raw_search_first(cli->tree, tctx,
&io, (void *)data, single_search_callback);
if (NT_STATUS_IS_OK(status) && level == RAW_SEARCH_FFIRST) {
@@ -231,7 +231,8 @@ static union smb_search_data *find(const char *name)
/*
basic testing of all RAW_SEARCH_* calls using a single file
*/
-static BOOL test_one_file(struct smbcli_state *cli, TALLOC_CTX *mem_ctx)
+static BOOL test_one_file(struct torture_context *tctx,
+ struct smbcli_state *cli)
{
BOOL ret = True;
int fnum;
@@ -244,7 +245,7 @@ static BOOL test_one_file(struct smbcli_state *cli, TALLOC_CTX *mem_ctx)
printf("Testing one file searches\n");
- fnum = create_complex_file(cli, mem_ctx, fname);
+ fnum = create_complex_file(cli, tctx, fname);
if (fnum == -1) {
printf("ERROR: open of %s failed (%s)\n", fname, smbcli_errstr(cli->tree));
ret = False;
@@ -258,7 +259,7 @@ static BOOL test_one_file(struct smbcli_state *cli, TALLOC_CTX *mem_ctx)
printf("testing %s\n", levels[i].name);
- levels[i].status = torture_single_search(cli, mem_ctx, fname,
+ levels[i].status = torture_single_search(cli, tctx, fname,
levels[i].level,
levels[i].data_level,
0,
@@ -279,7 +280,7 @@ static BOOL test_one_file(struct smbcli_state *cli, TALLOC_CTX *mem_ctx)
continue;
}
- status = torture_single_search(cli, mem_ctx, fname2,
+ status = torture_single_search(cli, tctx, fname2,
levels[i].level,
levels[i].data_level,
0,
@@ -303,7 +304,7 @@ static BOOL test_one_file(struct smbcli_state *cli, TALLOC_CTX *mem_ctx)
/* get the all_info file into to check against */
all_info.generic.level = RAW_FILEINFO_ALL_INFO;
all_info.generic.in.file.path = fname;
- status = smb_raw_pathinfo(cli->tree, mem_ctx, &all_info);
+ status = smb_raw_pathinfo(cli->tree, tctx, &all_info);
if (!NT_STATUS_IS_OK(status)) {
printf("RAW_FILEINFO_ALL_INFO failed - %s\n", nt_errstr(status));
ret = False;
@@ -312,7 +313,7 @@ static BOOL test_one_file(struct smbcli_state *cli, TALLOC_CTX *mem_ctx)
alt_info.generic.level = RAW_FILEINFO_ALT_NAME_INFO;
alt_info.generic.in.file.path = fname;
- status = smb_raw_pathinfo(cli->tree, mem_ctx, &alt_info);
+ status = smb_raw_pathinfo(cli->tree, tctx, &alt_info);
if (!NT_STATUS_IS_OK(status)) {
printf("RAW_FILEINFO_ALT_NAME_INFO failed - %s\n", nt_errstr(status));
ret = False;
@@ -321,7 +322,7 @@ static BOOL test_one_file(struct smbcli_state *cli, TALLOC_CTX *mem_ctx)
internal_info.generic.level = RAW_FILEINFO_INTERNAL_INFORMATION;
internal_info.generic.in.file.path = fname;
- status = smb_raw_pathinfo(cli->tree, mem_ctx, &internal_info);
+ status = smb_raw_pathinfo(cli->tree, tctx, &internal_info);
if (!NT_STATUS_IS_OK(status)) {
printf("RAW_FILEINFO_INTERNAL_INFORMATION failed - %s\n", nt_errstr(status));
ret = False;
@@ -330,7 +331,7 @@ static BOOL test_one_file(struct smbcli_state *cli, TALLOC_CTX *mem_ctx)
name_info.generic.level = RAW_FILEINFO_NAME_INFO;
name_info.generic.in.file.path = fname;
- status = smb_raw_pathinfo(cli->tree, mem_ctx, &name_info);
+ status = smb_raw_pathinfo(cli->tree, tctx, &name_info);
if (!NT_STATUS_IS_OK(status)) {
printf("RAW_FILEINFO_NAME_INFO failed - %s\n", nt_errstr(status));
ret = False;
@@ -355,8 +356,8 @@ static BOOL test_one_file(struct smbcli_state *cli, TALLOC_CTX *mem_ctx)
if (s->sname1.field1 != (~1 & nt_time_to_unix(v.sname2.out.field2))) { \
printf("(%s) %s/%s [%s] != %s/%s [%s]\n", \
__location__, \
- #sname1, #field1, timestring(mem_ctx, s->sname1.field1), \
- #sname2, #field2, nt_time_string(mem_ctx, v.sname2.out.field2)); \
+ #sname1, #field1, timestring(tctx, s->sname1.field1), \
+ #sname2, #field2, nt_time_string(tctx, v.sname2.out.field2)); \
ret = False; \
} \
}} while (0)
@@ -367,8 +368,8 @@ static BOOL test_one_file(struct smbcli_state *cli, TALLOC_CTX *mem_ctx)
if (s->sname1.field1 != v.sname2.out.field2) { \
printf("(%s) %s/%s [%s] != %s/%s [%s]\n", \
__location__, \
- #sname1, #field1, nt_time_string(mem_ctx, s->sname1.field1), \
- #sname2, #field2, nt_time_string(mem_ctx, v.sname2.out.field2)); \
+ #sname1, #field1, nt_time_string(tctx, s->sname1.field1), \
+ #sname2, #field2, nt_time_string(tctx, v.sname2.out.field2)); \
ret = False; \
} \
}} while (0)
@@ -518,7 +519,7 @@ done:
struct multiple_result {
- TALLOC_CTX *mem_ctx;
+ TALLOC_CTX *tctx;
int count;
union smb_search_data *list;
};
@@ -532,7 +533,7 @@ static BOOL multiple_search_callback(void *private, const union smb_search_data
data->count++;
- data->list = talloc_realloc(data->mem_ctx,
+ data->list = talloc_realloc(data->tctx,
data->list,
union smb_search_data,
data->count);
@@ -548,7 +549,7 @@ enum continue_type {CONT_FLAGS, CONT_NAME, CONT_RESUME_KEY};
do a single file (non-wildcard) search
*/
static NTSTATUS multiple_search(struct smbcli_state *cli,
- TALLOC_CTX *mem_ctx,
+ TALLOC_CTX *tctx,
const char *pattern,
enum smb_search_data_level data_level,
enum continue_type cont_type,
@@ -580,7 +581,7 @@ static NTSTATUS multiple_search(struct smbcli_state *cli,
}
}
- status = smb_raw_search_first(cli->tree, mem_ctx,
+ status = smb_raw_search_first(cli->tree, tctx,
&io, data, multiple_search_callback);
@@ -621,7 +622,7 @@ static NTSTATUS multiple_search(struct smbcli_state *cli,
}
}
- status = smb_raw_search_next(cli->tree, mem_ctx,
+ status = smb_raw_search_next(cli->tree, tctx,
&io2, data, multiple_search_callback);
if (!NT_STATUS_IS_OK(status)) {
break;
@@ -686,7 +687,8 @@ static int search_compare(union smb_search_data *d1, union smb_search_data *d2)
/*
basic testing of search calls using many files
*/
-static BOOL test_many_files(struct smbcli_state *cli, TALLOC_CTX *mem_ctx)
+static bool test_many_files(struct torture_context *tctx,
+ struct smbcli_state *cli)
{
const int num_files = 700;
int i, fnum, t;
@@ -745,11 +747,11 @@ static BOOL test_many_files(struct smbcli_state *cli, TALLOC_CTX *mem_ctx)
for (t=0;t<ARRAY_SIZE(search_types);t++) {
ZERO_STRUCT(result);
- result.mem_ctx = talloc_new(mem_ctx);
+ result.tctx = talloc_new(tctx);
printf("Continue %s via %s\n", search_types[t].name, search_types[t].cont_name);
- status = multiple_search(cli, mem_ctx, BASEDIR "\\*.*",
+ status = multiple_search(cli, tctx, BASEDIR "\\*.*",
search_types[t].data_level,
search_types[t].cont_type,
&result);
@@ -785,7 +787,7 @@ static BOOL test_many_files(struct smbcli_state *cli, TALLOC_CTX *mem_ctx)
}
talloc_free(fname);
}
- talloc_free(result.mem_ctx);
+ talloc_free(result.tctx);
}
done:
@@ -831,7 +833,8 @@ static BOOL check_result(struct multiple_result *result, const char *name, BOOL
/*
test what happens when the directory is modified during a search
*/
-static BOOL test_modify_search(struct smbcli_state *cli, TALLOC_CTX *mem_ctx)
+static bool test_modify_search(struct torture_context *tctx,
+ struct smbcli_state *cli)
{
const int num_files = 20;
int i, fnum;
@@ -863,7 +866,7 @@ static BOOL test_modify_search(struct smbcli_state *cli, TALLOC_CTX *mem_ctx)
printf("pulling the first file\n");
ZERO_STRUCT(result);
- result.mem_ctx = talloc_new(mem_ctx);
+ result.tctx = talloc_new(tctx);
io.t2ffirst.level = RAW_SEARCH_TRANS2;
io.t2ffirst.data_level = RAW_SEARCH_DATA_BOTH_DIRECTORY_INFO;
@@ -873,7 +876,7 @@ static BOOL test_modify_search(struct smbcli_state *cli, TALLOC_CTX *mem_ctx)
io.t2ffirst.in.storage_type = 0;
io.t2ffirst.in.pattern = BASEDIR "\\*.*";
- status = smb_raw_search_first(cli->tree, mem_ctx,
+ status = smb_raw_search_first(cli->tree, tctx,
&io, &result, multiple_search_callback);
CHECK_STATUS(status, NT_STATUS_OK);
CHECK_VALUE(result.count, 1);
@@ -887,7 +890,7 @@ static BOOL test_modify_search(struct smbcli_state *cli, TALLOC_CTX *mem_ctx)
io2.t2fnext.in.flags = 0;
io2.t2fnext.in.last_name = result.list[result.count-1].both_directory_info.name.s;
- status = smb_raw_search_next(cli->tree, mem_ctx,
+ status = smb_raw_search_next(cli->tree, tctx,
&io2, &result, multiple_search_callback);
CHECK_STATUS(status, NT_STATUS_OK);
CHECK_VALUE(result.count, 2);
@@ -897,7 +900,7 @@ static BOOL test_modify_search(struct smbcli_state *cli, TALLOC_CTX *mem_ctx)
printf("Changing attributes and deleting\n");
smbcli_open(cli->tree, BASEDIR "\\T003-03.txt.2", O_CREAT|O_RDWR, DENY_NONE);
smbcli_open(cli->tree, BASEDIR "\\T013-13.txt.2", O_CREAT|O_RDWR, DENY_NONE);
- fnum = create_complex_file(cli, mem_ctx, BASEDIR "\\T013-13.txt.3");
+ fnum = create_complex_file(cli, tctx, BASEDIR "\\T013-13.txt.3");
smbcli_unlink(cli->tree, BASEDIR "\\T014-14.txt");
torture_set_file_attribute(cli->tree, BASEDIR "\\T015-15.txt", FILE_ATTRIBUTE_HIDDEN);
torture_set_file_attribute(cli->tree, BASEDIR "\\T016-16.txt", FILE_ATTRIBUTE_NORMAL);
@@ -917,7 +920,7 @@ static BOOL test_modify_search(struct smbcli_state *cli, TALLOC_CTX *mem_ctx)
io2.t2fnext.in.flags = 0;
io2.t2fnext.in.last_name = ".";
- status = smb_raw_search_next(cli->tree, mem_ctx,
+ status = smb_raw_search_next(cli->tree, tctx,
&io2, &result, multiple_search_callback);
CHECK_STATUS(status, NT_STATUS_OK);
CHECK_VALUE(result.count, 20);
@@ -937,7 +940,7 @@ static BOOL test_modify_search(struct smbcli_state *cli, TALLOC_CTX *mem_ctx)
for (i=0;i<result.count;i++) {
printf("%s %s (0x%x)\n",
result.list[i].both_directory_info.name.s,
- attrib_string(mem_ctx, result.list[i].both_directory_info.attrib),
+ attrib_string(tctx, result.list[i].both_directory_info.attrib),
result.list[i].both_directory_info.attrib);
}
}
@@ -953,7 +956,7 @@ done:
/*
testing if directories always come back sorted
*/
-static BOOL test_sorted(struct smbcli_state *cli, TALLOC_CTX *mem_ctx)
+static bool test_sorted(struct torture_context *tctx, struct smbcli_state *cli)
{
const int num_files = 700;
int i, fnum;
@@ -969,7 +972,7 @@ static BOOL test_sorted(struct smbcli_state *cli, TALLOC_CTX *mem_ctx)
printf("Creating %d files\n", num_files);
for (i=0;i<num_files;i++) {
- fname = talloc_asprintf(cli, BASEDIR "\\%s.txt", generate_random_str_list(mem_ctx, 10, "abcdefgh"));
+ fname = talloc_asprintf(cli, BASEDIR "\\%s.txt", generate_random_str_list(tctx, 10, "abcdefgh"));
fnum = smbcli_open(cli->tree, fname, O_CREAT|O_RDWR, DENY_NONE);
if (fnum == -1) {
printf("Failed to create %s - %s\n", fname, smbcli_errstr(cli->tree));
@@ -982,9 +985,9 @@ static BOOL test_sorted(struct smbcli_state *cli, TALLOC_CTX *mem_ctx)
ZERO_STRUCT(result);
- result.mem_ctx = mem_ctx;
+ result.tctx = tctx;
- status = multiple_search(cli, mem_ctx, BASEDIR "\\*.*",
+ status = multiple_search(cli, tctx, BASEDIR "\\*.*",
RAW_SEARCH_DATA_BOTH_DIRECTORY_INFO,
CONT_NAME, &result);
CHECK_STATUS(status, NT_STATUS_OK);
@@ -1016,7 +1019,8 @@ done:
/*
basic testing of many old style search calls using separate dirs
*/
-static BOOL test_many_dirs(struct smbcli_state *cli, TALLOC_CTX *mem_ctx)
+static bool test_many_dirs(struct torture_context *tctx,
+ struct smbcli_state *cli)
{
const int num_dirs = 20;
int i, fnum, n;
@@ -1057,9 +1061,9 @@ static BOOL test_many_dirs(struct smbcli_state *cli, TALLOC_CTX *mem_ctx)
talloc_free(dname);
}
- file = talloc_zero_array(mem_ctx, union smb_search_data, num_dirs);
- file2 = talloc_zero_array(mem_ctx, union smb_search_data, num_dirs);
- file3 = talloc_zero_array(mem_ctx, union smb_search_data, num_dirs);
+ file = talloc_zero_array(tctx, union smb_search_data, num_dirs);
+ file2 = talloc_zero_array(tctx, union smb_search_data, num_dirs);
+ file3 = talloc_zero_array(tctx, union smb_search_data, num_dirs);
printf("Search first on %d dirs\n", num_dirs);
@@ -1069,12 +1073,12 @@ static BOOL test_many_dirs(struct smbcli_state *cli, TALLOC_CTX *mem_ctx)
io.search_first.data_level = RAW_SEARCH_DATA_SEARCH;
io.search_first.in.max_count = 1;
io.search_first.in.search_attrib = 0;
- io.search_first.in.pattern = talloc_asprintf(mem_ctx, BASEDIR "\\d%d\\*.txt", i);
- fname = talloc_asprintf(mem_ctx, "f%d-", i);
+ io.search_first.in.pattern = talloc_asprintf(tctx, BASEDIR "\\d%d\\*.txt", i);
+ fname = talloc_asprintf(tctx, "f%d-", i);
io.search_first.out.count = 0;
- status = smb_raw_search_first(cli->tree, mem_ctx,
+ status = smb_raw_search_first(cli->tree, tctx,
&io, (void *)&file[i], single_search_callback);
if (io.search_first.out.count != 1) {
printf("(%s) search first gave %d entries for dir %d - %s\n",
@@ -1103,11 +1107,11 @@ static BOOL test_many_dirs(struct smbcli_state *cli, TALLOC_CTX *mem_ctx)
io2.search_next.in.max_count = 1;
io2.search_next.in.search_attrib = 0;
io2.search_next.in.id = file[i].search.id;
- fname = talloc_asprintf(mem_ctx, "f%d-", i);
+ fname = talloc_asprintf(tctx, "f%d-", i);
io2.search_next.out.count = 0;
- status = smb_raw_search_next(cli->tree, mem_ctx,
+ status = smb_raw_search_next(cli->tree, tctx,
&io2, (void *)&file2[i], single_search_callback);
if (io2.search_next.out.count != 1) {
printf("(%s) search next gave %d entries for dir %d - %s\n",
@@ -1137,10 +1141,10 @@ static BOOL test_many_dirs(struct smbcli_state *cli, TALLOC_CTX *mem_ctx)
io2.search_next.in.max_count = 1;
io2.search_next.in.search_attrib = 0;
io2.search_next.in.id = file[i].search.id;
- fname = talloc_asprintf(mem_ctx, "f%d-", i);
+ fname = talloc_asprintf(tctx, "f%d-", i);
io2.search_next.out.count = 0;
- status = smb_raw_search_next(cli->tree, mem_ctx,
+ status = smb_raw_search_next(cli->tree, tctx,
&io2, (void *)&file3[i], single_search_callback);
if (io2.search_next.out.count != 1) {
printf("(%s) search next gave %d entries for dir %d - %s\n",
@@ -1179,7 +1183,8 @@ done:
/*
testing of OS/2 style delete
*/
-static BOOL test_os2_delete(struct smbcli_state *cli, TALLOC_CTX *mem_ctx)
+static bool test_os2_delete(struct torture_context *tctx,
+ struct smbcli_state *cli)
{
const int num_files = 700;
const int delete_count = 4;
@@ -1212,7 +1217,7 @@ static BOOL test_os2_delete(struct smbcli_state *cli, TALLOC_CTX *mem_ctx)
ZERO_STRUCT(result);
- result.mem_ctx = mem_ctx;
+ result.tctx = tctx;
io.t2ffirst.level = RAW_SEARCH_TRANS2;
io.t2ffirst.data_level = RAW_SEARCH_DATA_EA_SIZE;
@@ -1222,7 +1227,7 @@ static BOOL test_os2_delete(struct smbcli_state *cli, TALLOC_CTX *mem_ctx)
io.t2ffirst.in.storage_type = 0;
io.t2ffirst.in.pattern = BASEDIR "\\*";
- status = smb_raw_search_first(cli->tree, mem_ctx,
+ status = smb_raw_search_first(cli->tree, tctx,
&io, &result, multiple_search_callback);
CHECK_STATUS(status, NT_STATUS_OK);
@@ -1244,9 +1249,9 @@ static BOOL test_os2_delete(struct smbcli_state *cli, TALLOC_CTX *mem_ctx)
do {
ZERO_STRUCT(result);
- result.mem_ctx = mem_ctx;
+ result.tctx = tctx;
- status = smb_raw_search_next(cli->tree, mem_ctx,
+ status = smb_raw_search_next(cli->tree, tctx,
&io2, &result, multiple_search_callback);
if (!NT_STATUS_IS_OK(status)) {
break;
@@ -1290,7 +1295,8 @@ static int ealist_cmp(union smb_search_data *r1, union smb_search_data *r2)
/*
testing of the rather strange ea_list level
*/
-static BOOL test_ea_list(struct smbcli_state *cli, TALLOC_CTX *mem_ctx)
+static bool test_ea_list(struct torture_context *tctx,
+ struct smbcli_state *cli)
{
int fnum;
BOOL ret = True;
@@ -1318,7 +1324,7 @@ static BOOL test_ea_list(struct smbcli_state *cli, TALLOC_CTX *mem_ctx)
setfile.generic.level = RAW_SFILEINFO_EA_SET;
setfile.generic.in.file.path = BASEDIR "\\file2.txt";
setfile.ea_set.in.num_eas = 2;
- setfile.ea_set.in.eas = talloc_array(mem_ctx, struct ea_struct, 2);
+ setfile.ea_set.in.eas = talloc_array(tctx, struct ea_struct, 2);
setfile.ea_set.in.eas[0].flags = 0;
setfile.ea_set.in.eas[0].name.s = "EA ONE";
setfile.ea_set.in.eas[0].value = data_blob_string_const("VALUE 1");
@@ -1334,7 +1340,7 @@ static BOOL test_ea_list(struct smbcli_state *cli, TALLOC_CTX *mem_ctx)
CHECK_STATUS(status, NT_STATUS_OK);
ZERO_STRUCT(result);
- result.mem_ctx = mem_ctx;
+ result.tctx = tctx;
io.t2ffirst.level = RAW_SEARCH_TRANS2;
io.t2ffirst.data_level = RAW_SEARCH_DATA_EA_LIST;
@@ -1344,11 +1350,11 @@ static BOOL test_ea_list(struct smbcli_state *cli, TALLOC_CTX *mem_ctx)
io.t2ffirst.in.storage_type = 0;
io.t2ffirst.in.pattern = BASEDIR "\\*";
io.t2ffirst.in.num_names = 2;
- io.t2ffirst.in.ea_names = talloc_array(mem_ctx, struct ea_name, 2);
+ io.t2ffirst.in.ea_names = talloc_array(tctx, struct ea_name, 2);
io.t2ffirst.in.ea_names[0].name.s = "SECOND EA";
io.t2ffirst.in.ea_names[1].name.s = "THIRD EA";
- status = smb_raw_search_first(cli->tree, mem_ctx,
+ status = smb_raw_search_first(cli->tree, tctx,
&io, &result, multiple_search_callback);
CHECK_STATUS(status, NT_STATUS_OK);
CHECK_VALUE(result.count, 2);
@@ -1361,11 +1367,11 @@ static BOOL test_ea_list(struct smbcli_state *cli, TALLOC_CTX *mem_ctx)
nxt.t2fnext.in.flags = FLAG_TRANS2_FIND_REQUIRE_RESUME | FLAG_TRANS2_FIND_CONTINUE;
nxt.t2fnext.in.last_name = result.list[1].ea_list.name.s;
nxt.t2fnext.in.num_names = 2;
- nxt.t2fnext.in.ea_names = talloc_array(mem_ctx, struct ea_name, 2);
+ nxt.t2fnext.in.ea_names = talloc_array(tctx, struct ea_name, 2);
nxt.t2fnext.in.ea_names[0].name.s = "SECOND EA";
nxt.t2fnext.in.ea_names[1].name.s = "THIRD EA";
- status = smb_raw_search_next(cli->tree, mem_ctx,
+ status = smb_raw_search_next(cli->tree, tctx,
&nxt, &result, multiple_search_callback);
CHECK_STATUS(status, NT_STATUS_OK);
@@ -1408,28 +1414,17 @@ done:
/*
basic testing of all RAW_SEARCH_* calls using a single file
*/
-BOOL torture_raw_search(struct torture_context *torture)
+struct torture_suite *torture_raw_search(TALLOC_CTX *mem_ctx)
{
- struct smbcli_state *cli;
- BOOL ret = True;
- TALLOC_CTX *mem_ctx;
-
- if (!torture_open_connection(&cli, 0)) {
- return False;
- }
+ struct torture_suite *suite = torture_suite_create(mem_ctx, "SEARCH");
- mem_ctx = talloc_init("torture_search");
+ torture_suite_add_1smb_test(suite, "one file", test_one_file);
+ torture_suite_add_1smb_test(suite, "many files", test_many_files);
+ torture_suite_add_1smb_test(suite, "sorted", test_sorted);
+ torture_suite_add_1smb_test(suite, "modify search", test_modify_search);
+ torture_suite_add_1smb_test(suite, "many dirs", test_many_dirs);
+ torture_suite_add_1smb_test(suite, "os2 delete", test_os2_delete);
+ torture_suite_add_1smb_test(suite, "ea list", test_ea_list);
- ret &= test_one_file(cli, mem_ctx);
- ret &= test_many_files(cli, mem_ctx);
- ret &= test_sorted(cli, mem_ctx);
- ret &= test_modify_search(cli, mem_ctx);
- ret &= test_many_dirs(cli, mem_ctx);
- ret &= test_os2_delete(cli, mem_ctx);
- ret &= test_ea_list(cli, mem_ctx);
-
- torture_close_connection(cli);
- talloc_free(mem_ctx);
-
- return ret;
+ return suite;
}
diff --git a/source4/torture/raw/seek.c b/source4/torture/raw/seek.c
index f9b072b3de..f5413d8b1d 100644
--- a/source4/torture/raw/seek.c
+++ b/source4/torture/raw/seek.c
@@ -233,23 +233,11 @@ done:
/*
basic testing of seek calls
*/
-BOOL torture_raw_seek(struct torture_context *torture)
+bool torture_raw_seek(struct torture_context *torture, struct smbcli_state *cli)
{
- struct smbcli_state *cli;
- BOOL ret = True;
- TALLOC_CTX *mem_ctx;
-
- if (!torture_open_connection(&cli, 0)) {
- return False;
- }
+ bool ret = true;
- mem_ctx = talloc_init("torture_raw_seek");
-
- if (!test_seek(cli, mem_ctx)) {
- ret = False;
- }
+ ret &= test_seek(cli, torture);
- torture_close_connection(cli);
- talloc_free(mem_ctx);
return ret;
}
diff --git a/source4/torture/raw/setfileinfo.c b/source4/torture/raw/setfileinfo.c
index d30637bce8..b06a04753f 100644
--- a/source4/torture/raw/setfileinfo.c
+++ b/source4/torture/raw/setfileinfo.c
@@ -30,11 +30,10 @@
for each call we test that it succeeds, and where possible test
for consistency between the calls.
*/
-BOOL torture_raw_sfileinfo(struct torture_context *torture)
+bool torture_raw_sfileinfo(struct torture_context *torture,
+ struct smbcli_state *cli)
{
- struct smbcli_state *cli;
BOOL ret = True;
- TALLOC_CTX *mem_ctx;
int fnum_saved, d_fnum, fnum2, fnum = -1;
char *fnum_fname;
char *fnum_fname_new;
@@ -53,19 +52,13 @@ BOOL torture_raw_sfileinfo(struct torture_context *torture)
asprintf(&fnum_fname, BASEDIR "\\fnum_test_%d.txt", n);
asprintf(&fnum_fname_new, BASEDIR "\\fnum_test_new_%d.txt", n);
- if (!torture_open_connection(&cli, 0)) {
- return False;
- }
-
- mem_ctx = talloc_init("torture_sfileinfo");
-
if (!torture_setup_dir(cli, BASEDIR)) {
return False;
}
#define RECREATE_FILE(fname) do { \
if (fnum != -1) smbcli_close(cli->tree, fnum); \
- fnum = create_complex_file(cli, mem_ctx, fname); \
+ fnum = create_complex_file(cli, torture, fname); \
if (fnum == -1) { \
printf("(%s) ERROR: open of %s failed (%s)\n", \
__location__, fname, smbcli_errstr(cli->tree)); \
@@ -94,7 +87,7 @@ BOOL torture_raw_sfileinfo(struct torture_context *torture)
} \
finfo1.generic.level = RAW_FILEINFO_ALL_INFO; \
finfo1.generic.in.file.fnum = fnum; \
- status2 = smb_raw_fileinfo(cli->tree, mem_ctx, &finfo1); \
+ status2 = smb_raw_fileinfo(cli->tree, torture, &finfo1); \
if (!NT_STATUS_IS_OK(status2)) { \
printf("(%s) %s pathinfo - %s\n", __location__, #call, nt_errstr(status)); \
ret = False; \
@@ -117,10 +110,10 @@ BOOL torture_raw_sfileinfo(struct torture_context *torture)
} \
finfo1.generic.level = RAW_FILEINFO_ALL_INFO; \
finfo1.generic.in.file.path = path_fname; \
- status2 = smb_raw_pathinfo(cli->tree, mem_ctx, &finfo1); \
+ status2 = smb_raw_pathinfo(cli->tree, torture, &finfo1); \
if (NT_STATUS_EQUAL(status2, NT_STATUS_OBJECT_NAME_NOT_FOUND)) { \
finfo1.generic.in.file.path = path_fname_new; \
- status2 = smb_raw_pathinfo(cli->tree, mem_ctx, &finfo1); \
+ status2 = smb_raw_pathinfo(cli->tree, torture, &finfo1); \
} \
if (!NT_STATUS_IS_OK(status2)) { \
printf("(%s) %s pathinfo - %s\n", __location__, #call, nt_errstr(status2)); \
@@ -132,13 +125,13 @@ BOOL torture_raw_sfileinfo(struct torture_context *torture)
finfo2.generic.level = RAW_FILEINFO_ ## call; \
if (check_fnum) { \
finfo2.generic.in.file.fnum = fnum; \
- status2 = smb_raw_fileinfo(cli->tree, mem_ctx, &finfo2); \
+ status2 = smb_raw_fileinfo(cli->tree, torture, &finfo2); \
} else { \
finfo2.generic.in.file.path = path_fname; \
- status2 = smb_raw_pathinfo(cli->tree, mem_ctx, &finfo2); \
+ status2 = smb_raw_pathinfo(cli->tree, torture, &finfo2); \
if (NT_STATUS_EQUAL(status2, NT_STATUS_OBJECT_NAME_NOT_FOUND)) { \
finfo2.generic.in.file.path = path_fname_new; \
- status2 = smb_raw_pathinfo(cli->tree, mem_ctx, &finfo2); \
+ status2 = smb_raw_pathinfo(cli->tree, torture, &finfo2); \
} \
} \
if (!NT_STATUS_IS_OK(status2)) { \
@@ -153,7 +146,7 @@ BOOL torture_raw_sfileinfo(struct torture_context *torture)
printf("(%s) %s - %s/%s should be 0x%x - 0x%x\n", __location__, \
call_name, #stype, #field, \
(uint_t)value, (uint_t)finfo2.stype.out.field); \
- dump_all_info(mem_ctx, &finfo1); \
+ dump_all_info(torture, &finfo1); \
ret = False; \
}} while (0)
@@ -164,9 +157,9 @@ BOOL torture_raw_sfileinfo(struct torture_context *torture)
call_name, #stype, #field, \
(uint_t)value, \
(uint_t)nt_time_to_unix(finfo2.stype.out.field)); \
- printf("\t%s", timestring(mem_ctx, value)); \
- printf("\t%s\n", nt_time_string(mem_ctx, finfo2.stype.out.field)); \
- dump_all_info(mem_ctx, &finfo1); \
+ printf("\t%s", timestring(torture, value)); \
+ printf("\t%s\n", nt_time_string(torture, finfo2.stype.out.field)); \
+ dump_all_info(torture, &finfo1); \
ret = False; \
}} while (0)
@@ -177,7 +170,7 @@ BOOL torture_raw_sfileinfo(struct torture_context *torture)
call_name, #stype, #field, \
value, \
finfo2.stype.out.field); \
- dump_all_info(mem_ctx, &finfo1); \
+ dump_all_info(torture, &finfo1); \
ret = False; \
}} while (0)
@@ -444,19 +437,16 @@ done:
printf("Failed to delete %s - %s\n", path_fname, smbcli_errstr(cli->tree));
}
- torture_close_connection(cli);
- talloc_free(mem_ctx);
return ret;
}
/*
* basic testing of all RAW_SFILEINFO_RENAME call
*/
-BOOL torture_raw_sfileinfo_rename(struct torture_context *torture)
+bool torture_raw_sfileinfo_rename(struct torture_context *torture,
+ struct smbcli_state *cli)
{
- struct smbcli_state *cli;
BOOL ret = True;
- TALLOC_CTX *mem_ctx;
int fnum_saved, d_fnum, fnum2, fnum = -1;
char *fnum_fname;
char *fnum_fname_new;
@@ -474,12 +464,6 @@ BOOL torture_raw_sfileinfo_rename(struct torture_context *torture)
asprintf(&fnum_fname, BASEDIR "\\fnum_test_%d.txt", n);
asprintf(&fnum_fname_new, BASEDIR "\\fnum_test_new_%d.txt", n);
- if (!torture_open_connection(&cli, 0)) {
- return False;
- }
-
- mem_ctx = talloc_init("torture_sfileinfo");
-
if (!torture_setup_dir(cli, BASEDIR)) {
return False;
}
@@ -488,8 +472,8 @@ BOOL torture_raw_sfileinfo_rename(struct torture_context *torture)
ZERO_STRUCT(sfinfo);
- smbcli_close(cli->tree, create_complex_file(cli, mem_ctx, fnum_fname_new));
- smbcli_close(cli->tree, create_complex_file(cli, mem_ctx, path_fname_new));
+ smbcli_close(cli->tree, create_complex_file(cli, torture, fnum_fname_new));
+ smbcli_close(cli->tree, create_complex_file(cli, torture, path_fname_new));
sfinfo.rename_information.in.overwrite = 0;
sfinfo.rename_information.in.root_fid = 0;
@@ -509,7 +493,7 @@ BOOL torture_raw_sfileinfo_rename(struct torture_context *torture)
CHECK_STR(NAME_INFO, name_info, fname.s, fnum_fname_new);
printf("Trying rename with dest file open\n");
- fnum2 = create_complex_file(cli, mem_ctx, fnum_fname);
+ fnum2 = create_complex_file(cli, torture, fnum_fname);
sfinfo.rename_information.in.new_name = fnum_fname+strlen(BASEDIR)+1;
sfinfo.rename_information.in.overwrite = 1;
CHECK_CALL_FNUM(RENAME_INFORMATION, NT_STATUS_ACCESS_DENIED);
@@ -536,7 +520,7 @@ BOOL torture_raw_sfileinfo_rename(struct torture_context *torture)
CHECK_CALL_FNUM(RENAME_INFORMATION, NT_STATUS_OK);
CHECK_STR(NAME_INFO, name_info, fname.s, fnum_fname);
- fnum2 = create_complex_file(cli, mem_ctx, fnum_fname);
+ fnum2 = create_complex_file(cli, torture, fnum_fname);
sfinfo.rename_information.in.new_name = fnum_fname_new+strlen(BASEDIR)+1;
sfinfo.rename_information.in.overwrite = 0;
CHECK_CALL_FNUM(RENAME_INFORMATION, NT_STATUS_OK);
@@ -579,35 +563,25 @@ done:
printf("Failed to delete %s - %s\n", path_fname, smbcli_errstr(cli->tree));
}
- torture_close_connection(cli);
- talloc_free(mem_ctx);
return ret;
}
/*
look for the w2k3 setpathinfo STANDARD bug
*/
-BOOL torture_raw_sfileinfo_bug(struct torture_context *torture)
+bool torture_raw_sfileinfo_bug(struct torture_context *torture,
+ struct smbcli_state *cli)
{
- struct smbcli_state *cli;
- TALLOC_CTX *mem_ctx;
const char *fname = "\\bug3.txt";
union smb_setfileinfo sfinfo;
NTSTATUS status;
int fnum;
- if (!torture_setting_bool(torture, "dangerous", False)) {
- printf("torture_raw_sfileinfo_bug disabled - enable dangerous tests to use\n");
- return True;
- }
-
- if (!torture_open_connection(&cli, 0)) {
- return False;
- }
-
- mem_ctx = talloc_init("torture_sfileinfo");
+ if (!torture_setting_bool(torture, "dangerous", false))
+ torture_skip(torture,
+ "torture_raw_sfileinfo_bug disabled - enable dangerous tests to use\n");
- fnum = create_complex_file(cli, mem_ctx, fname);
+ fnum = create_complex_file(cli, torture, fname);
smbcli_close(cli->tree, fnum);
sfinfo.generic.level = RAW_SFILEINFO_STANDARD;
diff --git a/source4/torture/raw/streams.c b/source4/torture/raw/streams.c
index b52d84f772..24428efcf7 100644
--- a/source4/torture/raw/streams.c
+++ b/source4/torture/raw/streams.c
@@ -213,28 +213,19 @@ done:
/*
basic testing of streams calls
*/
-BOOL torture_raw_streams(struct torture_context *torture)
+bool torture_raw_streams(struct torture_context *torture,
+ struct smbcli_state *cli)
{
- struct smbcli_state *cli;
BOOL ret = True;
- TALLOC_CTX *mem_ctx;
-
- if (!torture_open_connection(&cli, 0)) {
- return False;
- }
-
- mem_ctx = talloc_init("torture_raw_streams");
if (!torture_setup_dir(cli, BASEDIR)) {
return False;
}
- ret &= test_stream_io(cli, mem_ctx);
+ ret &= test_stream_io(cli, torture);
smb_raw_exit(cli->session);
smbcli_deltree(cli->tree, BASEDIR);
- torture_close_connection(cli);
- talloc_free(mem_ctx);
return ret;
}
diff --git a/source4/torture/raw/unlink.c b/source4/torture/raw/unlink.c
index 3e4580d2d3..c307b14e08 100644
--- a/source4/torture/raw/unlink.c
+++ b/source4/torture/raw/unlink.c
@@ -37,7 +37,7 @@
/*
test unlink ops
*/
-static BOOL test_unlink(struct smbcli_state *cli, TALLOC_CTX *mem_ctx)
+static bool test_unlink(struct torture_context *tctx, struct smbcli_state *cli)
{
union smb_unlink io;
NTSTATUS status;
@@ -199,7 +199,8 @@ done:
/*
test delete on close
*/
-static BOOL test_delete_on_close(struct smbcli_state *cli, TALLOC_CTX *mem_ctx)
+static bool test_delete_on_close(struct torture_context *tctx,
+ struct smbcli_state *cli)
{
union smb_open op;
union smb_unlink io;
@@ -224,7 +225,7 @@ static BOOL test_delete_on_close(struct smbcli_state *cli, TALLOC_CTX *mem_ctx)
CHECK_STATUS(status, NT_STATUS_OBJECT_NAME_NOT_FOUND);
printf("Testing with delete_on_close 0\n");
- fnum = create_complex_file(cli, mem_ctx, fname);
+ fnum = create_complex_file(cli, tctx, fname);
sfinfo.disposition_info.level = RAW_SFILEINFO_DISPOSITION_INFO;
sfinfo.disposition_info.in.file.fnum = fnum;
@@ -238,7 +239,7 @@ static BOOL test_delete_on_close(struct smbcli_state *cli, TALLOC_CTX *mem_ctx)
CHECK_STATUS(status, NT_STATUS_OK);
printf("Testing with delete_on_close 1\n");
- fnum = create_complex_file(cli, mem_ctx, fname);
+ fnum = create_complex_file(cli, tctx, fname);
sfinfo.disposition_info.in.file.fnum = fnum;
sfinfo.disposition_info.in.delete_on_close = 1;
status = smb_raw_setfileinfo(cli->tree, &sfinfo);
@@ -290,7 +291,7 @@ static BOOL test_delete_on_close(struct smbcli_state *cli, TALLOC_CTX *mem_ctx)
status = create_directory_handle(cli->tree, dname, &fnum);
CHECK_STATUS(status, NT_STATUS_OK);
- fnum2 = create_complex_file(cli, mem_ctx, inside);
+ fnum2 = create_complex_file(cli, tctx, inside);
sfinfo.disposition_info.in.file.fnum = fnum;
sfinfo.disposition_info.in.delete_on_close = 1;
@@ -321,7 +322,7 @@ static BOOL test_delete_on_close(struct smbcli_state *cli, TALLOC_CTX *mem_ctx)
CHECK_STATUS(status, NT_STATUS_OK);
smbcli_close(cli->tree, fnum);
- fnum2 = create_complex_file(cli, mem_ctx, inside);
+ fnum2 = create_complex_file(cli, tctx, inside);
smbcli_close(cli->tree, fnum2);
op.generic.level = RAW_OPEN_NTCREATEX;
@@ -337,7 +338,7 @@ static BOOL test_delete_on_close(struct smbcli_state *cli, TALLOC_CTX *mem_ctx)
op.ntcreatex.in.security_flags = 0;
op.ntcreatex.in.fname = dname;
- status = smb_raw_open(cli->tree, mem_ctx, &op);
+ status = smb_raw_open(cli->tree, tctx, &op);
CHECK_STATUS(status, NT_STATUS_OK);
fnum = op.ntcreatex.out.file.fnum;
@@ -353,7 +354,7 @@ static BOOL test_delete_on_close(struct smbcli_state *cli, TALLOC_CTX *mem_ctx)
CHECK_STATUS(status, NT_STATUS_OK);
smbcli_close(cli->tree, fnum);
- fnum2 = create_complex_file(cli, mem_ctx, inside);
+ fnum2 = create_complex_file(cli, tctx, inside);
smbcli_close(cli->tree, fnum2);
op.generic.level = RAW_OPEN_NTCREATEX;
@@ -369,7 +370,7 @@ static BOOL test_delete_on_close(struct smbcli_state *cli, TALLOC_CTX *mem_ctx)
op.ntcreatex.in.security_flags = 0;
op.ntcreatex.in.fname = dname;
- status = smb_raw_open(cli->tree, mem_ctx, &op);
+ status = smb_raw_open(cli->tree, tctx, &op);
CHECK_STATUS(status, NT_STATUS_OK);
fnum2 = op.ntcreatex.out.file.fnum;
@@ -386,7 +387,7 @@ static BOOL test_delete_on_close(struct smbcli_state *cli, TALLOC_CTX *mem_ctx)
smbcli_close(cli->tree, fnum);
- fnum = create_complex_file(cli, mem_ctx, inside);
+ fnum = create_complex_file(cli, tctx, inside);
smbcli_close(cli->tree, fnum);
/* we have a dir with a file in it, no handles open */
@@ -404,13 +405,13 @@ static BOOL test_delete_on_close(struct smbcli_state *cli, TALLOC_CTX *mem_ctx)
op.ntcreatex.in.security_flags = 0;
op.ntcreatex.in.fname = dname;
- status = smb_raw_open(cli->tree, mem_ctx, &op);
+ status = smb_raw_open(cli->tree, tctx, &op);
CHECK_STATUS(status, NT_STATUS_OK);
fnum = op.ntcreatex.out.file.fnum;
/* open without delete on close */
op.ntcreatex.in.create_options = NTCREATEX_OPTIONS_DIRECTORY;
- status = smb_raw_open(cli->tree, mem_ctx, &op);
+ status = smb_raw_open(cli->tree, tctx, &op);
CHECK_STATUS(status, NT_STATUS_OK);
fnum2 = op.ntcreatex.out.file.fnum;
@@ -436,22 +437,13 @@ done:
/*
basic testing of unlink calls
*/
-BOOL torture_raw_unlink(struct torture_context *torture)
+struct torture_suite *torture_raw_unlink(TALLOC_CTX *mem_ctx)
{
- struct smbcli_state *cli;
- BOOL ret = True;
- TALLOC_CTX *mem_ctx;
-
- if (!torture_open_connection(&cli, 0)) {
- return False;
- }
-
- mem_ctx = talloc_init("torture_raw_unlink");
+ struct torture_suite *suite = torture_suite_create(mem_ctx,
+ "UNLINK");
- ret &= test_unlink(cli, mem_ctx);
- ret &= test_delete_on_close(cli, mem_ctx);
+ torture_suite_add_1smb_test(suite, "unlink", test_unlink);
+ torture_suite_add_1smb_test(suite, "delete_on_close", test_delete_on_close);
- torture_close_connection(cli);
- talloc_free(mem_ctx);
- return ret;
+ return suite;
}
diff --git a/source4/torture/raw/write.c b/source4/torture/raw/write.c
index 9b043bfe2c..75d275fc3c 100644
--- a/source4/torture/raw/write.c
+++ b/source4/torture/raw/write.c
@@ -51,12 +51,12 @@
#define CHECK_ALL_INFO(v, field) do { \
finfo.all_info.level = RAW_FILEINFO_ALL_INFO; \
finfo.all_info.in.file.path = fname; \
- status = smb_raw_pathinfo(cli->tree, mem_ctx, &finfo); \
+ status = smb_raw_pathinfo(cli->tree, tctx, &finfo); \
CHECK_STATUS(status, NT_STATUS_OK); \
if ((v) != finfo.all_info.out.field) { \
printf("(%s) wrong value for field %s %.0f - %.0f\n", \
__location__, #field, (double)v, (double)finfo.all_info.out.field); \
- dump_all_info(mem_ctx, &finfo); \
+ dump_all_info(tctx, &finfo); \
ret = False; \
}} while (0)
@@ -95,7 +95,8 @@ static BOOL check_buffer(uint8_t *buf, uint_t seed, int len, const char *locatio
/*
test write ops
*/
-static BOOL test_write(struct smbcli_state *cli, TALLOC_CTX *mem_ctx)
+static bool test_write(struct torture_context *tctx,
+ struct smbcli_state *cli)
{
union smb_write io;
NTSTATUS status;
@@ -107,7 +108,7 @@ static BOOL test_write(struct smbcli_state *cli, TALLOC_CTX *mem_ctx)
uint_t seed = time(NULL);
union smb_fileinfo finfo;
- buf = talloc_zero_size(mem_ctx, maxsize);
+ buf = talloc_zero_size(tctx, maxsize);
if (!torture_setup_dir(cli, BASEDIR)) {
return False;
@@ -222,7 +223,8 @@ done:
/*
test writex ops
*/
-static BOOL test_writex(struct smbcli_state *cli, TALLOC_CTX *mem_ctx)
+static bool test_writex(struct torture_context *tctx,
+ struct smbcli_state *cli)
{
union smb_write io;
NTSTATUS status;
@@ -240,7 +242,7 @@ static BOOL test_writex(struct smbcli_state *cli, TALLOC_CTX *mem_ctx)
printf("dangerous not set - limiting range of test to 2^%d\n", max_bits);
}
- buf = talloc_zero_size(mem_ctx, maxsize);
+ buf = talloc_zero_size(tctx, maxsize);
if (!torture_setup_dir(cli, BASEDIR)) {
return False;
@@ -409,7 +411,8 @@ done:
/*
test write unlock ops
*/
-static BOOL test_writeunlock(struct smbcli_state *cli, TALLOC_CTX *mem_ctx)
+static bool test_writeunlock(struct torture_context *tctx,
+ struct smbcli_state *cli)
{
union smb_write io;
NTSTATUS status;
@@ -421,7 +424,7 @@ static BOOL test_writeunlock(struct smbcli_state *cli, TALLOC_CTX *mem_ctx)
uint_t seed = time(NULL);
union smb_fileinfo finfo;
- buf = talloc_zero_size(mem_ctx, maxsize);
+ buf = talloc_zero_size(tctx, maxsize);
if (!torture_setup_dir(cli, BASEDIR)) {
return False;
@@ -551,7 +554,8 @@ done:
/*
test write close ops
*/
-static BOOL test_writeclose(struct smbcli_state *cli, TALLOC_CTX *mem_ctx)
+static bool test_writeclose(struct torture_context *tctx,
+ struct smbcli_state *cli)
{
union smb_write io;
NTSTATUS status;
@@ -563,7 +567,7 @@ static BOOL test_writeclose(struct smbcli_state *cli, TALLOC_CTX *mem_ctx)
uint_t seed = time(NULL);
union smb_fileinfo finfo;
- buf = talloc_zero_size(mem_ctx, maxsize);
+ buf = talloc_zero_size(tctx, maxsize);
if (!torture_setup_dir(cli, BASEDIR)) {
return False;
@@ -706,24 +710,14 @@ done:
/*
basic testing of write calls
*/
-BOOL torture_raw_write(struct torture_context *torture)
+struct torture_suite *torture_raw_write(TALLOC_CTX *mem_ctx)
{
- struct smbcli_state *cli;
- BOOL ret = True;
- TALLOC_CTX *mem_ctx;
-
- if (!torture_open_connection(&cli, 0)) {
- return False;
- }
-
- mem_ctx = talloc_init("torture_raw_write");
+ struct torture_suite *suite = torture_suite_create(mem_ctx, "WRITE");
- ret &= test_write(cli, mem_ctx);
- ret &= test_writeunlock(cli, mem_ctx);
- ret &= test_writeclose(cli, mem_ctx);
- ret &= test_writex(cli, mem_ctx);
+ torture_suite_add_1smb_test(suite, "write", test_write);
+ torture_suite_add_1smb_test(suite, "write unlock", test_writeunlock);
+ torture_suite_add_1smb_test(suite, "write close", test_writeclose);
+ torture_suite_add_1smb_test(suite, "writex", test_writex);
- torture_close_connection(cli);
- talloc_free(mem_ctx);
- return ret;
+ return suite;
}
diff --git a/source4/torture/rpc/alter_context.c b/source4/torture/rpc/alter_context.c
index 140d52c746..d55a0eedc9 100644
--- a/source4/torture/rpc/alter_context.c
+++ b/source4/torture/rpc/alter_context.c
@@ -40,7 +40,7 @@ BOOL torture_rpc_alter_context(struct torture_context *torture)
mem_ctx = talloc_init("torture_rpc_alter_context");
printf("opening LSA connection\n");
- status = torture_rpc_connection(mem_ctx, &p, &ndr_table_lsarpc);
+ status = torture_rpc_connection(torture, &p, &ndr_table_lsarpc);
if (!NT_STATUS_IS_OK(status)) {
talloc_free(mem_ctx);
return False;
diff --git a/source4/torture/rpc/bench.c b/source4/torture/rpc/bench.c
index 6e3ee1c421..48fd0609f0 100644
--- a/source4/torture/rpc/bench.c
+++ b/source4/torture/rpc/bench.c
@@ -103,7 +103,7 @@ BOOL torture_bench_rpc(struct torture_context *torture)
mem_ctx = talloc_init("torture_rpc_srvsvc");
- status = torture_rpc_connection(mem_ctx,
+ status = torture_rpc_connection(torture,
&p,
&ndr_table_srvsvc);
if (!NT_STATUS_IS_OK(status)) {
diff --git a/source4/torture/rpc/bind.c b/source4/torture/rpc/bind.c
index 71d3489ca4..33885573e6 100644
--- a/source4/torture/rpc/bind.c
+++ b/source4/torture/rpc/bind.c
@@ -59,7 +59,7 @@ BOOL torture_multi_bind(struct torture_context *torture)
return False;
}
- status = torture_rpc_connection(mem_ctx, &p, &ndr_table_lsarpc);
+ status = torture_rpc_connection(torture, &p, &ndr_table_lsarpc);
if (!NT_STATUS_IS_OK(status)) {
talloc_free(mem_ctx);
diff --git a/source4/torture/rpc/dcom.c b/source4/torture/rpc/dcom.c
deleted file mode 100644
index 38092a8d37..0000000000
--- a/source4/torture/rpc/dcom.c
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
- Unix SMB/CIFS implementation.
- test suite for dcom operations
-
- Copyright (C) Jelmer Vernooij 2004
-
- 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
- the Free Software Foundation; either version 3 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program. If not, see <http://www.gnu.org/licenses/>.
-*/
-
-#include "includes.h"
-#include "torture/torture.h"
-#include "torture/rpc/rpc.h"
-#include "librpc/gen_ndr/ndr_oxidresolver.h"
-
-BOOL torture_rpc_dcom(void)
-{
- NTSTATUS status;
- struct dcerpc_pipe *p;
- TALLOC_CTX *mem_ctx;
- BOOL ret = True;
-
- mem_ctx = talloc_init("torture_rpc_dcom");
-
- status = torture_rpc_connection(mem_ctx, &p, &ndr_table_IOXIDResolver);
- if (!NT_STATUS_IS_OK(status)) {
- ret = False;
- }
-
- printf("\n");
-
- talloc_free(mem_ctx);
- return ret;
-}
diff --git a/source4/torture/rpc/drsuapi.c b/source4/torture/rpc/drsuapi.c
index 5e4ac3321f..606240993f 100644
--- a/source4/torture/rpc/drsuapi.c
+++ b/source4/torture/rpc/drsuapi.c
@@ -749,7 +749,7 @@ BOOL torture_rpc_drsuapi(struct torture_context *torture)
return False;
}
- status = torture_rpc_connection(mem_ctx,
+ status = torture_rpc_connection(torture,
&p,
&ndr_table_drsuapi);
if (!NT_STATUS_IS_OK(status)) {
@@ -809,7 +809,7 @@ BOOL torture_rpc_drsuapi_cracknames(struct torture_context *torture)
return False;
}
- status = torture_rpc_connection(mem_ctx,
+ status = torture_rpc_connection(torture,
&p,
&ndr_table_drsuapi);
if (!NT_STATUS_IS_OK(status)) {
diff --git a/source4/torture/rpc/dssetup.c b/source4/torture/rpc/dssetup.c
index 4d90b242c4..c80e37eb7d 100644
--- a/source4/torture/rpc/dssetup.c
+++ b/source4/torture/rpc/dssetup.c
@@ -65,7 +65,7 @@ BOOL torture_rpc_dssetup(struct torture_context *torture)
mem_ctx = talloc_init("torture_rpc_dssetup");
- status = torture_rpc_connection(mem_ctx, &p, &ndr_table_dssetup);
+ status = torture_rpc_connection(torture, &p, &ndr_table_dssetup);
if (!NT_STATUS_IS_OK(status)) {
talloc_free(mem_ctx);
diff --git a/source4/torture/rpc/epmapper.c b/source4/torture/rpc/epmapper.c
index b4e5b97679..3f9de22721 100644
--- a/source4/torture/rpc/epmapper.c
+++ b/source4/torture/rpc/epmapper.c
@@ -283,7 +283,7 @@ BOOL torture_rpc_epmapper(struct torture_context *torture)
mem_ctx = talloc_init("torture_rpc_epmapper");
- status = torture_rpc_connection(mem_ctx, &p, &ndr_table_epmapper);
+ status = torture_rpc_connection(torture, &p, &ndr_table_epmapper);
if (!NT_STATUS_IS_OK(status)) {
talloc_free(mem_ctx);
return False;
diff --git a/source4/torture/rpc/handles.c b/source4/torture/rpc/handles.c
index f8cd1cd488..5b6082f7dd 100644
--- a/source4/torture/rpc/handles.c
+++ b/source4/torture/rpc/handles.c
@@ -45,10 +45,10 @@ static bool test_handles_lsa(struct torture_context *torture)
torture_comment(torture, "RPC-HANDLE-LSARPC\n");
- status = torture_rpc_connection(mem_ctx, &p1, &ndr_table_lsarpc);
+ status = torture_rpc_connection(torture, &p1, &ndr_table_lsarpc);
torture_assert_ntstatus_ok(torture, status, "opening lsa pipe1");
- status = torture_rpc_connection(mem_ctx, &p2, &ndr_table_lsarpc);
+ status = torture_rpc_connection(torture, &p2, &ndr_table_lsarpc);
torture_assert_ntstatus_ok(torture, status, "opening lsa pipe1");
qos.len = 0;
@@ -122,7 +122,7 @@ static bool test_handles_lsa_shared(struct torture_context *torture)
}
torture_comment(torture, "connect lsa pipe1\n");
- status = torture_rpc_connection(mem_ctx, &p1, &ndr_table_lsarpc);
+ status = torture_rpc_connection(torture, &p1, &ndr_table_lsarpc);
torture_assert_ntstatus_ok(torture, status, "opening lsa pipe1");
transport = p1->conn->transport.transport,
@@ -131,7 +131,7 @@ static bool test_handles_lsa_shared(struct torture_context *torture)
torture_comment(torture, "use assoc_group_id[0x%08X] for new connections\n", assoc_group_id);
torture_comment(torture, "connect lsa pipe2\n");
- status = torture_rpc_connection_transport(mem_ctx, &p2, &ndr_table_lsarpc,
+ status = torture_rpc_connection_transport(torture, &p2, &ndr_table_lsarpc,
transport,
assoc_group_id);
torture_assert_ntstatus_ok(torture, status, "opening lsa pipe2");
@@ -165,7 +165,7 @@ static bool test_handles_lsa_shared(struct torture_context *torture)
* connect p3 after the policy handle is opened
*/
torture_comment(torture, "connect lsa pipe3 after the policy handle is opened\n");
- status = torture_rpc_connection_transport(mem_ctx, &p3, &ndr_table_lsarpc,
+ status = torture_rpc_connection_transport(torture, &p3, &ndr_table_lsarpc,
transport,
assoc_group_id);
torture_assert_ntstatus_ok(torture, status, "opening lsa pipe3");
@@ -301,7 +301,7 @@ static bool test_handles_lsa_shared(struct torture_context *torture)
* and use the handle on it
*/
torture_comment(torture, "connect lsa pipe4 and use policy handle\n");
- status = torture_rpc_connection_transport(mem_ctx, &p4, &ndr_table_lsarpc,
+ status = torture_rpc_connection_transport(torture, &p4, &ndr_table_lsarpc,
transport,
assoc_group_id);
torture_assert_ntstatus_ok(torture, status, "opening lsa pipe4");
@@ -324,7 +324,7 @@ static bool test_handles_lsa_shared(struct torture_context *torture)
* now open p5
*/
torture_comment(torture, "connect lsa pipe5 - should fail\n");
- status = torture_rpc_connection_transport(mem_ctx, &p5, &ndr_table_lsarpc,
+ status = torture_rpc_connection_transport(torture, &p5, &ndr_table_lsarpc,
transport,
assoc_group_id);
torture_assert_ntstatus_equal(torture, status, NT_STATUS_UNSUCCESSFUL,
@@ -348,10 +348,10 @@ static bool test_handles_samr(struct torture_context *torture)
torture_comment(torture, "RPC-HANDLE-SAMR\n");
- status = torture_rpc_connection(mem_ctx, &p1, &ndr_table_samr);
+ status = torture_rpc_connection(torture, &p1, &ndr_table_samr);
torture_assert_ntstatus_ok(torture, status, "opening samr pipe1");
- status = torture_rpc_connection(mem_ctx, &p2, &ndr_table_samr);
+ status = torture_rpc_connection(torture, &p2, &ndr_table_samr);
torture_assert_ntstatus_ok(torture, status, "opening samr pipe1");
r.in.system_name = 0;
@@ -405,7 +405,7 @@ static bool test_handles_mixed_shared(struct torture_context *torture)
}
torture_comment(torture, "connect samr pipe1\n");
- status = torture_rpc_connection(mem_ctx, &p1, &ndr_table_samr);
+ status = torture_rpc_connection(torture, &p1, &ndr_table_samr);
torture_assert_ntstatus_ok(torture, status, "opening samr pipe1");
transport = p1->conn->transport.transport,
@@ -414,7 +414,7 @@ static bool test_handles_mixed_shared(struct torture_context *torture)
torture_comment(torture, "use assoc_group_id[0x%08X] for new connections\n", assoc_group_id);
torture_comment(torture, "connect lsa pipe2\n");
- status = torture_rpc_connection_transport(mem_ctx, &p2, &ndr_table_lsarpc,
+ status = torture_rpc_connection_transport(torture, &p2, &ndr_table_lsarpc,
transport,
assoc_group_id);
torture_assert_ntstatus_ok(torture, status, "opening lsa pipe2");
@@ -448,28 +448,28 @@ static bool test_handles_mixed_shared(struct torture_context *torture)
msleep(10);
torture_comment(torture, "connect samr pipe3 - should fail\n");
- status = torture_rpc_connection_transport(mem_ctx, &p3, &ndr_table_samr,
+ status = torture_rpc_connection_transport(torture, &p3, &ndr_table_samr,
transport,
assoc_group_id);
torture_assert_ntstatus_equal(torture, status, NT_STATUS_UNSUCCESSFUL,
"opening samr pipe3");
torture_comment(torture, "connect lsa pipe4 - should fail\n");
- status = torture_rpc_connection_transport(mem_ctx, &p4, &ndr_table_lsarpc,
+ status = torture_rpc_connection_transport(torture, &p4, &ndr_table_lsarpc,
transport,
assoc_group_id);
torture_assert_ntstatus_equal(torture, status, NT_STATUS_UNSUCCESSFUL,
"opening lsa pipe4");
torture_comment(torture, "connect samr pipe5 with assoc_group_id[0x%08X]- should fail\n", ++assoc_group_id);
- status = torture_rpc_connection_transport(mem_ctx, &p5, &ndr_table_samr,
+ status = torture_rpc_connection_transport(torture, &p5, &ndr_table_samr,
transport,
assoc_group_id);
torture_assert_ntstatus_equal(torture, status, NT_STATUS_UNSUCCESSFUL,
"opening samr pipe5");
torture_comment(torture, "connect lsa pipe6 with assoc_group_id[0x%08X]- should fail\n", ++assoc_group_id);
- status = torture_rpc_connection_transport(mem_ctx, &p6, &ndr_table_lsarpc,
+ status = torture_rpc_connection_transport(torture, &p6, &ndr_table_lsarpc,
transport,
assoc_group_id);
torture_assert_ntstatus_equal(torture, status, NT_STATUS_UNSUCCESSFUL,
@@ -491,7 +491,7 @@ static bool test_handles_random_assoc(struct torture_context *torture)
torture_comment(torture, "RPC-HANDLE-RANDOM-ASSOC\n");
torture_comment(torture, "connect samr pipe1\n");
- status = torture_rpc_connection(mem_ctx, &p1, &ndr_table_samr);
+ status = torture_rpc_connection(torture, &p1, &ndr_table_samr);
torture_assert_ntstatus_ok(torture, status, "opening samr pipe1");
transport = p1->conn->transport.transport,
@@ -500,14 +500,14 @@ static bool test_handles_random_assoc(struct torture_context *torture)
torture_comment(torture, "pip1 use assoc_group_id[0x%08X]\n", assoc_group_id);
torture_comment(torture, "connect samr pipe2 with assoc_group_id[0x%08X]- should fail\n", ++assoc_group_id);
- status = torture_rpc_connection_transport(mem_ctx, &p2, &ndr_table_samr,
+ status = torture_rpc_connection_transport(torture, &p2, &ndr_table_samr,
transport,
assoc_group_id);
torture_assert_ntstatus_equal(torture, status, NT_STATUS_UNSUCCESSFUL,
"opening samr pipe2");
torture_comment(torture, "connect samr pipe3 with assoc_group_id[0x%08X]- should fail\n", ++assoc_group_id);
- status = torture_rpc_connection_transport(mem_ctx, &p3, &ndr_table_samr,
+ status = torture_rpc_connection_transport(torture, &p3, &ndr_table_samr,
transport,
assoc_group_id);
torture_assert_ntstatus_equal(torture, status, NT_STATUS_UNSUCCESSFUL,
@@ -532,10 +532,10 @@ static bool test_handles_drsuapi(struct torture_context *torture)
torture_comment(torture, "RPC-HANDLE-DRSUAPI\n");
- status = torture_rpc_connection(mem_ctx, &p1, &ndr_table_drsuapi);
+ status = torture_rpc_connection(torture, &p1, &ndr_table_drsuapi);
torture_assert_ntstatus_ok(torture, status, "opening drsuapi pipe1");
- status = torture_rpc_connection(mem_ctx, &p2, &ndr_table_drsuapi);
+ status = torture_rpc_connection(torture, &p2, &ndr_table_drsuapi);
torture_assert_ntstatus_ok(torture, status, "opening drsuapi pipe1");
GUID_from_string(DRSUAPI_DS_BIND_GUID, &bind_guid);
diff --git a/source4/torture/rpc/initshutdown.c b/source4/torture/rpc/initshutdown.c
index 84c96211b3..cb6bd4ad53 100644
--- a/source4/torture/rpc/initshutdown.c
+++ b/source4/torture/rpc/initshutdown.c
@@ -121,7 +121,7 @@ BOOL torture_rpc_initshutdown(struct torture_context *torture)
mem_ctx = talloc_init("torture_rpc_initshutdown");
- status = torture_rpc_connection(mem_ctx, &p, &ndr_table_initshutdown);
+ status = torture_rpc_connection(torture, &p, &ndr_table_initshutdown);
if (!NT_STATUS_IS_OK(status)) {
talloc_free(mem_ctx);
diff --git a/source4/torture/rpc/lsa.c b/source4/torture/rpc/lsa.c
index cf50d99d82..cfdf483f8d 100644
--- a/source4/torture/rpc/lsa.c
+++ b/source4/torture/rpc/lsa.c
@@ -1459,7 +1459,6 @@ static BOOL test_QueryForestTrustInformation(struct dcerpc_pipe *p,
NTSTATUS status;
struct lsa_String string;
struct lsa_ForestTrustInformation info, *info_ptr;
- uint16_t unknown = 0;
printf("\nTesting lsaRQueryForestTrustInformation\n");
@@ -1496,8 +1495,7 @@ static BOOL test_query_each_TrustDomEx(struct dcerpc_pipe *p,
struct policy_handle *handle,
struct lsa_DomainListEx *domains)
{
- NTSTATUS status;
- int i,j;
+ int i;
BOOL ret = True;
for (i=0; i< domains->count; i++) {
@@ -1999,7 +1997,7 @@ BOOL torture_rpc_lsa(struct torture_context *torture)
mem_ctx = talloc_init("torture_rpc_lsa");
- status = torture_rpc_connection(mem_ctx, &p, &ndr_table_lsarpc);
+ status = torture_rpc_connection(torture, &p, &ndr_table_lsarpc);
if (!NT_STATUS_IS_OK(status)) {
talloc_free(mem_ctx);
return False;
@@ -2087,7 +2085,7 @@ BOOL torture_rpc_lsa_get_user(struct torture_context *torture)
mem_ctx = talloc_init("torture_rpc_lsa_get_user");
- status = torture_rpc_connection(mem_ctx, &p, &ndr_table_lsarpc);
+ status = torture_rpc_connection(torture, &p, &ndr_table_lsarpc);
if (!NT_STATUS_IS_OK(status)) {
talloc_free(mem_ctx);
return False;
diff --git a/source4/torture/rpc/lsa_lookup.c b/source4/torture/rpc/lsa_lookup.c
index c2eb7e86c5..d90c3694a9 100644
--- a/source4/torture/rpc/lsa_lookup.c
+++ b/source4/torture/rpc/lsa_lookup.c
@@ -230,7 +230,7 @@ BOOL torture_rpc_lsa_lookup(struct torture_context *torture)
mem_ctx = talloc_init("torture_rpc_lsa");
- status = torture_rpc_connection(mem_ctx, &p, &ndr_table_lsarpc);
+ status = torture_rpc_connection(torture, &p, &ndr_table_lsarpc);
if (!NT_STATUS_IS_OK(status)) {
ret = False;
goto done;
diff --git a/source4/torture/rpc/mgmt.c b/source4/torture/rpc/mgmt.c
index 5604b87c6e..ec3e390afa 100644
--- a/source4/torture/rpc/mgmt.c
+++ b/source4/torture/rpc/mgmt.c
@@ -29,8 +29,10 @@
/*
ask the server what interface IDs are available on this endpoint
*/
-BOOL test_inq_if_ids(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx,
- BOOL (*per_id_test)(const struct ndr_interface_table *iface,
+BOOL test_inq_if_ids(struct torture_context *tctx,
+ struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx,
+ BOOL (*per_id_test)(struct torture_context *,
+ const struct ndr_interface_table *iface,
TALLOC_CTX *mem_ctx,
struct ndr_syntax_id *id),
const void *priv)
@@ -69,7 +71,7 @@ BOOL test_inq_if_ids(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx,
ndr_interface_name(&id->uuid, id->if_version));
if (per_id_test) {
- per_id_test(priv, mem_ctx, id);
+ per_id_test(tctx, priv, mem_ctx, id);
}
}
@@ -234,7 +236,7 @@ BOOL torture_rpc_mgmt(struct torture_context *torture)
lp_set_cmdline("torture:binding", dcerpc_binding_string(loop_ctx, b));
- status = torture_rpc_connection(loop_ctx, &p, &ndr_table_mgmt);
+ status = torture_rpc_connection(torture, &p, &ndr_table_mgmt);
if (NT_STATUS_EQUAL(status, NT_STATUS_OBJECT_NAME_NOT_FOUND)) {
printf("Interface not available - skipping\n");
talloc_free(loop_ctx);
@@ -263,7 +265,7 @@ BOOL torture_rpc_mgmt(struct torture_context *torture)
ret = False;
}
- if (!test_inq_if_ids(p, loop_ctx, NULL, NULL)) {
+ if (!test_inq_if_ids(torture, p, loop_ctx, NULL, NULL)) {
ret = False;
}
diff --git a/source4/torture/rpc/netlogon.c b/source4/torture/rpc/netlogon.c
index fe27d93757..df69a097b6 100644
--- a/source4/torture/rpc/netlogon.c
+++ b/source4/torture/rpc/netlogon.c
@@ -1652,7 +1652,7 @@ BOOL torture_rpc_netlogon(struct torture_context *torture)
machine_password = cli_credentials_get_password(machine_credentials);
- status = torture_rpc_connection(mem_ctx, &p, &ndr_table_netlogon);
+ status = torture_rpc_connection(torture, &p, &ndr_table_netlogon);
if (!NT_STATUS_IS_OK(status)) {
talloc_free(mem_ctx);
return False;
diff --git a/source4/torture/rpc/oxidresolve.c b/source4/torture/rpc/oxidresolve.c
index b849681cc2..2809a2a3fb 100644
--- a/source4/torture/rpc/oxidresolve.c
+++ b/source4/torture/rpc/oxidresolve.c
@@ -229,7 +229,7 @@ BOOL torture_rpc_oxidresolve(struct torture_context *torture)
mem_ctx = talloc_init("torture_rpc_oxidresolve");
- status = torture_rpc_connection(mem_ctx,
+ status = torture_rpc_connection(torture,
&premact,
&ndr_table_IRemoteActivation);
@@ -238,7 +238,7 @@ BOOL torture_rpc_oxidresolve(struct torture_context *torture)
return False;
}
- status = torture_rpc_connection(mem_ctx,
+ status = torture_rpc_connection(torture,
&p,
&ndr_table_IOXIDResolver);
diff --git a/source4/torture/rpc/remact.c b/source4/torture/rpc/remact.c
index ce3ebd3749..d1294f429d 100644
--- a/source4/torture/rpc/remact.c
+++ b/source4/torture/rpc/remact.c
@@ -105,7 +105,7 @@ BOOL torture_rpc_remact(struct torture_context *torture)
mem_ctx = talloc_init("torture_rpc_remact");
- status = torture_rpc_connection(mem_ctx,
+ status = torture_rpc_connection(torture,
&p,
&ndr_table_IRemoteActivation);
diff --git a/source4/torture/rpc/rot.c b/source4/torture/rpc/rot.c
index 5850e9b532..32a18b1d32 100644
--- a/source4/torture/rpc/rot.c
+++ b/source4/torture/rpc/rot.c
@@ -32,7 +32,7 @@ BOOL torture_rpc_rot(struct torture_context *torture)
mem_ctx = talloc_init("torture_rpc_rot");
- status = torture_rpc_connection(mem_ctx,
+ status = torture_rpc_connection(torture,
&p,
&ndr_table_rot);
diff --git a/source4/torture/rpc/rpc.c b/source4/torture/rpc/rpc.c
index 12ace3e7d2..96e70cfe11 100644
--- a/source4/torture/rpc/rpc.c
+++ b/source4/torture/rpc/rpc.c
@@ -28,19 +28,19 @@
#include "lib/util/dlinklist.h"
/* open a rpc connection to the chosen binding string */
-_PUBLIC_ NTSTATUS torture_rpc_connection(TALLOC_CTX *parent_ctx,
+_PUBLIC_ NTSTATUS torture_rpc_connection(struct torture_context *tctx,
struct dcerpc_pipe **p,
const struct ndr_interface_table *table)
{
- NTSTATUS status;
- const char *binding = lp_parm_string(-1, "torture", "binding");
+ NTSTATUS status;
+ const char *binding = torture_setting_string(tctx, "binding", NULL);
if (!binding) {
printf("You must specify a ncacn binding string\n");
return NT_STATUS_INVALID_PARAMETER;
}
- status = dcerpc_pipe_connect(parent_ctx,
+ status = dcerpc_pipe_connect(tctx,
p, binding, table,
cmdline_credentials, NULL);
@@ -52,16 +52,16 @@ _PUBLIC_ NTSTATUS torture_rpc_connection(TALLOC_CTX *parent_ctx,
}
/* open a rpc connection to a specific transport */
-NTSTATUS torture_rpc_connection_transport(TALLOC_CTX *parent_ctx,
+NTSTATUS torture_rpc_connection_transport(struct torture_context *tctx,
struct dcerpc_pipe **p,
const struct ndr_interface_table *table,
enum dcerpc_transport_t transport,
uint32_t assoc_group_id)
{
NTSTATUS status;
- const char *binding = lp_parm_string(-1, "torture", "binding");
+ const char *binding = torture_setting_string(tctx, "binding", NULL);
struct dcerpc_binding *b;
- TALLOC_CTX *mem_ctx = talloc_named(parent_ctx, 0, "torture_rpc_connection_smb");
+ TALLOC_CTX *mem_ctx = talloc_named(tctx, 0, "torture_rpc_connection_smb");
if (!binding) {
printf("You must specify a ncacn binding string\n");
@@ -83,7 +83,7 @@ NTSTATUS torture_rpc_connection_transport(TALLOC_CTX *parent_ctx,
cmdline_credentials, NULL);
if (NT_STATUS_IS_OK(status)) {
- *p = talloc_reference(parent_ctx, *p);
+ *p = talloc_reference(tctx, *p);
} else {
*p = NULL;
}
@@ -219,7 +219,7 @@ NTSTATUS torture_rpc_init(void)
torture_suite_add_simple_test(suite, "SCHANNEL", torture_rpc_schannel);
torture_suite_add_simple_test(suite, "SCHANNEL2", torture_rpc_schannel2);
torture_suite_add_simple_test(suite, "SRVSVC", torture_rpc_srvsvc);
- torture_suite_add_simple_test(suite, "SVCCTL", torture_rpc_svcctl);
+ torture_suite_add_suite(suite, torture_rpc_svcctl(suite));
torture_suite_add_simple_test(suite, "EPMAPPER", torture_rpc_epmapper);
torture_suite_add_simple_test(suite, "INITSHUTDOWN", torture_rpc_initshutdown);
torture_suite_add_simple_test(suite, "OXIDRESOLVE", torture_rpc_oxidresolve);
diff --git a/source4/torture/rpc/samba3rpc.c b/source4/torture/rpc/samba3rpc.c
index 44813c7d2f..72eba40344 100644
--- a/source4/torture/rpc/samba3rpc.c
+++ b/source4/torture/rpc/samba3rpc.c
@@ -2824,7 +2824,7 @@ BOOL torture_samba3_rpc_winreg(struct torture_context *torture)
mem_ctx = talloc_init("torture_rpc_winreg");
- status = torture_rpc_connection(mem_ctx, &p, &ndr_table_winreg);
+ status = torture_rpc_connection(torture, &p, &ndr_table_winreg);
if (!NT_STATUS_IS_OK(status)) {
talloc_free(mem_ctx);
diff --git a/source4/torture/rpc/samlogon.c b/source4/torture/rpc/samlogon.c
index d2998f5f34..832bb68072 100644
--- a/source4/torture/rpc/samlogon.c
+++ b/source4/torture/rpc/samlogon.c
@@ -1514,7 +1514,8 @@ BOOL torture_rpc_samlogon(struct torture_context *torture)
userdomain = torture_setting_string(torture, "userdomain", lp_workgroup());
- user_ctx = torture_create_testuser(TEST_USER_NAME,
+ user_ctx = torture_create_testuser(torture,
+ TEST_USER_NAME,
userdomain,
ACB_NORMAL,
(const char **)&user_password);
@@ -1529,7 +1530,8 @@ BOOL torture_rpc_samlogon(struct torture_context *torture)
TEST_USER_NAME, 16 /* > 14 */, &user_password,
NULL, 0, False);
- user_ctx_wrong_wks = torture_create_testuser(TEST_USER_NAME_WRONG_WKS,
+ user_ctx_wrong_wks = torture_create_testuser(torture,
+ TEST_USER_NAME_WRONG_WKS,
userdomain,
ACB_NORMAL,
(const char **)&user_password_wrong_wks);
@@ -1554,7 +1556,7 @@ BOOL torture_rpc_samlogon(struct torture_context *torture)
}
user_ctx_wrong_time
- = torture_create_testuser(TEST_USER_NAME_WRONG_TIME,
+ = torture_create_testuser(torture, TEST_USER_NAME_WRONG_TIME,
userdomain,
ACB_NORMAL,
(const char **)&user_password_wrong_time);
diff --git a/source4/torture/rpc/samsync.c b/source4/torture/rpc/samsync.c
index 6a40cc5e46..4b9392bf3c 100644
--- a/source4/torture/rpc/samsync.c
+++ b/source4/torture/rpc/samsync.c
@@ -1431,7 +1431,7 @@ BOOL torture_rpc_samsync(struct torture_context *torture)
mem_ctx = talloc_init("torture_rpc_netlogon");
test_machine_account = talloc_asprintf(mem_ctx, "%s$", TEST_MACHINE_NAME);
- join_ctx = torture_create_testuser(test_machine_account, lp_workgroup(), ACB_SVRTRUST,
+ join_ctx = torture_create_testuser(torture, test_machine_account, lp_workgroup(), ACB_SVRTRUST,
&machine_password);
if (!join_ctx) {
talloc_free(mem_ctx);
@@ -1440,7 +1440,7 @@ BOOL torture_rpc_samsync(struct torture_context *torture)
}
test_wksta_machine_account = talloc_asprintf(mem_ctx, "%s$", TEST_WKSTA_MACHINE_NAME);
- join_ctx2 = torture_create_testuser(test_wksta_machine_account, lp_workgroup(), ACB_WSTRUST,
+ join_ctx2 = torture_create_testuser(torture, test_wksta_machine_account, lp_workgroup(), ACB_WSTRUST,
&wksta_machine_password);
if (!join_ctx2) {
talloc_free(mem_ctx);
@@ -1448,7 +1448,7 @@ BOOL torture_rpc_samsync(struct torture_context *torture)
return False;
}
- user_ctx = torture_create_testuser(TEST_USER_NAME,
+ user_ctx = torture_create_testuser(torture, TEST_USER_NAME,
lp_workgroup(),
ACB_NORMAL, NULL);
if (!user_ctx) {
@@ -1503,7 +1503,7 @@ BOOL torture_rpc_samsync(struct torture_context *torture)
}
- status = torture_rpc_connection(samsync_state,
+ status = torture_rpc_connection(torture,
&samsync_state->p_lsa,
&ndr_table_lsarpc);
diff --git a/source4/torture/rpc/scanner.c b/source4/torture/rpc/scanner.c
index 1f74b8b1cf..da4fc84f6f 100644
--- a/source4/torture/rpc/scanner.c
+++ b/source4/torture/rpc/scanner.c
@@ -28,7 +28,8 @@
/*
work out how many calls there are for an interface
*/
-static BOOL test_num_calls(const struct ndr_interface_table *iface,
+static BOOL test_num_calls(struct torture_context *tctx,
+ const struct ndr_interface_table *iface,
TALLOC_CTX *mem_ctx,
struct ndr_syntax_id *id)
{
@@ -44,7 +45,7 @@ static BOOL test_num_calls(const struct ndr_interface_table *iface,
tbl.name = iface->name;
tbl.syntax_id = *id;
- status = torture_rpc_connection(mem_ctx, &p, iface);
+ status = torture_rpc_connection(tctx, &p, iface);
if (!NT_STATUS_IS_OK(status)) {
char *uuid_str = GUID_string(mem_ctx, &id->uuid);
printf("Failed to connect to '%s' on '%s' - %s\n",
@@ -142,14 +143,14 @@ BOOL torture_rpc_scanner(struct torture_context *torture)
lp_set_cmdline("torture:binding", dcerpc_binding_string(mem_ctx, b));
- status = torture_rpc_connection(loop_ctx, &p, &ndr_table_mgmt);
+ status = torture_rpc_connection(torture, &p, &ndr_table_mgmt);
if (!NT_STATUS_IS_OK(status)) {
talloc_free(loop_ctx);
ret = False;
continue;
}
- if (!test_inq_if_ids(p, mem_ctx, test_num_calls, l->table)) {
+ if (!test_inq_if_ids(torture, p, mem_ctx, test_num_calls, l->table)) {
ret = False;
}
}
diff --git a/source4/torture/rpc/session_key.c b/source4/torture/rpc/session_key.c
index a438fea321..c4b31be8a7 100644
--- a/source4/torture/rpc/session_key.c
+++ b/source4/torture/rpc/session_key.c
@@ -170,7 +170,7 @@ BOOL torture_rpc_lsa_secrets(struct torture_context *torture)
mem_ctx = talloc_init("torture_rpc_lsa_secrets");
- status = torture_rpc_connection(mem_ctx,
+ status = torture_rpc_connection(torture,
&p,
&ndr_table_lsarpc);
if (!NT_STATUS_IS_OK(status)) {
diff --git a/source4/torture/rpc/spoolss.c b/source4/torture/rpc/spoolss.c
index 2b07b326aa..a9232f6df3 100644
--- a/source4/torture/rpc/spoolss.c
+++ b/source4/torture/rpc/spoolss.c
@@ -2076,17 +2076,17 @@ static BOOL test_EnumPrinterDrivers_old(struct dcerpc_pipe *p, TALLOC_CTX *mem_c
return ret;
}
-BOOL torture_rpc_spoolss(struct torture_context *torture)
+bool torture_rpc_spoolss(struct torture_context *torture)
{
- NTSTATUS status;
- struct dcerpc_pipe *p;
+ NTSTATUS status;
+ struct dcerpc_pipe *p;
TALLOC_CTX *mem_ctx;
BOOL ret = True;
struct test_spoolss_context *ctx;
mem_ctx = talloc_init("torture_rpc_spoolss");
- status = torture_rpc_connection(mem_ctx, &p, &ndr_table_spoolss);
+ status = torture_rpc_connection(torture, &p, &ndr_table_spoolss);
if (!NT_STATUS_IS_OK(status)) {
talloc_free(mem_ctx);
return False;
diff --git a/source4/torture/rpc/srvsvc.c b/source4/torture/rpc/srvsvc.c
index c3d82a2715..e066b08596 100644
--- a/source4/torture/rpc/srvsvc.c
+++ b/source4/torture/rpc/srvsvc.c
@@ -1101,7 +1101,7 @@ BOOL torture_rpc_srvsvc(struct torture_context *torture)
mem_ctx = talloc_init("torture_rpc_srvsvc");
- status = torture_rpc_connection(mem_ctx, &p, &ndr_table_srvsvc);
+ status = torture_rpc_connection(torture, &p, &ndr_table_srvsvc);
if (!NT_STATUS_IS_OK(status)) {
talloc_free(mem_ctx);
return False;
@@ -1122,7 +1122,7 @@ BOOL torture_rpc_srvsvc(struct torture_context *torture)
ret &= test_NetShareAddSetDel(p, mem_ctx);
ret &= test_NetNameValidate(p, mem_ctx);
- status = torture_rpc_connection(mem_ctx, &p, &ndr_table_srvsvc);
+ status = torture_rpc_connection(torture, &p, &ndr_table_srvsvc);
if (!binding) {
d_printf("You must specify a ncacn binding string\n");
diff --git a/source4/torture/rpc/svcctl.c b/source4/torture/rpc/svcctl.c
index fedc999931..4390b8dd3e 100644
--- a/source4/torture/rpc/svcctl.c
+++ b/source4/torture/rpc/svcctl.c
@@ -23,15 +23,48 @@
#include "librpc/gen_ndr/ndr_svcctl_c.h"
#include "torture/rpc/rpc.h"
-static BOOL test_EnumServicesStatus(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, struct policy_handle *h)
+static bool test_OpenSCManager(struct dcerpc_pipe *p, struct torture_context *tctx, struct policy_handle *h)
+{
+ struct svcctl_OpenSCManagerW r;
+
+ r.in.MachineName = NULL;
+ r.in.DatabaseName = NULL;
+ r.in.access_mask = SEC_FLAG_MAXIMUM_ALLOWED;
+ r.out.handle = h;
+
+ torture_assert_ntstatus_ok(tctx,
+ dcerpc_svcctl_OpenSCManagerW(p, tctx, &r),
+ "OpenSCManager failed!");
+
+ return true;
+}
+
+static bool test_CloseServiceHandle(struct dcerpc_pipe *p, struct torture_context *tctx, struct policy_handle *h)
+{
+ struct svcctl_CloseServiceHandle r;
+
+ r.in.handle = h;
+ r.out.handle = h;
+ torture_assert_ntstatus_ok(tctx,
+ dcerpc_svcctl_CloseServiceHandle(p, tctx, &r),
+ "CloseServiceHandle failed");
+
+ return true;
+}
+
+static bool test_EnumServicesStatus(struct torture_context *tctx, struct dcerpc_pipe *p)
{
struct svcctl_EnumServicesStatusW r;
+ struct policy_handle h;
int i;
NTSTATUS status;
uint32_t resume_handle = 0;
struct ENUM_SERVICE_STATUS *service = NULL;
- r.in.handle = h;
+ if (!test_OpenSCManager(p, tctx, &h))
+ return false;
+
+ r.in.handle = &h;
r.in.type = SERVICE_TYPE_WIN32;
r.in.state = SERVICE_STATE_ALL;
r.in.buf_size = 0;
@@ -41,101 +74,58 @@ static BOOL test_EnumServicesStatus(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx,
r.out.services_returned = 0;
r.out.bytes_needed = 0;
- status = dcerpc_svcctl_EnumServicesStatusW(p, mem_ctx, &r);
+ status = dcerpc_svcctl_EnumServicesStatusW(p, tctx, &r);
- if (!NT_STATUS_IS_OK(status)) {
- printf("ËnumServicesStatus failed!\n");
- return False;
- }
+ torture_assert_ntstatus_ok(tctx, status, "EnumServicesStatus failed!");
if (W_ERROR_EQUAL(r.out.result, WERR_MORE_DATA)) {
r.in.buf_size = *r.out.bytes_needed;
- r.out.service = talloc_size(mem_ctx, *r.out.bytes_needed);
+ r.out.service = talloc_size(tctx, *r.out.bytes_needed);
- status = dcerpc_svcctl_EnumServicesStatusW(p, mem_ctx, &r);
+ status = dcerpc_svcctl_EnumServicesStatusW(p, tctx, &r);
- if (!NT_STATUS_IS_OK(status)) {
- printf("ËnumServicesStatus failed!\n");
- return False;
- }
+ torture_assert_ntstatus_ok(tctx, status, "EnumServicesStatus failed!");
+ torture_assert_werr_ok(tctx, r.out.result, "EnumServicesStatus failed");
- if (!W_ERROR_IS_OK(r.out.result)) {
- printf("EnumServicesStatus failed\n");
- return False;
- }
service = (struct ENUM_SERVICE_STATUS *)r.out.service;
}
for(i = 0; i < *r.out.services_returned; i++) {
printf("Type: %d, State: %d\n", service[i].status.type, service[i].status.state);
}
-
- return True;
-}
-
-static BOOL test_OpenSCManager(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, struct policy_handle *h)
-{
- struct svcctl_OpenSCManagerW r;
- NTSTATUS status;
-
- r.in.MachineName = NULL;
- r.in.DatabaseName = NULL;
- r.in.access_mask = SEC_FLAG_MAXIMUM_ALLOWED;
- r.out.handle = h;
- status = dcerpc_svcctl_OpenSCManagerW(p, mem_ctx, &r);
- if (!NT_STATUS_IS_OK(status)) {
- printf("OpenSCManager failed!\n");
- return False;
- }
-
- return True;
-}
+ if (!test_CloseServiceHandle(p, tctx, &h))
+ return false;
-static BOOL test_CloseServiceHandle(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, struct policy_handle *h)
-{
- struct svcctl_CloseServiceHandle r;
- NTSTATUS status;
- r.in.handle = h;
- r.out.handle = h;
- status = dcerpc_svcctl_CloseServiceHandle(p, mem_ctx, &r);
- if (!NT_STATUS_IS_OK(status)) {
- printf("CloseServiceHandle failed\n");
- return False;
- }
-
- return True;
+ return true;
}
-BOOL torture_rpc_svcctl(struct torture_context *torture)
+static bool test_SCManager(struct torture_context *tctx,
+ struct dcerpc_pipe *p)
{
- NTSTATUS status;
- struct dcerpc_pipe *p;
- struct policy_handle h;
- TALLOC_CTX *mem_ctx;
- BOOL ret = True;
-
- mem_ctx = talloc_init("torture_rpc_svcctl");
-
- status = torture_rpc_connection(mem_ctx, &p, &ndr_table_svcctl);
- if (!NT_STATUS_IS_OK(status)) {
- talloc_free(mem_ctx);
- return False;
- }
+ struct policy_handle h;
- if (!test_OpenSCManager(p, mem_ctx, &h)) {
- ret = False;
- }
+ if (!test_OpenSCManager(p, tctx, &h))
+ return false;
- if (!test_EnumServicesStatus(p, mem_ctx, &h)) {
- ret = False;
- }
+ if (!test_CloseServiceHandle(p, tctx, &h))
+ return false;
- if (!test_CloseServiceHandle(p, mem_ctx, &h)) {
- ret = False;
- }
+ return true;
+}
- talloc_free(mem_ctx);
+struct torture_suite *torture_rpc_svcctl(TALLOC_CTX *mem_ctx)
+{
+ struct torture_suite *suite = torture_suite_create(mem_ctx, "SVCCTL");
+ struct torture_tcase *tcase;
+
+ tcase = torture_suite_add_rpc_iface_tcase(suite, "svcctl",
+ &ndr_table_svcctl);
+
+ torture_rpc_tcase_add_test(tcase, "SCManager",
+ test_SCManager);
+ torture_rpc_tcase_add_test(tcase, "EnumServicesStatus",
+ test_EnumServicesStatus);
- return ret;
+ return suite;
}
diff --git a/source4/torture/rpc/testjoin.c b/source4/torture/rpc/testjoin.c
index e6c4435618..56a0fccde4 100644
--- a/source4/torture/rpc/testjoin.c
+++ b/source4/torture/rpc/testjoin.c
@@ -101,7 +101,8 @@ static NTSTATUS DeleteUser_byname(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx,
when finished
*/
-struct test_join *torture_create_testuser(const char *username,
+struct test_join *torture_create_testuser(struct torture_context *torture,
+ const char *username,
const char *domain,
uint16_t acct_type,
const char **random_password)
@@ -143,7 +144,7 @@ struct test_join *torture_create_testuser(const char *username,
cmdline_credentials, NULL);
} else {
- status = torture_rpc_connection(join,
+ status = torture_rpc_connection(torture,
&join->p,
&ndr_table_samr);
}