s3:torture:delete: untangle function call from result check
[kai/samba.git] / source3 / torture / torture.c
index 83b06667bd939cb1a43fc21d153b394dc8920e09..6ba228460f72e0344399f8e33715895a04dcc5dd 100644 (file)
@@ -40,6 +40,7 @@
 #include "../lib/util/tevent_ntstatus.h"
 #include "util_tdb.h"
 #include "../libcli/smb/read_smb.h"
+#include "../libcli/smb/smbXcli_base.h"
 
 extern char *optarg;
 extern int optind;
@@ -71,61 +72,6 @@ bool torture_showall = False;
 
 static double create_procs(bool (*fn)(int), bool *result);
 
-
-/* return a pointer to a anonymous shared memory segment of size "size"
-   which will persist across fork() but will disappear when all processes
-   exit 
-
-   The memory is not zeroed 
-
-   This function uses system5 shared memory. It takes advantage of a property
-   that the memory is not destroyed if it is attached when the id is removed
-   */
-void *shm_setup(int size)
-{
-       int shmid;
-       void *ret;
-
-#ifdef __QNXNTO__
-       shmid = shm_open("private", O_RDWR | O_CREAT | O_EXCL, S_IRUSR | S_IWUSR);
-       if (shmid == -1) {
-               printf("can't get shared memory\n");
-               exit(1);
-       }
-       shm_unlink("private");
-       if (ftruncate(shmid, size) == -1) {
-               printf("can't set shared memory size\n");
-               exit(1);
-       }
-       ret = mmap(0, size, PROT_READ | PROT_WRITE, MAP_SHARED, shmid, 0);
-       if (ret == MAP_FAILED) {
-               printf("can't map shared memory\n");
-               exit(1);
-       }
-#else
-       shmid = shmget(IPC_PRIVATE, size, S_IRUSR | S_IWUSR);
-       if (shmid == -1) {
-               printf("can't get shared memory\n");
-               exit(1);
-       }
-       ret = (void *)shmat(shmid, 0, 0);
-       if (!ret || ret == (void *)-1) {
-               printf("can't attach to shared memory\n");
-               return NULL;
-       }
-       /* the following releases the ipc, but note that this process
-          and all its children will still have access to the memory, its
-          just that the shmid is no longer valid for other shm calls. This
-          means we don't leave behind lots of shm segments after we exit 
-
-          See Stevens "advanced programming in unix env" for details
-          */
-       shmctl(shmid, IPC_RMID, 0);
-#endif
-
-       return ret;
-}
-
 /********************************************************************
  Ensure a connection is encrypted.
 ********************************************************************/
@@ -712,7 +658,7 @@ static bool run_torture(int dummy)
 
        cli = current_cli;
 
-       cli_sockopt(cli, sockops);
+       smbXcli_conn_set_sockopt(cli->conn, sockops);
 
        ret = rw_torture(cli);
 
@@ -936,8 +882,8 @@ static bool run_readwritetest(int dummy)
        if (!torture_open_connection(&cli1, 0) || !torture_open_connection(&cli2, 1)) {
                return False;
        }
-       cli_sockopt(cli1, sockops);
-       cli_sockopt(cli2, sockops);
+       smbXcli_conn_set_sockopt(cli1->conn, sockops);
+       smbXcli_conn_set_sockopt(cli2->conn, sockops);
 
        printf("starting readwritetest\n");
 
@@ -967,7 +913,7 @@ static bool run_readwritemulti(int dummy)
 
        cli = current_cli;
 
-       cli_sockopt(cli, sockops);
+       smbXcli_conn_set_sockopt(cli->conn, sockops);
 
        printf("run_readwritemulti: fname %s\n", randomfname);
        test = rw_torture3(cli, randomfname);
@@ -992,7 +938,7 @@ static bool run_readwritelarge_internal(void)
        if (!torture_open_connection(&cli1, 0)) {
                return False;
        }
-       cli_sockopt(cli1, sockops);
+       smbXcli_conn_set_sockopt(cli1->conn, sockops);
        memset(buf,'\0',sizeof(buf));
 
        printf("starting readwritelarge_internal\n");
