source3: move lib/substitute.c functions out of proto.h
[gd/samba-autobuild/.git] / source3 / torture / torture.c
index f80d8c467e7ee9bbb8055da483375864e13098d7..4a886614ae124202c322fbf4c6985fa9d1d91f43 100644 (file)
@@ -51,6 +51,7 @@
 #include "lib/param/param.h"
 #include "auth/gensec/gensec.h"
 #include "lib/util/string_wrappers.h"
+#include "source3/lib/substitute.h"
 
 #include <gnutls/gnutls.h>
 #include <gnutls/crypto.h>
@@ -1347,6 +1348,7 @@ static bool run_tcon_test(int dummy)
        if (!NT_STATUS_IS_OK(status)) {
                printf("%s refused 2nd tree connect (%s)\n", host,
                       nt_errstr(status));
+               cli_state_restore_tcon(cli, orig_tcon);
                cli_shutdown(cli);
                return False;
        }
@@ -1399,6 +1401,8 @@ static bool run_tcon_test(int dummy)
        status = cli_close(cli, fnum1);
        if (!NT_STATUS_IS_OK(status)) {
                printf("close failed (%s)\n", nt_errstr(status));
+               cli_state_restore_tcon(cli, orig_tcon);
+               cli_shutdown(cli);
                return False;
        }
 
@@ -1407,6 +1411,8 @@ static bool run_tcon_test(int dummy)
        status = cli_tdis(cli);
        if (!NT_STATUS_IS_OK(status)) {
                printf("secondary tdis failed (%s)\n", nt_errstr(status));
+               cli_state_restore_tcon(cli, orig_tcon);
+               cli_shutdown(cli);
                return False;
        }
 
@@ -11685,7 +11691,7 @@ static bool run_uid_regression_test(int dummy)
        int16_t old_vuid;
        int32_t old_cnum;
        bool correct = True;
-       struct smbXcli_tcon *orig_tcon = NULL;
+       struct smbXcli_tcon *tcon_copy = NULL;
        NTSTATUS status;
 
        printf("starting uid regression test\n");
@@ -11726,8 +11732,20 @@ static bool run_uid_regression_test(int dummy)
        }
 
        old_cnum = cli_state_get_tid(cli);
-       orig_tcon = cli_state_save_tcon(cli);
-       if (orig_tcon == NULL) {
+       /*
+        * This is an SMB1-only test.
+        * Copy the tcon, not "save/restore".
+        *
+        * In SMB1 the cli_tdis() below frees
+        * cli->smb1.tcon so we need a copy
+        * of the struct to put back for the
+        * second tdis call with invalid vuid.
+        *
+        * This is a test-only hack. Real client code
+        * uses cli_state_save_tcon()/cli_state_restore_tcon().
+        */
+       tcon_copy = smbXcli_tcon_copy(cli, cli->smb1.tcon);
+       if (tcon_copy == NULL) {
                correct = false;
                goto out;
        }
@@ -11743,11 +11761,11 @@ static bool run_uid_regression_test(int dummy)
        } else {
                d_printf("First tdis failed (%s)\n", nt_errstr(status));
                correct = false;
-               cli_state_restore_tcon(cli, orig_tcon);
+               cli->smb1.tcon = tcon_copy;
                goto out;
        }
 
-       cli_state_restore_tcon(cli, orig_tcon);
+       cli->smb1.tcon = tcon_copy;
        cli_state_set_uid(cli, old_vuid);
        cli_state_set_tid(cli, old_cnum);
 
@@ -14555,7 +14573,7 @@ static bool run_ign_bad_negprot(int dummy)
        }
 
        conn = smbXcli_conn_create(talloc_tos(), fd, host, SMB_SIGNING_OFF, 0,
-                                  NULL, 0);
+                                  NULL, 0, NULL);
        if (conn == NULL) {
                d_fprintf(stderr, "smbXcli_conn_create failed\n");
                return false;
@@ -14918,6 +14936,42 @@ static struct {
                .name  = "POSIX-LS-WILDCARD",
                .fn    = run_posix_ls_wildcard_test,
        },
+       {
+               .name  = "POSIX-LS-SINGLE",
+               .fn    = run_posix_ls_single_test,
+       },
+       {
+               .name  = "POSIX-READLINK",
+               .fn    = run_posix_readlink_test,
+       },
+       {
+               .name  = "POSIX-STAT",
+               .fn    = run_posix_stat_test,
+       },
+       {
+               .name  = "POSIX-SYMLINK-PARENT",
+               .fn    = run_posix_symlink_parent_test,
+       },
+       {
+               .name  = "POSIX-SYMLINK-CHMOD",
+               .fn    = run_posix_symlink_chmod_test,
+       },
+       {
+               .name  = "POSIX-SYMLINK-RENAME",
+               .fn    = run_posix_symlink_rename_test,
+       },
+       {
+               .name  = "POSIX-DIR-DEFAULT-ACL",
+               .fn    = run_posix_dir_default_acl_test,
+       },
+       {
+               .name  = "POSIX-SYMLINK-GETPATHINFO",
+               .fn    = run_posix_symlink_getpathinfo_test,
+       },
+       {
+               .name  = "POSIX-SYMLINK-SETPATHINFO",
+               .fn    = run_posix_symlink_setpathinfo_test,
+       },
        {
                .name  = "WINDOWS-BAD-SYMLINK",
                .fn    = run_symlink_open_test,
@@ -15188,6 +15242,18 @@ static struct {
                .name  = "SMB2-QUOTA1",
                .fn    = run_smb2_quota1,
        },
+       {
+               .name  = "SMB2-STREAM-ACL",
+               .fn    = run_smb2_stream_acl,
+       },
+       {
+               .name  = "SMB2-LIST-DIR-ASYNC",
+               .fn    = run_list_dir_async_test,
+       },
+       {
+               .name  = "SMB2-DEL-ON-CLOSE-NONEMPTY",
+               .fn    = run_delete_on_close_non_empty,
+       },
        {
                .name  = "CLEANUP1",
                .fn    = run_cleanup1,
@@ -15288,6 +15354,14 @@ static struct {
                .name  = "LOCAL-STREAM-NAME",
                .fn    = run_local_stream_name,
        },
+       {
+               .name  = "LOCAL-STR-MATCH-MSWILD",
+               .fn    = run_str_match_mswild,
+       },
+       {
+               .name  = "LOCAL-STR-MATCH-REGEX-SUB1",
+               .fn    = run_str_match_regex_sub1,
+       },
        {
                .name  = "WBCLIENT-MULTI-PING",
                .fn    = run_wbclient_multi_ping,