r13658: More moving around of files:
[bbaumbach/samba-autobuild/.git] / source4 / torture / torture.c
index b4aefb87805b1b7d155595cafbd6cac7a33fad02..26137b18908820016ca03a652adafe2c3deb054d 100644 (file)
 */
 
 #include "includes.h"
-#include "clilist.h"
 #include "lib/cmdline/popt_common.h"
 #include "libcli/raw/libcliraw.h"
 #include "system/time.h"
 #include "system/wait.h"
 #include "system/filesys.h"
-#include "ioctl.h"
-#include "librpc/gen_ndr/ndr_security.h"
+#include "libcli/raw/ioctl.h"
+#include "libcli/libcli.h"
+#include "librpc/rpc/dcerpc_table.h"
+
+#include "torture/basic/proto.h"
+#include "torture/raw/proto.h"
+#include "torture/smb2/proto.h"
+#include "torture/rpc/proto.h"
+#include "torture/rap/proto.h"
+#include "torture/auth/proto.h"
+#include "torture/local/proto.h"
+#include "torture/nbench/proto.h"
+#include "torture/ldap/proto.h"
+#include "torture/com/proto.h"
+#include "torture/nbt/proto.h"
+#include "torture/libnet/proto.h"
 
 int torture_nprocs=4;
-int torture_numops=100;
+int torture_numops=10;
 int torture_entries=1000;
 int torture_failures=1;
 int torture_seed=0;