@@ -1122,7 +1068,7 @@ static bool run_netbench(int client)
 
        nbio_id = client;
 
-       cli_sockopt(cli, sockops);
+       smbXcli_conn_set_sockopt(cli->conn, sockops);
 
        nb_setup(cli);
 
@@ -1245,8 +1191,8 @@ static bool run_locktest1(int dummy)
        if (!torture_open_connection(&cli1, 0) || !torture_open_connection(&cli2, 1)) {
                return False;
        }
-       cli_sockopt(cli1, sockops);
-       cli_sockopt(cli2, sockops);
+       smbXcli_conn_set_sockopt(cli1->conn, sockops);
+       smbXcli_conn_set_sockopt(cli2->conn, sockops);
 
        printf("starting locktest1\n");
 
@@ -1378,7 +1324,7 @@ static bool run_tcon_test(int dummy)
        if (!torture_open_connection(&cli, 0)) {
                return False;
        }
-       cli_sockopt(cli, sockops);
+       smbXcli_conn_set_sockopt(cli->conn, sockops);
 
        printf("starting tcontest\n");
 
@@ -1490,7 +1436,7 @@ static bool run_tcon2_test(int dummy)
        if (!torture_open_connection(&cli, 0)) {
                return False;
        }
-       cli_sockopt(cli, sockops);
+       smbXcli_conn_set_sockopt(cli->conn, sockops);
 
        printf("starting tcon2 test\n");
 
@@ -1647,7 +1593,7 @@ static bool run_locktest2(int dummy)
                return False;
        }
 
-       cli_sockopt(cli, sockops);
+       smbXcli_conn_set_sockopt(cli->conn, sockops);
 
        printf("starting locktest2\n");
 
@@ -1809,8 +1755,8 @@ static bool run_locktest3(int dummy)
        if (!torture_open_connection(&cli1, 0) || !torture_open_connection(&cli2, 1)) {
                return False;
        }
-       cli_sockopt(cli1, sockops);
-       cli_sockopt(cli2, sockops);
+       smbXcli_conn_set_sockopt(cli1->conn, sockops);
+       smbXcli_conn_set_sockopt(cli2->conn, sockops);
 
        printf("starting locktest3\n");
 
@@ -1971,8 +1917,8 @@ static bool run_locktest4(int dummy)
                return False;
        }
 
-       cli_sockopt(cli1, sockops);
-       cli_sockopt(cli2, sockops);
+       smbXcli_conn_set_sockopt(cli1->conn, sockops);
+       smbXcli_conn_set_sockopt(cli2->conn, sockops);
 
        printf("starting locktest4\n");
 
@@ -2160,8 +2106,8 @@ static bool run_locktest5(int dummy)
                return False;
        }
 
-       cli_sockopt(cli1, sockops);
-       cli_sockopt(cli2, sockops);
+       smbXcli_conn_set_sockopt(cli1->conn, sockops);
+       smbXcli_conn_set_sockopt(cli2->conn, sockops);
 
        printf("starting locktest5\n");
 
@@ -2289,7 +2235,7 @@ static bool run_locktest6(int dummy)
                return False;
        }
 
-       cli_sockopt(cli, sockops);
+       smbXcli_conn_set_sockopt(cli->conn, sockops);
 
        printf("starting locktest6\n");
 
@@ -2331,7 +2277,7 @@ static bool run_locktest7(int dummy)
                return False;
        }
 
-       cli_sockopt(cli1, sockops);
+       smbXcli_conn_set_sockopt(cli1->conn, sockops);
 
        printf("starting locktest7\n");
 
@@ -2508,7 +2454,7 @@ static bool run_locktest8(int dummy)
                return False;
        }
 
-       cli_sockopt(cli1, sockops);
+       smbXcli_conn_set_sockopt(cli1->conn, sockops);
 
        printf("starting locktest8\n");
 
@@ -2579,7 +2525,7 @@ static void alarm_handler(int dummy)
 
 static void alarm_handler_parent(int dummy)
 {
-       cli_state_disconnect(alarm_cli);
+       smbXcli_conn_disconnect(alarm_cli->conn, NT_STATUS_OK);
 }
 
 static void do_local_lock(int read_fd, int write_fd)
