Convert all uses of uint32/16/8 to _t in source3/torture.
[mat/samba.git] / source3 / torture / torture.c
index f2446d1e34f9b85b86cda41ba50fdea1edd103af..d5ec4c6fed1aa78333d4b05d5343eec95c034cc4 100644 (file)
@@ -26,7 +26,7 @@
 #include "tldap.h"
 #include "tldap_util.h"
 #include "../librpc/gen_ndr/svcctl.h"
-#include "memcache.h"
+#include "../lib/util/memcache.h"
 #include "nsswitch/winbind_client.h"
 #include "dbwrap/dbwrap.h"
 #include "dbwrap/dbwrap_open.h"
@@ -41,6 +41,7 @@
 #include "util_tdb.h"
 #include "../libcli/smb/read_smb.h"
 #include "../libcli/smb/smbXcli_base.h"
+#include "lib/sys_rw_data.h"
 
 extern char *optarg;
 extern int optind;
@@ -78,8 +79,8 @@ static double create_procs(bool (*fn)(int), bool *result);
 static bool force_cli_encryption(struct cli_state *c,
                        const char *sharename)
 {
-       uint16 major, minor;
-       uint32 caplow, caphigh;
+       uint16_t major, minor;
+       uint32_t caplow, caphigh;
        NTSTATUS status;
 
        if (!SERVER_HAS_UNIX_CIFS(c)) {
@@ -408,26 +409,21 @@ bool torture_init_connection(struct cli_state **pcli)
        return true;
 }
 
-bool torture_cli_session_setup2(struct cli_state *cli, uint16 *new_vuid)
+bool torture_cli_session_setup2(struct cli_state *cli, uint16_t *new_vuid)
 {
        uint16_t old_vuid = cli_state_get_uid(cli);
-       fstring old_user_name;
        size_t passlen = strlen(password);
        NTSTATUS status;
        bool ret;
 
-       fstrcpy(old_user_name, cli->user_name);
        cli_state_set_uid(cli, 0);
-       ret = NT_STATUS_IS_OK(cli_session_setup(cli, username,
-                                               password, passlen,
-                                               password, passlen,
-                                               workgroup));
+       status = cli_session_setup(cli, username,
+                                  password, passlen,
+                                  password, passlen,
+                                  workgroup);
+       ret = NT_STATUS_IS_OK(status);
        *new_vuid = cli_state_get_uid(cli);
        cli_state_set_uid(cli, old_vuid);
-       status = cli_set_username(cli, old_user_name);
-       if (!NT_STATUS_IS_OK(status)) {
-               return false;
-       }
        return ret;
 }
 
@@ -451,11 +447,11 @@ bool torture_close_connection(struct cli_state *c)
 
 /* check if the server produced the expected dos or nt error code */
 static bool check_both_error(int line, NTSTATUS status,
-                            uint8 eclass, uint32 ecode, NTSTATUS nterr)
+                            uint8_t eclass, uint32_t ecode, NTSTATUS nterr)
 {
        if (NT_STATUS_IS_DOS(status)) {
-               uint8 cclass;
-               uint32 num;
+               uint8_t cclass;
+               uint32_t num;
 
                /* Check DOS error */
                cclass = NT_STATUS_DOS_CLASS(status);
@@ -485,11 +481,11 @@ static bool check_both_error(int line, NTSTATUS status,
 
 /* check if the server produced the expected error code */
 static bool check_error(int line, NTSTATUS status,
-                       uint8 eclass, uint32 ecode, NTSTATUS nterr)
+                       uint8_t eclass, uint32_t ecode, NTSTATUS nterr)
 {
        if (NT_STATUS_IS_DOS(status)) {
-                uint8 cclass;
-                uint32 num;
+                uint8_t cclass;
+                uint32_t num;
 
                 /* Check DOS error */
 
@@ -521,7 +517,7 @@ static bool check_error(int line, NTSTATUS status,
 }
 
 
-static bool wait_lock(struct cli_state *c, int fnum, uint32 offset, uint32 len)
+static bool wait_lock(struct cli_state *c, int fnum, uint32_t offset, uint32_t len)
 {
        NTSTATUS status;
 
@@ -681,7 +677,7 @@ static bool rw_torture3(struct cli_state *c, char *lockfname)
        NTSTATUS status = NT_STATUS_OK;
 
        srandom(1);
-       for (i = 0; i < sizeof(buf); i += sizeof(uint32))
+       for (i = 0; i < sizeof(buf); i += sizeof(uint32_t))
        {
                SIVAL(buf, i, sys_random());
        }
@@ -710,7 +706,7 @@ static bool rw_torture3(struct cli_state *c, char *lockfname)
                {
                        status = cli_openx(c, lockfname, O_RDONLY, 
                                         DENY_NONE, &fnum);
-                       if (!NT_STATUS_IS_OK(status)) {
+                       if (NT_STATUS_IS_OK(status)) {
                                break;
                        }
                        smb_msleep(10);
@@ -1311,9 +1307,9 @@ static bool run_tcon_test(int dummy)
 {
        static struct cli_state *cli;
        const char *fname = "\\tcontest.tmp";
-       uint16 fnum1;
-       uint16 cnum1, cnum2, cnum3;
-       uint16 vuid1, vuid2;
+       uint16_t fnum1;
+       uint16_t cnum1, cnum2, cnum3;
+       uint16_t vuid1, vuid2;
        char buf[4];
        bool ret = True;
        NTSTATUS status;
@@ -1428,7 +1424,7 @@ static bool run_tcon_test(int dummy)
 static bool run_tcon2_test(int dummy)
 {
        static struct cli_state *cli;
-       uint16 cnum, max_xmit;
+       uint16_t cnum, max_xmit;
        char *service;
        NTSTATUS status;
 
@@ -1745,11 +1741,11 @@ static bool run_locktest3(int dummy)
        const char *fname = "\\lockt3.lck";
        uint16_t fnum1, fnum2;
        int i;
-       uint32 offset;
+       uint32_t offset;
        bool correct = True;
        NTSTATUS status;
 
-#define NEXT_OFFSET offset += (~(uint32)0) / torture_numops
+#define NEXT_OFFSET offset += (~(uint32_t)0) / torture_numops
 
        if (!torture_open_connection(&cli1, 0) || !torture_open_connection(&cli2, 1)) {
                return False;
@@ -2770,10 +2766,10 @@ static bool run_fdpasstest(int dummy)
 static bool run_fdsesstest(int dummy)
 {
        struct cli_state *cli;
-       uint16 new_vuid;
-       uint16 saved_vuid;
-       uint16 new_cnum;
-       uint16 saved_cnum;
+       uint16_t new_vuid;
+       uint16_t saved_vuid;
+       uint16_t new_cnum;
+       uint16_t saved_cnum;
        const char *fname = "\\fdsess.tst";
        const char *fname1 = "\\fdsess1.tst";
        uint16_t fnum1;
@@ -3087,7 +3083,7 @@ static bool run_randomipc(int dummy)
 
                cli_api(cli, 
                        param, param_len, 8,  
-                       NULL, 0, BUFFER_SIZE, 
+                       NULL, 0, CLI_BUFFER_SIZE,
                        &rparam, &rprcnt,     
                        &rdata, &rdrcnt);
                if (i % 100 == 0) {
@@ -3110,7 +3106,7 @@ static bool run_randomipc(int dummy)
 
 
 
-static void browse_callback(const char *sname, uint32 stype, 
+static void browse_callback(const char *sname, uint32_t stype,
                            const char *comment, void *state)
 {
        printf("\t%20.20s %08x %s\n", sname, stype, comment);
@@ -3384,7 +3380,7 @@ static bool run_trans2test(int dummy)
 static NTSTATUS new_trans(struct cli_state *pcli, int fnum, int level)
 {
        uint8_t *buf = NULL;
-       uint32 len;
+       uint32_t len;
        NTSTATUS status;
 
        status = cli_qfileinfo(talloc_tos(), pcli, fnum, level, 0,
@@ -3394,7 +3390,7 @@ static NTSTATUS new_trans(struct cli_state *pcli, int fnum, int level)
                       nt_errstr(status));
        } else {
                printf("qfileinfo: level %d, len = %u\n", level, len);
-               dump_data(0, (uint8 *)buf, len);
+               dump_data(0, (uint8_t *)buf, len);
                printf("\n");
        }
        TALLOC_FREE(buf);
@@ -3873,7 +3869,7 @@ static bool run_deletetest(int dummy)
 
        status = cli_ntcreate(cli1, fname, 0, GENERIC_ALL_ACCESS|DELETE_ACCESS,
                              FILE_ATTRIBUTE_NORMAL, 0, FILE_OVERWRITE_IF,
-                             FILE_DELETE_ON_CLOSE, 0, &fnum1);
+                             FILE_DELETE_ON_CLOSE, 0, &fnum1, NULL);
        if (!NT_STATUS_IS_OK(status)) {
                printf("[1] open of %s failed (%s)\n", fname, nt_errstr(status));
                goto fail;
@@ -3900,7 +3896,7 @@ static bool run_deletetest(int dummy)
 
        status = cli_ntcreate(cli1, fname, 0, GENERIC_ALL_ACCESS,
                              FILE_ATTRIBUTE_NORMAL, FILE_SHARE_NONE,
-                             FILE_OVERWRITE_IF, 0, 0, &fnum1);
+                             FILE_OVERWRITE_IF, 0, 0, &fnum1, NULL);
        if (!NT_STATUS_IS_OK(status)) {
                printf("[2] open of %s failed (%s)\n", fname, nt_errstr(status));
                goto fail;
@@ -3938,7 +3934,7 @@ static bool run_deletetest(int dummy)
        status = cli_ntcreate(cli1, fname, 0, GENERIC_ALL_ACCESS,
                              FILE_ATTRIBUTE_NORMAL,
                              FILE_SHARE_READ|FILE_SHARE_WRITE,
-                             FILE_OVERWRITE_IF, 0, 0, &fnum1);
+                             FILE_OVERWRITE_IF, 0, 0, &fnum1, NULL);
        if (!NT_STATUS_IS_OK(status)) {
                printf("[3] open - 1 of %s failed (%s)\n", fname, nt_errstr(status));
                goto fail;
@@ -3950,7 +3946,7 @@ static bool run_deletetest(int dummy)
        status = cli_ntcreate(cli1, fname, 0, GENERIC_READ_ACCESS,
                              FILE_ATTRIBUTE_NORMAL,
                              FILE_SHARE_READ|FILE_SHARE_WRITE,
-                             FILE_OPEN, 0, 0, &fnum2);
+                             FILE_OPEN, 0, 0, &fnum2, NULL);
        if (NT_STATUS_IS_OK(status)) {
                printf("[3] open  - 2 of %s succeeded - should have failed.\n", fname);
                goto fail;
@@ -3960,7 +3956,7 @@ static bool run_deletetest(int dummy)
        status = cli_ntcreate(cli1, fname, 0, GENERIC_READ_ACCESS,
                             FILE_ATTRIBUTE_NORMAL,
                             FILE_SHARE_READ|FILE_SHARE_WRITE|FILE_SHARE_DELETE,
-                            FILE_OPEN, 0, 0, &fnum2);
+                            FILE_OPEN, 0, 0, &fnum2, NULL);
        if (!NT_STATUS_IS_OK(status)) {
                printf("[3] open  - 3 of %s failed (%s)\n", fname, nt_errstr(status));
                goto fail;
@@ -4007,7 +4003,7 @@ static bool run_deletetest(int dummy)
                              FILE_READ_DATA|FILE_WRITE_DATA|DELETE_ACCESS,
                              FILE_ATTRIBUTE_NORMAL,
                              FILE_SHARE_READ|FILE_SHARE_WRITE,
-                             FILE_OVERWRITE_IF, 0, 0, &fnum1);
+                             FILE_OVERWRITE_IF, 0, 0, &fnum1, NULL);
        if (!NT_STATUS_IS_OK(status)) {
                printf("[4] open of %s failed (%s)\n", fname, nt_errstr(status));
                goto fail;
@@ -4017,7 +4013,7 @@ static bool run_deletetest(int dummy)
        status = cli_ntcreate(cli1, fname, 0, GENERIC_READ_ACCESS,
                             FILE_ATTRIBUTE_NORMAL,
                             FILE_SHARE_READ|FILE_SHARE_WRITE|FILE_SHARE_DELETE,
-                            FILE_OPEN, 0, 0, &fnum2);
+                            FILE_OPEN, 0, 0, &fnum2, NULL);
        if (!NT_STATUS_IS_OK(status)) {
                printf("[4] open  - 2 of %s failed (%s)\n", fname, nt_errstr(status));
                goto fail;
@@ -4039,7 +4035,7 @@ static bool run_deletetest(int dummy)
        status = cli_ntcreate(cli1, fname, 0, GENERIC_READ_ACCESS,
                              FILE_ATTRIBUTE_NORMAL,
                              FILE_SHARE_READ|FILE_SHARE_WRITE|FILE_SHARE_DELETE,
-                             FILE_OPEN, 0, 0, &fnum2);
+                             FILE_OPEN, 0, 0, &fnum2, NULL);
        if (NT_STATUS_IS_OK(status)) {
                printf("[4] open  - 3 of %s succeeded ! Should have failed.\n", fname );
                goto fail;
@@ -4086,7 +4082,7 @@ static bool run_deletetest(int dummy)
        status = cli_ntcreate(cli1, fname, 0, FILE_READ_DATA|FILE_WRITE_DATA,
                             FILE_ATTRIBUTE_NORMAL,
                             FILE_SHARE_READ|FILE_SHARE_WRITE|FILE_SHARE_DELETE,
-                            FILE_OVERWRITE_IF, 0, 0, &fnum1);
+                            FILE_OVERWRITE_IF, 0, 0, &fnum1, NULL);
        if (!NT_STATUS_IS_OK(status)) {
                printf("[6] open of %s failed (%s)\n", fname,
                       nt_errstr(status));
@@ -4116,7 +4112,7 @@ static bool run_deletetest(int dummy)
        status = cli_ntcreate(cli1, fname, 0,
                              FILE_READ_DATA|FILE_WRITE_DATA|DELETE_ACCESS,
                              FILE_ATTRIBUTE_NORMAL, 0, FILE_OVERWRITE_IF,
-                             0, 0, &fnum1);
+                             0, 0, &fnum1, NULL);
        if (!NT_STATUS_IS_OK(status)) {
                printf("[7] open of %s failed (%s)\n", fname, nt_errstr(status));
                goto fail;
@@ -4170,7 +4166,7 @@ static bool run_deletetest(int dummy)
                             FILE_READ_DATA|FILE_WRITE_DATA|DELETE_ACCESS,
                             FILE_ATTRIBUTE_NORMAL,
                             FILE_SHARE_READ|FILE_SHARE_WRITE|FILE_SHARE_DELETE,
-                            FILE_OVERWRITE_IF, 0, 0, &fnum1);
+                            FILE_OVERWRITE_IF, 0, 0, &fnum1, NULL);
        if (!NT_STATUS_IS_OK(status)) {
                printf("[8] open 1 of %s failed (%s)\n", fname, nt_errstr(status));
                goto fail;
@@ -4180,7 +4176,7 @@ static bool run_deletetest(int dummy)
                             FILE_READ_DATA|FILE_WRITE_DATA|DELETE_ACCESS,
                             FILE_ATTRIBUTE_NORMAL,
                             FILE_SHARE_READ|FILE_SHARE_WRITE|FILE_SHARE_DELETE,
-                            FILE_OPEN, 0, 0, &fnum2);
+                            FILE_OPEN, 0, 0, &fnum2, NULL);
        if (!NT_STATUS_IS_OK(status)) {
                printf("[8] open 2 of %s failed (%s)\n", fname, nt_errstr(status));
                goto fail;
@@ -4220,7 +4216,7 @@ static bool run_deletetest(int dummy)
                              FILE_ATTRIBUTE_NORMAL,
                              FILE_SHARE_NONE,
                              FILE_OVERWRITE_IF,
-                             FILE_DELETE_ON_CLOSE, 0, &fnum1);
+                             FILE_DELETE_ON_CLOSE, 0, &fnum1, NULL);
        if (NT_STATUS_IS_OK(status)) {
                printf("[9] open of %s succeeded should have failed!\n", fname);
                goto fail;
@@ -4234,7 +4230,7 @@ static bool run_deletetest(int dummy)
                             FILE_READ_DATA|FILE_WRITE_DATA|DELETE_ACCESS,
                             FILE_ATTRIBUTE_NORMAL, FILE_SHARE_NONE,
                             FILE_OVERWRITE_IF, FILE_DELETE_ON_CLOSE,
-                            0, &fnum1);
+                            0, &fnum1, NULL);
        if (!NT_STATUS_IS_OK(status)) {
                printf("[10] open of %s failed (%s)\n", fname, nt_errstr(status));
                goto fail;
@@ -4266,7 +4262,7 @@ static bool run_deletetest(int dummy)
        /* Create a readonly file. */
        status = cli_ntcreate(cli1, fname, 0, FILE_READ_DATA|FILE_WRITE_DATA,
                              FILE_ATTRIBUTE_READONLY, FILE_SHARE_NONE,
-                             FILE_OVERWRITE_IF, 0, 0, &fnum1);
+                             FILE_OVERWRITE_IF, 0, 0, &fnum1, NULL);
        if (!NT_STATUS_IS_OK(status)) {
                printf("[11] open of %s failed (%s)\n", fname, nt_errstr(status));
                goto fail;
@@ -4283,7 +4279,7 @@ static bool run_deletetest(int dummy)
                             FILE_READ_ATTRIBUTES|DELETE_ACCESS,
                             0,
                             FILE_SHARE_READ|FILE_SHARE_WRITE|FILE_SHARE_DELETE,
-                            FILE_OPEN, 0, 0, &fnum1);
+                            FILE_OPEN, 0, 0, &fnum1, NULL);
        if (!NT_STATUS_IS_OK(status)) {
                printf("[11] open of %s failed: %s\n", fname, nt_errstr(status));
                goto fail;
@@ -4306,7 +4302,7 @@ static bool run_deletetest(int dummy)
                              FILE_ATTRIBUTE_NORMAL,
                              FILE_SHARE_READ|FILE_SHARE_WRITE,
                              FILE_OVERWRITE_IF,
-                             FILE_DELETE_ON_CLOSE, 0, &fnum1);
+                             FILE_DELETE_ON_CLOSE, 0, &fnum1, NULL);
        if (!NT_STATUS_IS_OK(status)) {
                printf("[12] open 1 of %s failed (%s)\n", fname, nt_errstr(status));
                goto fail;
@@ -4315,7 +4311,7 @@ static bool run_deletetest(int dummy)
        status = cli_ntcreate(cli1, fname, 0, GENERIC_READ_ACCESS,
                              FILE_ATTRIBUTE_NORMAL,
                              FILE_SHARE_READ|FILE_SHARE_WRITE|FILE_SHARE_DELETE,
-                             FILE_OPEN, 0, 0, &fnum2);
+                             FILE_OPEN, 0, 0, &fnum2, NULL);
        if (!NT_STATUS_IS_OK(status)) {
                printf("[12] open 2 of %s failed(%s).\n", fname, nt_errstr(status));
                goto fail;
@@ -4337,7 +4333,7 @@ static bool run_deletetest(int dummy)
        status = cli_ntcreate(cli1, fname, 0, GENERIC_READ_ACCESS,
                              FILE_ATTRIBUTE_NORMAL,
                              FILE_SHARE_READ|FILE_SHARE_WRITE|FILE_SHARE_DELETE,
-                             FILE_OPEN, 0, 0, &fnum2);
+                             FILE_OPEN, 0, 0, &fnum2, NULL);
        if (NT_STATUS_IS_OK(status)) {
                printf("[12] open 3 of %s succeeded - should fail).\n", fname);
                goto fail;
@@ -4352,7 +4348,7 @@ static bool run_deletetest(int dummy)
        status = cli_ntcreate(cli1, fname, 0, GENERIC_READ_ACCESS,
                              FILE_ATTRIBUTE_NORMAL,
                              FILE_SHARE_READ|FILE_SHARE_WRITE|FILE_SHARE_DELETE,
-                             FILE_OPEN, 0, 0, &fnum2);
+                             FILE_OPEN, 0, 0, &fnum2, NULL);
        if (!NT_STATUS_IS_OK(status)) {
                printf("[12] open 4 of %s failed (%s)\n", fname, nt_errstr(status));
                goto fail;
@@ -4377,7 +4373,7 @@ static bool run_deletetest(int dummy)
        status = cli_ntcreate(cli1, fname, 0, GENERIC_READ_ACCESS,
                              FILE_ATTRIBUTE_NORMAL,
                              FILE_SHARE_READ|FILE_SHARE_WRITE|FILE_SHARE_DELETE,
-                             FILE_OPEN, 0, 0, &fnum2);
+                             FILE_OPEN, 0, 0, &fnum2, NULL);
        if (NT_STATUS_IS_OK(status)) {
                printf("[12] open 5 of %s succeeded - should fail).\n", fname);
                goto fail;
@@ -4460,7 +4456,7 @@ static bool run_deletetest_ln(int dummy)
        status = cli_ntcreate(cli, fname, 0, FILE_READ_DATA,
                        FILE_ATTRIBUTE_NORMAL,
                        FILE_SHARE_READ|FILE_SHARE_WRITE|FILE_SHARE_DELETE,
-                       FILE_OPEN_IF, 0, 0, &fnum);
+                       FILE_OPEN_IF, 0, 0, &fnum, NULL);
        if (!NT_STATUS_IS_OK(status)) {
                printf("ntcreate of %s failed (%s)\n", fname, nt_errstr(status));
                return false;
@@ -4470,7 +4466,7 @@ static bool run_deletetest_ln(int dummy)
        status = cli_ntcreate(cli, fname_ln, 0, DELETE_ACCESS,
                        FILE_ATTRIBUTE_NORMAL,
                        FILE_SHARE_READ|FILE_SHARE_WRITE|FILE_SHARE_DELETE,
-                       FILE_OPEN_IF, 0, 0, &fnum1);
+                       FILE_OPEN_IF, 0, 0, &fnum1, NULL);
        if (!NT_STATUS_IS_OK(status)) {
                printf("ntcreate of %s failed (%s)\n", fname_ln, nt_errstr(status));
                return false;
@@ -4595,7 +4591,7 @@ static bool run_xcopy(int dummy)
 
        status = cli_ntcreate(cli1, fname, 0, FIRST_DESIRED_ACCESS,
                              FILE_ATTRIBUTE_ARCHIVE, FILE_SHARE_NONE,
-                             FILE_OVERWRITE_IF, 0x4044, 0, &fnum1);
+                             FILE_OVERWRITE_IF, 0x4044, 0, &fnum1, NULL);
        if (!NT_STATUS_IS_OK(status)) {
                printf("First open failed - %s\n", nt_errstr(status));
                return False;
@@ -4603,7 +4599,7 @@ static bool run_xcopy(int dummy)
 
        status = cli_ntcreate(cli1, fname, 0, SECOND_DESIRED_ACCESS, 0,
                             FILE_SHARE_READ|FILE_SHARE_WRITE|FILE_SHARE_DELETE,
-                            FILE_OPEN, 0x200000, 0, &fnum2);
+                            FILE_OPEN, 0x200000, 0, &fnum2, NULL);
        if (!NT_STATUS_IS_OK(status)) {
                printf("second open failed - %s\n", nt_errstr(status));
                return False;
@@ -4640,7 +4636,7 @@ static bool run_rename(int dummy)
 
        status = cli_ntcreate(cli1, fname, 0, GENERIC_READ_ACCESS,
                              FILE_ATTRIBUTE_NORMAL, FILE_SHARE_READ,
-                             FILE_OVERWRITE_IF, 0, 0, &fnum1);
+                             FILE_OVERWRITE_IF, 0, 0, &fnum1, NULL);
        if (!NT_STATUS_IS_OK(status)) {
                printf("First open failed - %s\n", nt_errstr(status));
                return False;
@@ -4668,7 +4664,7 @@ static bool run_rename(int dummy)
 #else
                              FILE_SHARE_DELETE|FILE_SHARE_READ,
 #endif
-                             FILE_OVERWRITE_IF, 0, 0, &fnum1);
+                             FILE_OVERWRITE_IF, 0, 0, &fnum1, NULL);
        if (!NT_STATUS_IS_OK(status)) {
                printf("Second open failed - %s\n", nt_errstr(status));
                return False;
@@ -4693,7 +4689,7 @@ static bool run_rename(int dummy)
 
        status = cli_ntcreate(cli1, fname, 0, READ_CONTROL_ACCESS,
                              FILE_ATTRIBUTE_NORMAL, FILE_SHARE_NONE,
-                             FILE_OVERWRITE_IF, 0, 0, &fnum1);
+                             FILE_OVERWRITE_IF, 0, 0, &fnum1, NULL);
        if (!NT_STATUS_IS_OK(status)) {
                printf("Third open failed - %s\n", nt_errstr(status));
                return False;
@@ -4705,7 +4701,7 @@ static bool run_rename(int dummy)
        uint16_t fnum2;
 
        if (!NT_STATUS_IS_OK(cli_ntcreate(cli1, fname, 0, DELETE_ACCESS, FILE_ATTRIBUTE_NORMAL,
-                                  FILE_SHARE_NONE, FILE_OVERWRITE_IF, 0, 0, &fnum2))) {
+                                  FILE_SHARE_NONE, FILE_OVERWRITE_IF, 0, 0, &fnum2, NULL))) {
                printf("Fourth open failed - %s\n", cli_errstr(cli1));
                return False;
        }
@@ -4743,7 +4739,7 @@ static bool run_rename(int dummy)
        status = cli_ntcreate(cli1, fname, 0, GENERIC_READ_ACCESS,
                              FILE_ATTRIBUTE_NORMAL,
                              FILE_SHARE_READ | FILE_SHARE_WRITE,
-                             FILE_OVERWRITE_IF, 0, 0, &fnum1);
+                             FILE_OVERWRITE_IF, 0, 0, &fnum1, NULL);
        if (!NT_STATUS_IS_OK(status)) {
                printf("Fourth open failed - %s\n", nt_errstr(status));
                return False;
@@ -4771,7 +4767,7 @@ static bool run_rename(int dummy)
        status = cli_ntcreate(cli1, fname, 0, GENERIC_READ_ACCESS,
                         FILE_ATTRIBUTE_NORMAL,
                         FILE_SHARE_READ | FILE_SHARE_WRITE | FILE_SHARE_DELETE,
-                        FILE_OVERWRITE_IF, 0, 0, &fnum1);
+                        FILE_OVERWRITE_IF, 0, 0, &fnum1, NULL);
        if (!NT_STATUS_IS_OK(status)) {
                printf("Fifth open failed - %s\n", nt_errstr(status));
                return False;
@@ -4790,7 +4786,8 @@ static bool run_rename(int dummy)
          */
 
         /* if (!NT_STATUS_OP(cli_ntcreate(cli1, fname, 0, GENERIC_READ_ACCESS, FILE_ATTRIBUTE_NORMAL,
-                                  FILE_SHARE_READ | FILE_SHARE_WRITE | FILE_SHARE_DELETE, FILE_OVERWRITE_IF, 0, 0, &fnum2))) {
+                                  FILE_SHARE_READ | FILE_SHARE_WRITE | FILE_SHARE_DELETE,
+                                  FILE_OVERWRITE_IF, 0, 0, &fnum2, NULL))) {
           printf("Opening original file after rename of open file fails: %s\n",
               cli_errstr(cli1));
         }
@@ -4853,7 +4850,7 @@ static bool run_pipe_number(int dummy)
                status = cli_ntcreate(cli1, pipe_name, 0, FILE_READ_DATA,
                                      FILE_ATTRIBUTE_NORMAL,
                                      FILE_SHARE_READ|FILE_SHARE_WRITE,
-                                     FILE_OPEN_IF, 0, 0, &fnum);
+                                     FILE_OPEN_IF, 0, 0, &fnum, NULL);
                if (!NT_STATUS_IS_OK(status)) {
                        printf("Open of pipe %s failed with error (%s)\n", pipe_name, nt_errstr(status));
                        break;
@@ -5052,7 +5049,7 @@ static bool run_opentest(int dummy)
        printf("TEST #1 testing 2 non-io opens (no delete)\n");
        status = cli_ntcreate(cli1, fname, 0, FILE_READ_ATTRIBUTES,
                              FILE_ATTRIBUTE_NORMAL, FILE_SHARE_NONE,
-                             FILE_OVERWRITE_IF, 0, 0, &fnum1);
+                             FILE_OVERWRITE_IF, 0, 0, &fnum1, NULL);
        if (!NT_STATUS_IS_OK(status)) {
                printf("TEST #1 open 1 of %s failed (%s)\n", fname, nt_errstr(status));
                return False;
@@ -5060,7 +5057,7 @@ static bool run_opentest(int dummy)
 
        status = cli_ntcreate(cli2, fname, 0, FILE_READ_ATTRIBUTES,
                              FILE_ATTRIBUTE_NORMAL, FILE_SHARE_NONE,
-                             FILE_OPEN_IF, 0, 0, &fnum2);
+                             FILE_OPEN_IF, 0, 0, &fnum2, NULL);
        if (!NT_STATUS_IS_OK(status)) {
                printf("TEST #1 open 2 of %s failed (%s)\n", fname, nt_errstr(status));
                return False;
@@ -5087,7 +5084,7 @@ static bool run_opentest(int dummy)
        status = cli_ntcreate(cli1, fname, 0,
                              DELETE_ACCESS|FILE_READ_ATTRIBUTES,
                              FILE_ATTRIBUTE_NORMAL, FILE_SHARE_NONE,
-                             FILE_OVERWRITE_IF, 0, 0, &fnum1);
+                             FILE_OVERWRITE_IF, 0, 0, &fnum1, NULL);
        if (!NT_STATUS_IS_OK(status)) {
                printf("TEST #2 open 1 of %s failed (%s)\n", fname, nt_errstr(status));
                return False;
@@ -5095,7 +5092,7 @@ static bool run_opentest(int dummy)
 
        status = cli_ntcreate(cli2, fname, 0, FILE_READ_ATTRIBUTES,
                              FILE_ATTRIBUTE_NORMAL, FILE_SHARE_NONE,
-                             FILE_OPEN_IF, 0, 0, &fnum2);
+                             FILE_OPEN_IF, 0, 0, &fnum2, NULL);
        if (!NT_STATUS_IS_OK(status)) {
                printf("TEST #2 open 2 of %s failed (%s)\n", fname, nt_errstr(status));
                return False;
@@ -5121,7 +5118,7 @@ static bool run_opentest(int dummy)
 
        status = cli_ntcreate(cli1, fname, 0, FILE_READ_ATTRIBUTES,
                              FILE_ATTRIBUTE_NORMAL, FILE_SHARE_NONE,
-                             FILE_OVERWRITE_IF, 0, 0, &fnum1);
+                             FILE_OVERWRITE_IF, 0, 0, &fnum1, NULL);
        if (!NT_STATUS_IS_OK(status)) {
                printf("TEST #3 open 1 of %s failed (%s)\n", fname, nt_errstr(status));
                return False;
@@ -5130,7 +5127,7 @@ static bool run_opentest(int dummy)
        status = cli_ntcreate(cli2, fname, 0,
                              DELETE_ACCESS|FILE_READ_ATTRIBUTES,
                              FILE_ATTRIBUTE_NORMAL, FILE_SHARE_NONE,
-                             FILE_OPEN_IF, 0, 0, &fnum2);
+                             FILE_OPEN_IF, 0, 0, &fnum2, NULL);
        if (!NT_STATUS_IS_OK(status)) {
                printf("TEST #3 open 2 of %s failed (%s)\n", fname, nt_errstr(status));
                return False;
@@ -5157,7 +5154,7 @@ static bool run_opentest(int dummy)
        status = cli_ntcreate(cli1, fname, 0,
                               DELETE_ACCESS|FILE_READ_ATTRIBUTES,
                               FILE_ATTRIBUTE_NORMAL, FILE_SHARE_NONE,
-                              FILE_OVERWRITE_IF, 0, 0, &fnum1);
+                              FILE_OVERWRITE_IF, 0, 0, &fnum1, NULL);
        if (!NT_STATUS_IS_OK(status)) {
                printf("TEST #4 open 1 of %s failed (%s)\n", fname, nt_errstr(status));
                return False;
@@ -5166,7 +5163,7 @@ static bool run_opentest(int dummy)
        status = cli_ntcreate(cli2, fname, 0,
                              DELETE_ACCESS|FILE_READ_ATTRIBUTES,
                              FILE_ATTRIBUTE_NORMAL, FILE_SHARE_NONE,
-                             FILE_OPEN_IF, 0, 0, &fnum2);
+                             FILE_OPEN_IF, 0, 0, &fnum2, NULL);
        if (NT_STATUS_IS_OK(status)) {
                printf("TEST #4 open 2 of %s SUCCEEDED - should have failed (%s)\n", fname, nt_errstr(status));
                return False;
@@ -5189,7 +5186,7 @@ static bool run_opentest(int dummy)
        status = cli_ntcreate(cli1, fname, 0,
                              DELETE_ACCESS|FILE_READ_ATTRIBUTES,
                              FILE_ATTRIBUTE_NORMAL, FILE_SHARE_DELETE,
-                             FILE_OVERWRITE_IF, 0, 0, &fnum1);
+                             FILE_OVERWRITE_IF, 0, 0, &fnum1, NULL);
        if (!NT_STATUS_IS_OK(status)) {
                printf("TEST #5 open 1 of %s failed (%s)\n", fname, nt_errstr(status));
                return False;
@@ -5198,7 +5195,7 @@ static bool run_opentest(int dummy)
        status = cli_ntcreate(cli2, fname, 0,
                              DELETE_ACCESS|FILE_READ_ATTRIBUTES,
                              FILE_ATTRIBUTE_NORMAL, FILE_SHARE_DELETE,
-                             FILE_OPEN_IF, 0, 0, &fnum2);
+                             FILE_OPEN_IF, 0, 0, &fnum2, NULL);
        if (!NT_STATUS_IS_OK(status)) {
                printf("TEST #5 open 2 of %s failed (%s)\n", fname, nt_errstr(status));
                return False;
@@ -5224,7 +5221,7 @@ static bool run_opentest(int dummy)
 
        status = cli_ntcreate(cli1, fname, 0, FILE_READ_DATA,
                              FILE_ATTRIBUTE_NORMAL, FILE_SHARE_NONE,
-                             FILE_OVERWRITE_IF, 0, 0, &fnum1);
+                             FILE_OVERWRITE_IF, 0, 0, &fnum1, NULL);
        if (!NT_STATUS_IS_OK(status)) {
                printf("TEST #6 open 1 of %s failed (%s)\n", fname, nt_errstr(status));
                return False;
@@ -5232,7 +5229,7 @@ static bool run_opentest(int dummy)
 
        status = cli_ntcreate(cli2, fname, 0, FILE_READ_ATTRIBUTES,
                              FILE_ATTRIBUTE_NORMAL, FILE_SHARE_READ,
-                             FILE_OPEN_IF, 0, 0, &fnum2);
+                             FILE_OPEN_IF, 0, 0, &fnum2, NULL);
        if (!NT_STATUS_IS_OK(status)) {
                printf("TEST #6 open 2 of %s failed (%s)\n", fname, nt_errstr(status));
                return False;
@@ -5258,7 +5255,7 @@ static bool run_opentest(int dummy)
 
        status = cli_ntcreate(cli1, fname, 0, FILE_READ_DATA,
                              FILE_ATTRIBUTE_NORMAL, FILE_SHARE_NONE,
-                             FILE_OVERWRITE_IF, 0, 0, &fnum1);
+                             FILE_OVERWRITE_IF, 0, 0, &fnum1, NULL);
        if (!NT_STATUS_IS_OK(status)) {
                printf("TEST #7 open 1 of %s failed (%s)\n", fname, nt_errstr(status));
                return False;
@@ -5268,7 +5265,7 @@ static bool run_opentest(int dummy)
                              DELETE_ACCESS|FILE_READ_ATTRIBUTES,
                              FILE_ATTRIBUTE_NORMAL,
                              FILE_SHARE_READ|FILE_SHARE_DELETE,
-                             FILE_OPEN_IF, 0, 0, &fnum2);
+                             FILE_OPEN_IF, 0, 0, &fnum2, NULL);
        if (NT_STATUS_IS_OK(status)) {
                printf("TEST #7 open 2 of %s SUCCEEDED - should have failed (%s)\n", fname, nt_errstr(status));
                return False;
@@ -5289,7 +5286,7 @@ static bool run_opentest(int dummy)
        printf("TEST #8 testing open without WRITE_ATTRIBUTES, updating close write time.\n");
        status = cli_ntcreate(cli1, fname, 0, FILE_WRITE_DATA, FILE_ATTRIBUTE_NORMAL,
                                FILE_SHARE_READ|FILE_SHARE_WRITE|FILE_SHARE_DELETE,
-                               FILE_OVERWRITE_IF, 0, 0, &fnum1);
+                               FILE_OVERWRITE_IF, 0, 0, &fnum1, NULL);
        if (!NT_STATUS_IS_OK(status)) {
                printf("TEST #8 open of %s failed (%s)\n", fname, nt_errstr(status));
                correct = false;
@@ -5325,8 +5322,8 @@ static bool run_opentest(int dummy)
 
 NTSTATUS torture_setup_unix_extensions(struct cli_state *cli)
 {
-       uint16 major, minor;
-       uint32 caplow, caphigh;
+       uint16_t major, minor;
+       uint32_t caplow, caphigh;
        NTSTATUS status;
 
        if (!SERVER_HAS_UNIX_CIFS(cli)) {
@@ -5700,7 +5697,7 @@ static bool run_simple_posix_open_test(int dummy)
                        FILE_READ_DATA|FILE_WRITE_DATA, 0,
                        FILE_SHARE_READ|FILE_SHARE_WRITE|FILE_SHARE_DELETE,
                        FILE_CREATE,
-                       0x0, 0x0, &fnum2);
+                       0x0, 0x0, &fnum2, NULL);
        if (!NT_STATUS_IS_OK(status)) {
                printf("Windows create of %s failed (%s)\n", fname_windows,
                        nt_errstr(status));
@@ -5754,7 +5751,7 @@ static bool run_simple_posix_open_test(int dummy)
 }
 
 
-static uint32 open_attrs_table[] = {
+static uint32_t open_attrs_table[] = {
                FILE_ATTRIBUTE_NORMAL,
                FILE_ATTRIBUTE_ARCHIVE,
                FILE_ATTRIBUTE_READONLY,
@@ -5776,9 +5773,9 @@ static uint32 open_attrs_table[] = {
 
 struct trunc_open_results {
        unsigned int num;
-       uint32 init_attr;
-       uint32 trunc_attr;
-       uint32 result_attr;
+       uint32_t init_attr;
+       uint32_t trunc_attr;
+       uint32_t result_attr;
 };
 
 static struct trunc_open_results attr_results[] = {
@@ -5816,7 +5813,7 @@ static bool run_openattrtest(int dummy)
        const char *fname = "\\openattr.file";
        uint16_t fnum1;
        bool correct = True;
-       uint16 attr;
+       uint16_t attr;
        unsigned int i, j, k, l;
        NTSTATUS status;
 
@@ -5828,13 +5825,13 @@ static bool run_openattrtest(int dummy)
 
        smbXcli_conn_set_sockopt(cli1->conn, sockops);
 
-       for (k = 0, i = 0; i < sizeof(open_attrs_table)/sizeof(uint32); i++) {
+       for (k = 0, i = 0; i < sizeof(open_attrs_table)/sizeof(uint32_t); i++) {
                cli_setatr(cli1, fname, 0, 0);
                cli_unlink(cli1, fname, FILE_ATTRIBUTE_SYSTEM | FILE_ATTRIBUTE_HIDDEN);
 
                status = cli_ntcreate(cli1, fname, 0, FILE_WRITE_DATA,
                                       open_attrs_table[i], FILE_SHARE_NONE,
-                                      FILE_OVERWRITE_IF, 0, 0, &fnum1);
+                                      FILE_OVERWRITE_IF, 0, 0, &fnum1, NULL);
                if (!NT_STATUS_IS_OK(status)) {
                        printf("open %d (1) of %s failed (%s)\n", i, fname, nt_errstr(status));
                        return False;
@@ -5846,12 +5843,12 @@ static bool run_openattrtest(int dummy)
                        return False;
                }
 
-               for (j = 0; j < sizeof(open_attrs_table)/sizeof(uint32); j++) {
+               for (j = 0; j < sizeof(open_attrs_table)/sizeof(uint32_t); j++) {
                        status = cli_ntcreate(cli1, fname, 0,
                                              FILE_READ_DATA|FILE_WRITE_DATA,
                                              open_attrs_table[j],
                                              FILE_SHARE_NONE, FILE_OVERWRITE,
-                                             0, 0, &fnum1);
+                                             0, 0, &fnum1, NULL);
                        if (!NT_STATUS_IS_OK(status)) {
                                for (l = 0; l < sizeof(attr_results)/sizeof(struct trunc_open_results); l++) {
                                        if (attr_results[l].num == k) {
@@ -6052,7 +6049,7 @@ bool torture_ioctl_test(int dummy)
        for (device=0;device<0x100;device++) {
                printf("ioctl test with device = 0x%x\n", device);
                for (function=0;function<0x100;function++) {
-                       uint32 code = (device<<16) | function;
+                       uint32_t code = (device<<16) | function;
 
                        status = cli_raw_ioctl(cli, fnum, code, &blob);
 
@@ -6187,7 +6184,7 @@ static bool run_eatest(int dummy)
        status = cli_ntcreate(cli, fname, 0,
                               FIRST_DESIRED_ACCESS, FILE_ATTRIBUTE_ARCHIVE,
                               FILE_SHARE_NONE, FILE_OVERWRITE_IF,
-                              0x4044, 0, &fnum);
+                              0x4044, 0, &fnum, NULL);
        if (!NT_STATUS_IS_OK(status)) {
                printf("open failed - %s\n", nt_errstr(status));
                talloc_destroy(mem_ctx);
@@ -6321,7 +6318,8 @@ static bool run_dirtest1(int dummy)
                fstring fname;
                slprintf(fname, sizeof(fname), "\\LISTDIR\\f%d", i);
                if (!NT_STATUS_IS_OK(cli_ntcreate(cli, fname, 0, GENERIC_ALL_ACCESS, FILE_ATTRIBUTE_ARCHIVE,
-                                  FILE_SHARE_READ|FILE_SHARE_WRITE, FILE_OVERWRITE_IF, 0, 0, &fnum))) {
+                                  FILE_SHARE_READ|FILE_SHARE_WRITE, FILE_OVERWRITE_IF,
+                                  0, 0, &fnum, NULL))) {
                        fprintf(stderr,"Failed to open %s\n", fname);
                        return False;
                }
@@ -6385,10 +6383,10 @@ static bool run_error_map_extract(int dummy) {
        static struct cli_state *c_nt;
        NTSTATUS status;
 
-       uint32 error;
+       uint32_t error;
 
-       uint32 errnum;
-        uint8 errclass;
+       uint32_t errnum;
+        uint8_t errclass;
 
        NTSTATUS nt_status;
 
@@ -6516,7 +6514,7 @@ static bool run_sesssetup_bench(int dummy)
 
        status = cli_ntcreate(c, fname, 0, GENERIC_ALL_ACCESS|DELETE_ACCESS,
                              FILE_ATTRIBUTE_NORMAL, 0, FILE_OVERWRITE_IF,
-                             FILE_DELETE_ON_CLOSE, 0, &fnum);
+                             FILE_DELETE_ON_CLOSE, 0, &fnum, NULL);
        if (!NT_STATUS_IS_OK(status)) {
                d_printf("open %s failed: %s\n", fname, nt_errstr(status));
                return false;
@@ -6553,7 +6551,7 @@ static bool subst_test(const char *str, const char *user, const char *domain,
        char *subst;
        bool result = true;
 
-       subst = talloc_sub_specified(talloc_tos(), str, user, domain, uid, gid);
+       subst = talloc_sub_specified(talloc_tos(), str, user, NULL, domain, uid, gid);
 
        if (strcmp(subst, expected) != 0) {
                printf("sub_specified(%s, %s, %s, %d, %d) returned [%s], expected "
@@ -6752,12 +6750,11 @@ static void torture_createdel_created(struct tevent_req *subreq)
        NTSTATUS status;
        uint16_t fnum;
 
-       status = cli_ntcreate_recv(subreq, &fnum);
+       status = cli_ntcreate_recv(subreq, &fnum, NULL);
        TALLOC_FREE(subreq);
-       if (!NT_STATUS_IS_OK(status)) {
+       if (tevent_req_nterror(req, status)) {
                DEBUG(10, ("cli_ntcreate_recv returned %s\n",
                           nt_errstr(status)));
-               tevent_req_nterror(req, status);
                return;
        }
 
@@ -6775,9 +6772,8 @@ static void torture_createdel_closed(struct tevent_req *subreq)
        NTSTATUS status;
 
        status = cli_close_recv(subreq);
-       if (!NT_STATUS_IS_OK(status)) {
+       if (tevent_req_nterror(req, status)) {
                DEBUG(10, ("cli_close_recv returned %s\n", nt_errstr(status)));
-               tevent_req_nterror(req, status);
                return;
        }
        tevent_req_done(req);
@@ -7057,7 +7053,7 @@ static bool run_notify_bench(int dummy)
                                      0, FILE_SHARE_READ|FILE_SHARE_WRITE|
                                      FILE_SHARE_DELETE,
                                      FILE_OPEN_IF, FILE_DIRECTORY_FILE, 0,
-                                     &dnum);
+                                     &dnum, NULL);
 
                if (!NT_STATUS_IS_OK(status)) {
                        d_printf("Could not create %s: %s\n", dname,
@@ -7127,7 +7123,7 @@ static bool run_mangle1(int dummy)
 
        status = cli_ntcreate(cli, fname, 0, GENERIC_ALL_ACCESS|DELETE_ACCESS,
                              FILE_ATTRIBUTE_NORMAL, 0, FILE_OVERWRITE_IF,
-                             0, 0, &fnum);
+                             0, 0, &fnum, NULL);
        if (!NT_STATUS_IS_OK(status)) {
                d_printf("open %s failed: %s\n", fname, nt_errstr(status));
                return false;
@@ -7258,7 +7254,8 @@ static size_t calc_expected_return(struct cli_state *cli, size_t len_requested)
                len_requested &= 0xFFFF;
        }
 
-       return MIN(len_requested, max_pdu - (MIN_SMB_SIZE + VWV(12)));
+       return MIN(len_requested,
+                  max_pdu - (MIN_SMB_SIZE + VWV(12) + 1 /* padding byte */));
 }
 
 static bool check_read_call(struct cli_state *cli,
@@ -7403,7 +7400,7 @@ static bool run_large_readx(int dummy)
        /* Create a file of size 4MB. */
        status = cli_ntcreate(cli1, fname, 0, GENERIC_ALL_ACCESS,
                        FILE_ATTRIBUTE_NORMAL, 0, FILE_OVERWRITE_IF,
-                       0, 0, &fnum1);
+                       0, 0, &fnum1, NULL);
 
        if (!NT_STATUS_IS_OK(status)) {
                d_printf("open %s failed: %s\n", fname, nt_errstr(status));
@@ -7512,7 +7509,7 @@ static bool run_large_readx(int dummy)
 
                status = cli_ntcreate(cli2, fname, 0, FILE_READ_DATA,
                                FILE_ATTRIBUTE_NORMAL, 0, FILE_OPEN,
-                               0, 0, &fnum2);
+                               0, 0, &fnum2, NULL);
                if (!NT_STATUS_IS_OK(status)) {
                        d_printf("Second open %s failed: %s\n", fname, nt_errstr(status));
                        goto out;
@@ -7794,7 +7791,8 @@ static bool run_shortname_test(int dummy)
                fname[15] = i;
 
                status = cli_ntcreate(cli, fname, 0, GENERIC_ALL_ACCESS, FILE_ATTRIBUTE_NORMAL,
-                                   FILE_SHARE_READ|FILE_SHARE_WRITE, FILE_OVERWRITE_IF, 0, 0, &fnum);
+                                   FILE_SHARE_READ|FILE_SHARE_WRITE,
+                                  FILE_OVERWRITE_IF, 0, 0, &fnum, NULL);
                if (!NT_STATUS_IS_OK(status)) {
                        d_printf("(%s) cli_nt_create of %s failed: %s\n",
                                __location__, fname, nt_errstr(status));
@@ -8050,7 +8048,7 @@ static bool run_streamerror(int dummy)
                              FILE_READ_DATA|FILE_READ_EA|
                              FILE_READ_ATTRIBUTES|READ_CONTROL_ACCESS,
                              FILE_ATTRIBUTE_NORMAL, FILE_SHARE_READ,
-                             FILE_OPEN, 0, 0, &fnum);
+                             FILE_OPEN, 0, 0, &fnum, NULL);
 
        if (!NT_STATUS_EQUAL(status, NT_STATUS_OBJECT_NAME_NOT_FOUND)) {
                printf("ntcreate returned %s, expected "
@@ -8118,12 +8116,26 @@ static bool run_local_base64(int dummy)
        return ret;
 }
 
+static void parse_fn(time_t timeout, DATA_BLOB blob, void *private_data)
+{
+       return;
+}
+
 static bool run_local_gencache(int dummy)
 {
        char *val;
        time_t tm;
        DATA_BLOB blob;
        char v;
+       struct memcache *mem;
+       int i;
+
+       mem = memcache_init(NULL, 0);
+       if (mem == NULL) {
+               d_printf("%s: memcache_init failed\n", __location__);
+               return false;
+       }
+       memcache_set_global(mem);
 
        if (!gencache_set("foo", "bar", time(NULL) + 1000)) {
                d_printf("%s: gencache_set() failed\n", __location__);
@@ -8135,7 +8147,17 @@ static bool run_local_gencache(int dummy)
                return False;
        }
 
-       if (!gencache_get("foo", NULL, &val, &tm)) {
+       for (i=0; i<1000000; i++) {
+               gencache_parse("foo", parse_fn, NULL);
+       }
+
+       if (!gencache_get("foo", talloc_tos(), &val, &tm)) {
+               d_printf("%s: gencache_get() failed\n", __location__);
+               return False;
+       }
+       TALLOC_FREE(val);
+
+       if (!gencache_get("foo", talloc_tos(), &val, &tm)) {
                d_printf("%s: gencache_get() failed\n", __location__);
                return False;
        }
@@ -8143,11 +8165,11 @@ static bool run_local_gencache(int dummy)
        if (strcmp(val, "bar") != 0) {
                d_printf("%s: gencache_get() returned %s, expected %s\n",
                         __location__, val, "bar");
-               SAFE_FREE(val);
+               TALLOC_FREE(val);
                return False;
        }
 
-       SAFE_FREE(val);
+       TALLOC_FREE(val);
 
        if (!gencache_del("foo")) {
                d_printf("%s: gencache_del() failed\n", __location__);
@@ -8159,7 +8181,7 @@ static bool run_local_gencache(int dummy)
                return False;
        }
 
-       if (gencache_get("foo", NULL, &val, &tm)) {
+       if (gencache_get("foo", talloc_tos(), &val, &tm)) {
                d_printf("%s: gencache_get() on deleted entry "
                         "succeeded\n", __location__);
                return False;
@@ -8173,7 +8195,7 @@ static bool run_local_gencache(int dummy)
                return False;
        }
 
-       if (!gencache_get_data_blob("foo", NULL, &blob, NULL, NULL)) {
+       if (!gencache_get_data_blob("foo", talloc_tos(), &blob, NULL, NULL)) {
                d_printf("%s: gencache_get_data_blob() failed\n", __location__);
                return False;
        }
@@ -8197,7 +8219,7 @@ static bool run_local_gencache(int dummy)
                return False;
        }
 
-       if (gencache_get_data_blob("foo", NULL, &blob, NULL, NULL)) {
+       if (gencache_get_data_blob("foo", talloc_tos(), &blob, NULL, NULL)) {
                d_printf("%s: gencache_get_data_blob() on deleted entry "
                         "succeeded\n", __location__);
                return False;
@@ -8212,7 +8234,7 @@ static bool run_local_gencache(int dummy)
                         __location__);
                return false;
        }
-       if (gencache_get("blob", NULL, &val, &tm)) {
+       if (gencache_get("blob", talloc_tos(), &val, &tm)) {
                d_printf("%s: gencache_get succeeded\n", __location__);
                return false;
        }
@@ -8913,7 +8935,7 @@ static void wbclient_done(struct tevent_req *req)
        d_printf("wb_trans_recv %d returned %s\n", *i, wbcErrorString(wbc_err));
 }
 
-static bool run_local_wbclient(int dummy)
+static bool run_wbclient_multi_ping(int dummy)
 {
        struct tevent_context *ev;
        struct wb_context **wb_ctx;
@@ -8923,7 +8945,7 @@ static bool run_local_wbclient(int dummy)
 
        BlockSignals(True, SIGPIPE);
 
-       ev = tevent_context_init_byname(talloc_tos(), "epoll");
+       ev = tevent_context_init(talloc_tos());
        if (ev == NULL) {
                goto fail;
        }
@@ -9068,7 +9090,8 @@ static bool run_local_dbtrans(int dummy)
        TDB_DATA value;
 
        db = db_open(talloc_tos(), "transtest.tdb", 0, TDB_DEFAULT,
-                    O_RDWR|O_CREAT, 0600, DBWRAP_LOCK_ORDER_1);
+                    O_RDWR|O_CREAT, 0600, DBWRAP_LOCK_ORDER_1,
+                    DBWRAP_FLAG_NONE);
        if (db == NULL) {
                printf("Could not open transtest.db\n");
                return false;
@@ -9570,17 +9593,25 @@ static struct {
        { "CLEANUP2", run_cleanup2 },
        { "CLEANUP3", run_cleanup3 },
        { "CLEANUP4", run_cleanup4 },
+       { "OPLOCK-CANCEL", run_oplock_cancel },
        { "LOCAL-SUBSTITUTE", run_local_substitute, 0},
        { "LOCAL-GENCACHE", run_local_gencache, 0},
        { "LOCAL-TALLOC-DICT", run_local_talloc_dict, 0},
        { "LOCAL-CTDB-CONN", run_ctdb_conn, 0},
-       { "LOCAL-MSG", run_msg_test, 0},
        { "LOCAL-DBWRAP-WATCH1", run_dbwrap_watch1, 0 },
+       { "LOCAL-MESSAGING-READ1", run_messaging_read1, 0 },
+       { "LOCAL-MESSAGING-READ2", run_messaging_read2, 0 },
+       { "LOCAL-MESSAGING-READ3", run_messaging_read3, 0 },
+       { "LOCAL-MESSAGING-READ4", run_messaging_read4, 0 },
+       { "LOCAL-MESSAGING-FDPASS1", run_messaging_fdpass1, 0 },
+       { "LOCAL-MESSAGING-FDPASS2", run_messaging_fdpass2, 0 },
+       { "LOCAL-MESSAGING-FDPASS2a", run_messaging_fdpass2a, 0 },
+       { "LOCAL-MESSAGING-FDPASS2b", run_messaging_fdpass2b, 0 },
        { "LOCAL-BASE64", run_local_base64, 0},
        { "LOCAL-RBTREE", run_local_rbtree, 0},
        { "LOCAL-MEMCACHE", run_local_memcache, 0},
        { "LOCAL-STREAM-NAME", run_local_stream_name, 0},
-       { "LOCAL-WBCLIENT", run_local_wbclient, 0},
+       { "WBCLIENT-MULTI-PING", run_wbclient_multi_ping, 0},
        { "LOCAL-string_to_sid", run_local_string_to_sid, 0},
        { "LOCAL-sid_to_string", run_local_sid_to_string, 0},
        { "LOCAL-binary_to_sid", run_local_binary_to_sid, 0},
@@ -9595,6 +9626,7 @@ static struct {
        { "local-tdb-opener", run_local_tdb_opener, 0 },
        { "local-tdb-writer", run_local_tdb_writer, 0 },
        { "LOCAL-DBWRAP-CTDB", run_local_dbwrap_ctdb, 0 },
+       { "LOCAL-BENCH-PTHREADPOOL", run_bench_pthreadpool, 0 },
        { "qpathinfo-bufsize", run_qpathinfo_bufsize, 0 },
        {NULL, NULL, 0}};
 
@@ -9670,7 +9702,7 @@ static void usage(void)
 
        printf("\t-d debuglevel\n");
        printf("\t-U user%%pass\n");
-       printf("\t-k               use kerberos\n");
+       printf("\t-k                    use kerberos\n");
        printf("\t-N numprocs\n");
        printf("\t-n my_netbios_name\n");
        printf("\t-W workgroup\n");
@@ -9678,12 +9710,13 @@ static void usage(void)
        printf("\t-O socket_options\n");
        printf("\t-m maximum protocol\n");
        printf("\t-L use oplocks\n");
-       printf("\t-c CLIENT.TXT   specify client load file for NBENCH\n");
+       printf("\t-c CLIENT.TXT         specify client load file for NBENCH\n");
        printf("\t-A showall\n");
        printf("\t-p port\n");
        printf("\t-s seed\n");
        printf("\t-b unclist_filename   specify multiple shares for multiple connections\n");
-       printf("\t-f filename   filename to test\n");
+       printf("\t-f filename           filename to test\n");
+       printf("\t-e                    encrypt\n");
        printf("\n\n");
 
        printf("tests are:");
@@ -9716,7 +9749,7 @@ static void usage(void)
 
        setup_logging("smbtorture", DEBUG_STDOUT);
 
-       load_case_tables();
+       smb_init_locale();
        fault_setup();
 
        if (is_default_dyn_CONFIGFILE()) {