r24735: Use torture API in more places.
authorJelmer Vernooij <jelmer@samba.org>
Tue, 28 Aug 2007 12:54:27 +0000 (12:54 +0000)
committerGerald (Jerry) Carter <jerry@samba.org>
Wed, 10 Oct 2007 20:03:00 +0000 (15:03 -0500)
59 files changed:
source/torture/basic/base.c
source/torture/config.mk
source/torture/libnet/domain.c
source/torture/libnet/groupinfo.c
source/torture/libnet/libnet_group.c
source/torture/libnet/libnet_share.c
source/torture/libnet/libnet_user.c
source/torture/libnet/userinfo.c
source/torture/libnet/userman.c
source/torture/raw/acls.c
source/torture/raw/chkpath.c
source/torture/raw/close.c
source/torture/raw/composite.c
source/torture/raw/context.c
source/torture/raw/eas.c
source/torture/raw/ioctl.c
source/torture/raw/lock.c
source/torture/raw/mkdir.c
source/torture/raw/mux.c
source/torture/raw/notify.c
source/torture/raw/open.c
source/torture/raw/oplock.c
source/torture/raw/qfileinfo.c
source/torture/raw/qfsinfo.c
source/torture/raw/raw.c
source/torture/raw/read.c
source/torture/raw/rename.c
source/torture/raw/search.c
source/torture/raw/seek.c
source/torture/raw/setfileinfo.c
source/torture/raw/streams.c
source/torture/raw/unlink.c
source/torture/raw/write.c
source/torture/rpc/alter_context.c
source/torture/rpc/bench.c
source/torture/rpc/bind.c
source/torture/rpc/dcom.c [deleted file]
source/torture/rpc/drsuapi.c
source/torture/rpc/dssetup.c
source/torture/rpc/epmapper.c
source/torture/rpc/handles.c
source/torture/rpc/initshutdown.c
source/torture/rpc/lsa.c
source/torture/rpc/lsa_lookup.c
source/torture/rpc/mgmt.c
source/torture/rpc/netlogon.c
source/torture/rpc/oxidresolve.c
source/torture/rpc/remact.c
source/torture/rpc/rot.c
source/torture/rpc/rpc.c
source/torture/rpc/samba3rpc.c
source/torture/rpc/samlogon.c
source/torture/rpc/samsync.c
source/torture/rpc/scanner.c
source/torture/rpc/session_key.c
source/torture/rpc/spoolss.c
source/torture/rpc/srvsvc.c
source/torture/rpc/svcctl.c
source/torture/rpc/testjoin.c

index 1e03197c2821a8f888f97b52f2d7a5f8c95bbfa7..bfe1e082f119b765e74cd37ac97b4f0f5a8c4c17 100644 (file)
@@ -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);
index dce41fb604de5bb6515c717f5b575b19bade5fac..fc7a3c0763bbfb6a68122c0fdc77fc606133341b 100644 (file)
@@ -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 \
index 50b53300a4bf71e99988ff5fb8dafea9fe538832..8eaca99dc9e119cde26d65fb4b7a5ca7095cbbf3 100644 (file)
@@ -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);
        
index 361534052d65caca07c5f673e4d065d9fca1bcda..6e02d4f05d316d9dce29f44a7adc47c01a5f4c30 100644 (file)
@@ -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);
        
index ef2c3aa206fe80732c2b9ad1d707f102b986b9bc..db2952e226413da6e8444dff3465458be8481ad2 100644 (file)
@@ -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)) {
index 720246ed7e51897c5f57467a0b444fe116b1f6f7..a4d94a6b9c4d4664a721bb61d0c0bac01b4938e6 100644 (file)
@@ -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);
 
index 03092d5c67c464d0089b8e710a51e6b69d9a5e76..f3371e07a7ba8d9890769a14b0e3238c7128a92d 100644 (file)
@@ -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)) {
index f7aa479952be724eba5b9bacc620971730bace79..a1603b4bfc7f68fd48e95b000dfbf83942b85643 100644 (file)
@@ -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);
        
index cdc8bf0c524ec0987cadd221fb8c7950046597dd..d70fb0bc77b0ec79e07d3785e971706f80eed810 100644 (file)
@@ -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);
        
index bad98178d7c034c2b5be10c9478b46cf1675ba5d..c22c9be7de4549377de25995d56a4c9a1055b129 100644 (file)
@@ -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;
 }