@@ -2703,7 +2649,7 @@ static bool run_locktest9(int dummy)
                return false;
        }
 
-       cli_sockopt(cli1, sockops);
+       smbXcli_conn_set_sockopt(cli1->conn, sockops);
 
        status = cli_openx(cli1, fname, O_RDWR, DENY_NONE,
                          &fnum);
@@ -2782,8 +2728,8 @@ static bool run_fdpasstest(int dummy)
        if (!torture_open_connection(&cli1, 0) || !torture_open_connection(&cli2, 1)) {
                return False;
        }
-       cli_sockopt(cli1, sockops);
-       cli_sockopt(cli2, sockops);
+       smbXcli_conn_set_sockopt(cli1->conn, sockops);
+       smbXcli_conn_set_sockopt(cli2->conn, sockops);
 
        printf("starting fdpasstest\n");
 
@@ -2839,7 +2785,7 @@ static bool run_fdsesstest(int dummy)
 
        if (!torture_open_connection(&cli, 0))
                return False;
-       cli_sockopt(cli, sockops);
+       smbXcli_conn_set_sockopt(cli->conn, sockops);
 
        if (!torture_cli_session_setup2(cli, &new_vuid))
                return False;
@@ -2924,7 +2870,7 @@ static bool run_unlinktest(int dummy)
                return False;
        }
 
-       cli_sockopt(cli, sockops);
+       smbXcli_conn_set_sockopt(cli->conn, sockops);
 
        printf("starting unlink test\n");
 
@@ -2981,7 +2927,7 @@ static bool run_maxfidtest(int dummy)
                return False;
        }
 