@@ -122,9 +135,7 @@ BOOL torture_close_connection(struct smbcli_state *c)
 /* open a rpc connection to the chosen binding string */
 NTSTATUS torture_rpc_connection(TALLOC_CTX *parent_ctx, 
                                struct dcerpc_pipe **p, 
-                               const char *pipe_name,
-                               const char *pipe_uuid, 
-                               uint32_t pipe_version)
+                               const struct dcerpc_interface_table *table)
 {
         NTSTATUS status;
        const char *binding = lp_parm_string(-1, "torture", "binding");
@@ -135,7 +146,7 @@ NTSTATUS torture_rpc_connection(TALLOC_CTX *parent_ctx,
        }
 
        status = dcerpc_pipe_connect(parent_ctx, 
-                                    p, binding, pipe_uuid, pipe_version,
+                                    p, binding, table,
                                     cmdline_credentials, NULL);
  
         return status;
@@ -144,9 +155,7 @@ 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, 
                                          struct dcerpc_pipe **p, 
-                                         const char *pipe_name,
-                                         const char *pipe_uuid, 
-                                         uint32_t pipe_version,
+                                         const struct dcerpc_interface_table *table,
                                          enum dcerpc_transport_t transport)
 {
         NTSTATUS status;
@@ -169,7 +178,7 @@ NTSTATUS torture_rpc_connection_transport(TALLOC_CTX *parent_ctx,
 
        b->transport = transport;
 
-       status = dcerpc_pipe_connect_b(mem_ctx, p, b, pipe_uuid, pipe_version,
+       status = dcerpc_pipe_connect_b(mem_ctx, p, b, table,
                                       cmdline_credentials, NULL);
                                           
        if (NT_STATUS_IS_OK(status)) {
@@ -900,33 +909,17 @@ static BOOL run_negprot_nowait(void)
 
        printf("Filling send buffer\n");
 
-       for (i=0;i<10000;i++) {
+       for (i=0;i<1000;i++) {
                struct smbcli_request *req;
-               time_t t1 = time(NULL);
                req = smb_raw_negotiate_send(cli->transport, PROTOCOL_NT1);
-               while (req->state == SMBCLI_REQUEST_SEND && time(NULL) < t1+5) {
-                       smbcli_transport_process(cli->transport);
-               }
+               smbcli_transport_process(cli->transport);
                if (req->state == SMBCLI_REQUEST_ERROR) {
                        printf("Failed to fill pipe - %s\n", nt_errstr(req->status));
                        torture_close_connection(cli);
                        return correct;
                }
-               if (req->state == SMBCLI_REQUEST_SEND) {
-                       break;
-               }
        }
 
-       if (i == 10000) {
-               printf("send buffer failed to fill\n");
-               if (!torture_close_connection(cli)) {
-                       correct = False;
-               }
-               return correct;
-       }
-
-       printf("send buffer filled after %d requests\n", i);
-
        printf("Opening secondary connection\n");
        if (!torture_open_connection(&cli2)) {
                return False;
@@ -2267,6 +2260,16 @@ static struct {
        {"RAW-RAP", torture_raw_rap, 0},
        {"RAW-COMPOSITE", torture_raw_composite, 0},
 
+       /* SMB2 tests */
+       {"SMB2-CONNECT", torture_smb2_connect, 0},
+       {"SMB2-SCAN", torture_smb2_scan, 0},
+       {"SMB2-SCANGETINFO", torture_smb2_getinfo_scan, 0},
+       {"SMB2-SCANSETINFO", torture_smb2_setinfo_scan, 0},
+       {"SMB2-SCANFIND", torture_smb2_find_scan, 0},
+       {"SMB2-GETINFO", torture_smb2_getinfo, 0},
+       {"SMB2-SETINFO", torture_smb2_setinfo, 0},
+       {"SMB2-FIND", torture_smb2_find, 0},
+
        /* protocol scanners */
        {"SCAN-TRANS2", torture_trans2_scan, 0},
        {"SCAN-NTTRANS", torture_nttrans_scan, 0},
@@ -2281,6 +2284,7 @@ static struct {
 
        /* rpc testers */
         {"RPC-LSA", torture_rpc_lsa, 0},
+        {"RPC-LSALOOKUP", torture_rpc_lsa_lookup, 0},
         {"RPC-SECRETS", torture_rpc_lsa_secrets, 0},
         {"RPC-ECHO", torture_rpc_echo, 0},
         {"RPC-DFS", torture_rpc_dfs, 0},
@@ -2308,10 +2312,11 @@ static struct {
        {"RPC-MULTIBIND", torture_multi_bind, 0},
        {"RPC-DRSUAPI", torture_rpc_drsuapi, 0},
        {"RPC-CRACKNAMES", torture_rpc_drsuapi_cracknames, 0},
-       {"RPC-LOGIN", torture_rpc_login, 0},
        {"RPC-ROT", torture_rpc_rot, 0},
        {"RPC-DSSETUP", torture_rpc_dssetup, 0},
         {"RPC-ALTERCONTEXT", torture_rpc_alter_context, 0},
+        {"RPC-JOIN", torture_rpc_join, 0},
+        {"RPC-DSSYNC", torture_rpc_dssync, 0},
 
        /* local (no server) testers */
        {"LOCAL-NTLMSSP", torture_ntlmssp_self_check, 0},
@@ -2320,10 +2325,15 @@ static struct {
        {"LOCAL-MESSAGING", torture_local_messaging, 0},
        {"LOCAL-IRPC",  torture_local_irpc, 0},
        {"LOCAL-BINDING", torture_local_binding_string, 0},
+       {"LOCAL-STRLIST", torture_local_util_strlist, 0},
+       {"LOCAL-FILE", torture_local_util_file, 0},
        {"LOCAL-IDTREE", torture_local_idtree, 0},
        {"LOCAL-SOCKET", torture_local_socket, 0},
        {"LOCAL-PAC", torture_pac, 0},
+       {"LOCAL-REGISTRY", torture_registry, 0},
        {"LOCAL-RESOLVE", torture_local_resolve, 0},
+       {"LOCAL-SDDL", torture_local_sddl, 0},
+       {"LOCAL-NDR", torture_local_ndr, 0},
 
        /* COM (Component Object Model) testers */
        {"COM-SIMPLE", torture_com_simple, 0 },
@@ -2335,8 +2345,11 @@ static struct {
        /* nbt tests */
        {"NBT-REGISTER", torture_nbt_register, 0},
        {"NBT-WINS", torture_nbt_wins, 0},
-       {"NBT-WINSREPLICATION", torture_nbt_winsreplication, 0},
        {"NBT-DGRAM", torture_nbt_dgram, 0},
+       {"NBT-BROWSE", torture_nbt_browse, 0},
+       {"NBT-WINSREPLICATION-SIMPLE", torture_nbt_winsreplication_simple, 0},
+       {"NBT-WINSREPLICATION-REPLICA", torture_nbt_winsreplication_replica, 0},
+       {"NBT-WINSREPLICATION-OWNED", torture_nbt_winsreplication_owned, 0},
        
        /* libnet tests */
        {"NET-USERINFO", torture_userinfo, 0},
@@ -2545,10 +2558,12 @@ static void max_runtime_handler(int sig)
        int argc_new;
        char **argv_new;
        poptContext pc;
-       enum {OPT_LOADFILE=1000,OPT_UNCLIST,OPT_TIMELIMIT,OPT_DNS,OPT_DANGEROUS};
+       enum {OPT_LOADFILE=1000,OPT_UNCLIST,OPT_TIMELIMIT,OPT_DNS,
+           OPT_DANGEROUS,OPT_SMB_PORTS};
+
        struct poptOption long_options[] = {
                POPT_AUTOHELP
-               {"smb-ports",   'p', POPT_ARG_STRING, NULL,             0,      "SMB ports",    NULL},
+               {"smb-ports",   'p', POPT_ARG_STRING, NULL,     OPT_SMB_PORTS,  "SMB ports",    NULL},
                {"seed",          0, POPT_ARG_INT,  &torture_seed,      0,      "seed",         NULL},
                {"num-progs",     0, POPT_ARG_INT,  &torture_nprocs,    0,      "num progs",    NULL},
                {"num-ops",       0, POPT_ARG_INT,  &torture_numops,    0,      "num ops",      NULL},
@@ -2596,6 +2611,9 @@ static void max_runtime_handler(int sig)
                case OPT_DANGEROUS:
                        lp_set_cmdline("torture:dangerous", "Yes");
                        break;
+               case OPT_SMB_PORTS:
+                       lp_set_cmdline("smb ports", poptGetOptArg(pc));
+                       break;
                default:
                        d_printf("Invalid option %s: %s\n", 
                                 poptBadOption(pc, 0), poptStrerror(opt));
@@ -2614,8 +2632,9 @@ static void max_runtime_handler(int sig)
                alarm(max_runtime);
        }
 
-       smbtorture_init_subsystems;
+       dcerpc_init();
 
+       dcerpc_table_init();
 
        if (torture_seed == 0) {
                torture_seed = time(NULL);