index 9914fdacca59708d58d04c2a2670e951f57e845c..a56afee54642e35ca428ee931d6c4480a1010500 100644 (file)
@@ -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;
 }
index 6af234e4b4651f66b36b5f4071d41c33b0e7f082..34ac2f0db88440b21a3a85435704227980cf8e5b 100644 (file)
 #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;
 }
index 0b7644dd034a2d42a861bc2887ad62f15e7d8a7a..374ff3cb984b0086347ec657bbbd5b29c280a253 100644 (file)
@@ -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;
 }
index 8f3695d0dccb80d6fdd473c917a882cccb268477..df7f5f3851257e7fff33c08596d5a9e831741fad 100644 (file)
@@ -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;
 }
index 226c4f6052c72b33e98b4f238e1e6a7eacc91b50..7e9c742943f049494cf3c268e1bfa4213fb04e6a 100644 (file)
@@ -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;
 }
 
index 9208d9fa441dc1bc5a508afaf26e65d298ba87e8..8e98822e112fee5b9de60f67ed1aba03d1125428 100644 (file)
@@ -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;
 }
index cfedb4444bb5c46d085b04f6409d6a524e97882e..533974c9a9825c7b11c9a4f9d5a118923f83e80f 100644 (file)
@@ -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;
 }
index 2485fb61e804c4a1021e050af9c11e11c56b28d9..0e2fd1afe0932d03d3255a23926f544652d2870f 100644 (file)
@@ -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;
 }
index d61d037239b391b4a6d525c127893bf170a69aed..b67d756ed95c80fa7326edbfc10a03fdcf2a191a 100644 (file)
@@ -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;
 }
index 5be1b612d3ba4676146d38ef7d92bb7bf3400ea1..1540a4a2dd2d27a3fbbe1436dc123e1b428401c6 100644 (file)
@@ -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;
 }
index 4a4b97f53165164651c1f9526449e15dcd1c1f40..f8fa4ff8febb8290de07a58444703878ae32a9f4 100644 (file)
@@ -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;
 }
index 1d6b22244af2ed75a15fb7ed0d066fc49fa5aa31..f1779ad9cf650348e2a8b30a78e63158885a2a2e 100644 (file)
@@ -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);
index 6bcfdcfe098ebe7244feafa54f87416212abc561..8cb80cecc12739340f30c57033d03b17e686a2ae 100644 (file)
@@ -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;
index 982f348cd5acadce5cf6a40f35e361bb6456b1db..dc09e55b63999e8feb3e0fc222f8e15df5d27b45 100644 (file)
@@ -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;
 }
index 67d79ef78c3092eff606baa4c24654718756bdef..85db92661b20d20e84533d156e272dadfce75567 100644 (file)
@@ -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);
index 95e9d891d9917cec7d767657f84d8204919a02a0..f1048f25ac0669953d67d1e64c1e27478df42337 100644 (file)
@@ -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;
 }
index 6b1eb4392a350622bb0c01503618a82d1669cac5..05a53208590aff647bb549291c9c02935ae6e1a2 100644 (file)
@@ -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;
 }
index cd79b4dd3b03eede9696b685f4afe26397963a0a..986da474d0d1395829b6a99d0ca7b99ce43e56b0 100644 (file)
@@ -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;
 }
index f9b072b3de131c6f8c36d76bbec260dd0308966c..f5413d8b1d83da1e339cfc1e46100104d5da2f00 100644 (file)
@@ -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;
 }
index d30637bce895a78f77c9813c6ba5d31febf251f8..b06a04753fc78ec0ef9bd359ab9996ca4f97bdd0 100644 (file)
    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;
index b52d84f7724de6f2f928ec0bfa9075753ae38f61..24428efcf7c7667bd81dcc15d889dbfd9e591293 100644 (file)
@@ -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;
 }
index 3e4580d2d32dce841e6413d97eedea9b9596da91..c307b14e08452a556efcbfb0cecfb585f12343fa 100644 (file)
@@ -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;
 }
index 9b043bfe2ca4084fd9996f4927f55d11339f08e4..75d275fc3c54e21ad71dfe63b3e858e85652cc30 100644 (file)
 #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;
 }