-       cli_sockopt(cli, sockops);
+       smbXcli_conn_set_sockopt(cli->conn, sockops);
 
        for (i=0; i<0x11000; i++) {
                slprintf(fname,sizeof(fname)-1,"\\maxfid.%d.%d", i,(int)getpid());
@@ -3052,7 +2998,8 @@ static bool run_negprot_nowait(int dummy)
        for (i=0;i<50000;i++) {
                struct tevent_req *req;
 
-               req = cli_negprot_send(ev, ev, cli, PROTOCOL_NT1);
+               req = smbXcli_negprot_send(ev, ev, cli->conn, cli->timeout,
+                                          PROTOCOL_CORE, PROTOCOL_NT1);
                if (req == NULL) {
                        TALLOC_FREE(ev);
                        return false;
@@ -3504,7 +3451,7 @@ static bool run_oplock1(int dummy)
 
        cli_unlink(cli1, fname, FILE_ATTRIBUTE_SYSTEM | FILE_ATTRIBUTE_HIDDEN);
 
-       cli_sockopt(cli1, sockops);
+       smbXcli_conn_set_sockopt(cli1->conn, sockops);
 
        cli1->use_oplocks = True;
 
@@ -3553,7 +3500,7 @@ static bool run_oplock2(int dummy)
        size_t nread;
        NTSTATUS status;
 
-       shared_correct = (volatile bool *)shm_setup(sizeof(bool));
+       shared_correct = (volatile bool *)anonymous_shared_allocate(sizeof(bool));
        *shared_correct = True;
 
        use_level_II_oplocks = True;
@@ -3575,8 +3522,8 @@ static bool run_oplock2(int dummy)
 
        cli_unlink(cli1, fname, FILE_ATTRIBUTE_SYSTEM | FILE_ATTRIBUTE_HIDDEN);
 
-       cli_sockopt(cli1, sockops);
-       cli_sockopt(cli2, sockops);
+       smbXcli_conn_set_sockopt(cli1->conn, sockops);
+       smbXcli_conn_set_sockopt(cli2->conn, sockops);
 
        status = cli_openx(cli1, fname, O_RDWR|O_CREAT|O_EXCL, DENY_NONE,
                          &fnum1);
@@ -3717,8 +3664,8 @@ static bool run_oplock4(int dummy)
        cli_unlink(cli1, fname, FILE_ATTRIBUTE_SYSTEM | FILE_ATTRIBUTE_HIDDEN);
        cli_unlink(cli1, fname_ln, FILE_ATTRIBUTE_SYSTEM | FILE_ATTRIBUTE_HIDDEN);
 
-       cli_sockopt(cli1, sockops);
-       cli_sockopt(cli2, sockops);
+       smbXcli_conn_set_sockopt(cli1->conn, sockops);
+       smbXcli_conn_set_sockopt(cli2->conn, sockops);
 
        /* Create the file. */
        status = cli_openx(cli1, fname, O_RDWR|O_CREAT|O_EXCL, DENY_NONE,
@@ -3915,7 +3862,7 @@ static bool run_deletetest(int dummy)
                return False;
        }
 
-       cli_sockopt(cli1, sockops);
+       smbXcli_conn_set_sockopt(cli1->conn, sockops);
 
        /* Test 1 - this should delete the file on close. */
 
@@ -4003,8 +3950,11 @@ static bool run_deletetest(int dummy)
        /* This should fail with a sharing violation - open for delete is only compatible
           with SHARE_DELETE. */
 
-       if (NT_STATUS_IS_OK(cli_ntcreate(cli1, fname, 0, GENERIC_READ_ACCESS, FILE_ATTRIBUTE_NORMAL,
-                       FILE_SHARE_READ|FILE_SHARE_WRITE, FILE_OPEN, 0, 0, &fnum2))) {
+       status = cli_ntcreate(cli1, fname, 0, GENERIC_READ_ACCESS,
+                             FILE_ATTRIBUTE_NORMAL,
+                             FILE_SHARE_READ|FILE_SHARE_WRITE,
+                             FILE_OPEN, 0, 0, &fnum2);
+       if (NT_STATUS_IS_OK(status)) {
                printf("[3] open  - 2 of %s succeeded - should have failed.\n", fname);
                correct = False;
                goto fail;
@@ -4044,7 +3994,8 @@ static bool run_deletetest(int dummy)
 
        /* This should fail - file should no longer be there. */
 
-       if (NT_STATUS_IS_OK(cli_openx(cli1, fname, O_RDONLY, DENY_NONE, &fnum1))) {
+       status = cli_openx(cli1, fname, O_RDONLY, DENY_NONE, &fnum1);
+       if (NT_STATUS_IS_OK(status)) {
                printf("[3] open of %s succeeded should have been deleted on close !\n", fname);
                status = cli_close(cli1, fnum1);
                if (!NT_STATUS_IS_OK(status)) {
@@ -4233,7 +4184,7 @@ static bool run_deletetest(int dummy)
                goto fail;
        }
 
-       cli_sockopt(cli1, sockops);
+       smbXcli_conn_set_sockopt(cli1->conn, sockops);
 
        status = cli_ntcreate(cli1, fname, 0,
                             FILE_READ_DATA|FILE_WRITE_DATA|DELETE_ACCESS,
@@ -4408,7 +4359,7 @@ static bool run_deletetest_ln(int dummy)
        cli_unlink(cli, fname, FILE_ATTRIBUTE_SYSTEM | FILE_ATTRIBUTE_HIDDEN);
        cli_unlink(cli, fname_ln, FILE_ATTRIBUTE_SYSTEM | FILE_ATTRIBUTE_HIDDEN);
 
-       cli_sockopt(cli, sockops);
+       smbXcli_conn_set_sockopt(cli->conn, sockops);
 
        /* Create the file. */
        status = cli_openx(cli, fname, O_RDWR|O_CREAT|O_EXCL, DENY_NONE, &fnum);
@@ -4518,9 +4469,9 @@ static bool run_properties(int dummy)
                return False;
        }
 
-       cli_sockopt(cli, sockops);
+       smbXcli_conn_set_sockopt(cli->conn, sockops);
 
-       d_printf("Capabilities 0x%08x\n", cli_state_capabilities(cli));
+       d_printf("Capabilities 0x%08x\n", smb1cli_conn_capabilities(cli->conn));
 
        if (!torture_close_connection(cli)) {
                correct = False;
@@ -4822,7 +4773,7 @@ static bool run_pipe_number(int dummy)
                return False;
        }
 
-       cli_sockopt(cli1, sockops);
+       smbXcli_conn_set_sockopt(cli1->conn, sockops);
        while(1) {
                status = cli_ntcreate(cli1, pipe_name, 0, FILE_READ_DATA,
                                      FILE_ATTRIBUTE_NORMAL,
@@ -4865,7 +4816,7 @@ static bool run_opentest(int dummy)
        cli_setatr(cli1, fname, 0, 0);
        cli_unlink(cli1, fname, FILE_ATTRIBUTE_SYSTEM | FILE_ATTRIBUTE_HIDDEN);
 
-       cli_sockopt(cli1, sockops);
+       smbXcli_conn_set_sockopt(cli1->conn, sockops);
 
        status = cli_openx(cli1, fname, O_RDWR|O_CREAT|O_EXCL, DENY_NONE, &fnum1);
        if (!NT_STATUS_IS_OK(status)) {
@@ -5021,7 +4972,7 @@ static bool run_opentest(int dummy)
        cli_setatr(cli2, fname, 0, 0);
        cli_unlink(cli2, fname, FILE_ATTRIBUTE_SYSTEM | FILE_ATTRIBUTE_HIDDEN);
 
-       cli_sockopt(cli2, sockops);
+       smbXcli_conn_set_sockopt(cli2->conn, sockops);
 
        printf("TEST #1 testing 2 non-io opens (no delete)\n");
        status = cli_ntcreate(cli1, fname, 0, FILE_READ_ATTRIBUTES,
@@ -5351,7 +5302,7 @@ static bool run_simple_posix_open_test(int dummy)
                return false;
        }
 
-       cli_sockopt(cli1, sockops);
+       smbXcli_conn_set_sockopt(cli1->conn, sockops);
 
        status = torture_setup_unix_extensions(cli1);
        if (!NT_STATUS_IS_OK(status)) {
@@ -5400,6 +5351,13 @@ static bool run_simple_posix_open_test(int dummy)
                goto out;
        }
 
+       /* Ensure st_mode == 0600 */
+       if ((sbuf.st_ex_mode & 07777) != 0600) {
+               printf("posix_open - bad permissions 0%o != 0600\n",
+                               (unsigned int)(sbuf.st_ex_mode & 07777));
+               goto out;
+       }
+
        /* Test ftruncate - set file size back to zero. */
        status = cli_ftruncate(cli1, fnum1, 0);
        if (!NT_STATUS_IS_OK(status)) {
@@ -5630,6 +5588,26 @@ static bool run_simple_posix_open_test(int dummy)
                goto out;
        }
 
+       /* Check directory opens with a specific permission. */
+       status = cli_posix_mkdir(cli1, dname, 0700);
+       if (!NT_STATUS_IS_OK(status)) {
+               printf("POSIX mkdir of %s failed (%s)\n", dname, nt_errstr(status));
+               goto out;
+       }
+
+       /* Ensure st_mode == 0700 */
+       status = cli_posix_stat(cli1, dname, &sbuf);
+       if (!NT_STATUS_IS_OK(status)) {
+               printf("stat failed (%s)\n", nt_errstr(status));
+               goto out;
+       }
+
+       if ((sbuf.st_ex_mode & 07777) != 0700) {
+               printf("posix_mkdir - bad permissions 0%o != 0700\n",
+                               (unsigned int)(sbuf.st_ex_mode & 07777));
+               goto out;
+       }
+
        printf("Simple POSIX open test passed\n");
        correct = true;
 
@@ -5729,7 +5707,7 @@ static bool run_openattrtest(int dummy)
                return False;
        }
 
-       cli_sockopt(cli1, sockops);
+       smbXcli_conn_set_sockopt(cli1->conn, sockops);
 
        for (k = 0, i = 0; i < sizeof(open_attrs_table)/sizeof(uint32); i++) {
                cli_setatr(cli1, fname, 0, 0);
@@ -5854,7 +5832,7 @@ static bool run_dirtest(int dummy)
                return False;
        }
 
-       cli_sockopt(cli, sockops);
+       smbXcli_conn_set_sockopt(cli->conn, sockops);
 
        srandom(0);
        for (i=0;i<torture_numops;i++) {
@@ -6042,7 +6020,7 @@ bool torture_chkpath_test(int dummy)
                ret = check_error(__LINE__, status, ERRDOS, ERRbadfile,
                                  NT_STATUS_OBJECT_NAME_NOT_FOUND);
        } else {
-               printf("* chkpath on a non existant file should fail\n");
+               printf("* chkpath on a non existent file should fail\n");
                ret = False;
        }
 
@@ -6182,10 +6160,10 @@ static bool run_eatest(int dummy)
                correct = False;
        }
 
-       /* Try and delete a non existant EA. */
+       /* Try and delete a non existent EA. */
        status = cli_set_ea_path(cli, fname, "foo", "", 0);
        if (!NT_STATUS_IS_OK(status)) {
-               printf("deleting non-existant EA 'foo' should succeed. %s\n",
+               printf("deleting non-existent EA 'foo' should succeed. %s\n",
                       nt_errstr(status));
                correct = False;
        }
@@ -6212,7 +6190,7 @@ static bool run_dirtest1(int dummy)
                return False;
        }
 
-       cli_sockopt(cli, sockops);
+       smbXcli_conn_set_sockopt(cli->conn, sockops);
 
        cli_list(cli, "\\LISTDIR\\*", 0, del_fn, cli);
        cli_list(cli, "\\LISTDIR\\*", FILE_ATTRIBUTE_DIRECTORY, del_fn, cli);
@@ -6306,7 +6284,8 @@ static bool run_error_map_extract(int dummy) {
        }
        disable_spnego = false;
 
-       status = cli_negprot(c_nt, PROTOCOL_NT1);
+       status = smbXcli_negprot(c_nt->conn, c_nt->timeout, PROTOCOL_CORE,
+                                PROTOCOL_NT1);
 
        if (!NT_STATUS_IS_OK(status)) {
                printf("%s rejected the NT-error negprot (%s)\n", host,
@@ -6333,7 +6312,8 @@ static bool run_error_map_extract(int dummy) {
        disable_spnego = false;
        force_dos_errors = false;
 
-       status = cli_negprot(c_dos, PROTOCOL_NT1);
+       status = smbXcli_negprot(c_dos->conn, c_dos->timeout, PROTOCOL_CORE,
+                                PROTOCOL_NT1);
        if (!NT_STATUS_IS_OK(status)) {
                printf("%s rejected the DOS-error negprot (%s)\n", host,
                       nt_errstr(status));
@@ -6518,7 +6498,7 @@ static bool run_chain1(int dummy)
                return False;
        }
 
-       cli_sockopt(cli1, sockops);
+       smbXcli_conn_set_sockopt(cli1->conn, sockops);
 
        reqs[0] = cli_openx_create(talloc_tos(), evt, cli1, "\\test",
                                  O_CREAT|O_RDWR, 0, &smbreqs[0]);
@@ -6536,7 +6516,7 @@ static bool run_chain1(int dummy)
        if (reqs[2] == NULL) return false;
        tevent_req_set_callback(reqs[2], chain1_close_completion, &done);
 
-       status = cli_smb_chain_send(smbreqs, ARRAY_SIZE(smbreqs));
+       status = smb1cli_req_chain_submit(smbreqs, ARRAY_SIZE(smbreqs));
        if (!NT_STATUS_IS_OK(status)) {
                return false;
        }
@@ -6580,7 +6560,7 @@ static bool run_chain2(int dummy)
                return False;
        }
 
-       cli_sockopt(cli1, sockops);
+       smbXcli_conn_set_sockopt(cli1->conn, sockops);
 
        reqs[0] = cli_session_setup_guest_create(talloc_tos(), evt, cli1,
                                                 &smbreqs[0]);
@@ -6592,7 +6572,7 @@ static bool run_chain2(int dummy)
        if (reqs[1] == NULL) return false;
        tevent_req_set_callback(reqs[1], chain2_tcon_completion, &done);
 
-       status = cli_smb_chain_send(smbreqs, ARRAY_SIZE(smbreqs));
+       status = smb1cli_req_chain_submit(smbreqs, ARRAY_SIZE(smbreqs));
        if (!NT_STATUS_IS_OK(status)) {
                return false;
        }
@@ -7024,7 +7004,7 @@ static bool run_mangle1(int dummy)
                return False;
        }
 
-       cli_sockopt(cli, sockops);
+       smbXcli_conn_set_sockopt(cli->conn, sockops);
 
        status = cli_ntcreate(cli, fname, 0, GENERIC_ALL_ACCESS|DELETE_ACCESS,
                              FILE_ATTRIBUTE_NORMAL, 0, FILE_OVERWRITE_IF,
@@ -7100,7 +7080,7 @@ static bool run_windows_write(int dummy)
                return False;
        }
 
-       cli_sockopt(cli1, sockops);
+       smbXcli_conn_set_sockopt(cli1->conn, sockops);
 
        start_time = timeval_current();
 
@@ -7148,7 +7128,7 @@ static bool run_cli_echo(int dummy)
        if (!torture_open_connection(&cli, 0)) {
                return false;
        }
-       cli_sockopt(cli, sockops);
+       smbXcli_conn_set_sockopt(cli->conn, sockops);
 
        status = cli_echo(cli, 5, data_blob_const("hello", 5));
 
@@ -7172,7 +7152,7 @@ static bool run_uid_regression_test(int dummy)
                return False;
        }
 
-       cli_sockopt(cli, sockops);
+       smbXcli_conn_set_sockopt(cli->conn, sockops);
 
        /* Ok - now save then logoff our current user. */
        old_vuid = cli_state_get_uid(cli);
@@ -7324,7 +7304,7 @@ static bool run_shortname_test(int dummy)
                return False;
        }
 
-       cli_sockopt(cli, sockops);
+       smbXcli_conn_set_sockopt(cli->conn, sockops);
 
        cli_list(cli, "\\shortname\\*", 0, shortname_del_fn, cli);
        cli_list(cli, "\\shortname\\*", FILE_ATTRIBUTE_DIRECTORY, shortname_del_fn, cli);
@@ -8625,7 +8605,7 @@ static bool run_local_dbtrans(int dummy)
                        break;
                }
 
-               status = dbwrap_fetch_uint32(db, "transtest", &val);
+               status = dbwrap_fetch_uint32_bystring(db, "transtest", &val);
                if (!NT_STATUS_IS_OK(status)) {
                        printf(__location__ "dbwrap_fetch_uint32 failed: %s\n",
                               nt_errstr(status));
@@ -8638,7 +8618,7 @@ static bool run_local_dbtrans(int dummy)
                        }
                }
 
-               status = dbwrap_fetch_uint32(db, "transtest", &val2);
+               status = dbwrap_fetch_uint32_bystring(db, "transtest", &val2);
                if (!NT_STATUS_IS_OK(status)) {
                        printf(__location__ "dbwrap_fetch_uint32 failed: %s\n",
                               nt_errstr(status));
@@ -8840,13 +8820,13 @@ static double create_procs(bool (*fn)(int), bool *result)
 
        synccount = 0;
 
-       child_status = (volatile pid_t *)shm_setup(sizeof(pid_t)*torture_nprocs);
+       child_status = (volatile pid_t *)anonymous_shared_allocate(sizeof(pid_t)*torture_nprocs);
        if (!child_status) {
                printf("Failed to setup shared memory\n");
                return -1;
        }
 
-       child_status_out = (volatile bool *)shm_setup(sizeof(bool)*torture_nprocs);
+       child_status_out = (volatile bool *)anonymous_shared_allocate(sizeof(bool)*torture_nprocs);
        if (!child_status_out) {
                printf("Failed to setup result status shared memory\n");
                return -1;
@@ -9019,6 +8999,7 @@ static struct {
        { "SMB2-SESSION-REAUTH", run_smb2_session_reauth },
        { "CLEANUP1", run_cleanup1 },
        { "CLEANUP2", run_cleanup2 },
+       { "CLEANUP3", run_cleanup3 },
        { "LOCAL-SUBSTITUTE", run_local_substitute, 0},
        { "LOCAL-GENCACHE", run_local_gencache, 0},
        { "LOCAL-TALLOC-DICT", run_local_talloc_dict, 0},