index 140d52c7463d5fb995f96abb4f810f7940120385..d55a0eedc9a780b756b0b2bf23e82e1b55e072ec 100644 (file)
@@ -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;
index 6e3ee1c421411a96389184bb2ec7c2d53b3340be..48fd0609f005a10796b89f5f26b23366585f9159 100644 (file)
@@ -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)) {
index 71d3489ca42677b5284d1ff5ceeaa1605c00c99d..33885573e66d0eff155d07f145fce5b7fa9ff764 100644 (file)
@@ -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/source/torture/rpc/dcom.c b/source/torture/rpc/dcom.c
deleted file mode 100644 (file)
index 38092a8..0000000
+++ /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;
-}
index 5e4ac3321f07975536beb558d5994d7a1c510c92..606240993f030066f0bd392a5c17fa25bf7df1f9 100644 (file)
@@ -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)) {
index 4d90b242c4fa8c57720a2e37a9d7aaf899aeacf5..c80e37eb7d612ce596cb909882118daab1ab0460 100644 (file)
@@ -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);
 
index b4e5b976797fa47b751a99e2a8352ac38fadbeae..3f9de2272189e043109de02ed58be6da0d6fbc93 100644 (file)
@@ -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;
index f8cd1cd48810afe335932539238d7ffbbd634c06..5b6082f7dd18e8706340c3ed20b9ca45affd247e 100644 (file)
@@ -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);
index 84c96211b3aea35fcfd075ca9bd254a0e99afebf..cb6bd4ad53b7f4a143d1c87f90dc7a2cc2ed4692 100644 (file)
@@ -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);
index cf50d99d82dccf4dc19e3bce6fd63b6999b00525..cfdf483f8d613cf4e90b827cabd3dde5510e0de4 100644 (file)
@@ -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;
index c2eb7e86c5ced190005bc7a3cf5aaaa4f2d0097d..d90c3694a9adffea46cca9b16d05644abb552010 100644 (file)
@@ -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;
index 5604b87c6e9e4adbd17d23ddb9a06c6c219d3e5f..ec3e390afa175030fef11fd6202b5e385628c987 100644 (file)
 /*
   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;
                }
 
index fe27d93757631d530ca4417c1ef9477558514c24..df69a097b6edf29e16d4fae8b25e98517746684c 100644 (file)
@@ -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;
index b849681cc25d366025d00a7dc838faba1696be24..2809a2a3fb18ea90bd2f87fede2c5b37b6cc6209 100644 (file)
@@ -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);
 
index ce3ebd3749bc291c1e29d43af8506c191cfd4d92..d1294f429de01b44dee20346d52557529f8d22fd 100644 (file)
@@ -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);
 
index 5850e9b53244a65493eaeeb215603a96a6f70941..32a18b1d32da1ec186364ea305dbf9abc4e8561e 100644 (file)
@@ -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);
 
index 12ace3e7d2ab6520808cc53236df4f213c713377..96e70cfe110e55401a3d25c843edbefe09c690ea 100644 (file)
 #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);
index 44813c7d2fbcb1b92fed0ac1978be037bc1e2dd5..72eba40344c25e8f841bdb82452c88e21b6f24e1 100644 (file)
@@ -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);
index d2998f5f342e3397c05b0288a3661a055e536d6b..832bb68072d78bf7a28f4200bb75cc0179d1de91 100644 (file)
@@ -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);
index 6a40cc5e46e4312b3d97f59dc8b57c92a142cec2..4b9392bf3c95503aacfac24cd6f1216815a994d7 100644 (file)
@@ -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);
 
index 1f74b8b1cf09340a94c4c89c49e2d61cae6fab1c..da4fc84f6f154d4585d8394b2e4c54b97d202a2b 100644 (file)
@@ -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;
                }
        }
index a438fea321758c9d92772eafb965aba66db3093b..c4b31be8a758bc0362471675f695af91774ae723 100644 (file)
@@ -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)) {
index 2b07b326aa7f06ac5b38f33a8255daf867ebbf90..a9232f6df383430bc068641c0b0239e37cfa1744 100644 (file)
@@ -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;
index c3d82a27155340efa7aae8cdbabf7ded4a4562dd..e066b08596f9567f70ebb6f976be09936133f485 100644 (file)
@@ -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");
index fedc9999310d580fa1c5a098cd2badf1aa7a3b7a..4390b8dd3eddf479d4e2d55cf16a34a08b0f1aa0 100644 (file)
 #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;
 }
index e6c4435618af223d4512a47cc3deeee0a0c314a2..56a0fccde4cabf6b49da00aa1b630c2eea93cc32 100644 (file)
@@ -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);
        }