libcli/smb: pass smbXcli_tcon to smb2cli_flush*()
[kai/samba.git] / source3 / torture / mangle_test.c
index becb30ad115f288419751895fe2383eb2430e7d4..36e4aafff050f41d14030e03d5078d3ee8ccdf6c 100644 (file)
@@ -20,6 +20,7 @@
 #include "includes.h"
 #include "system/filesys.h"
 #include "torture/proto.h"
+#include "libsmb/libsmb.h"
 #include "libsmb/clirap.h"
 #include "util_tdb.h"
 
@@ -41,44 +42,51 @@ static bool test_one(struct cli_state *cli, const char *name)
 
        total++;
 
-       if (!NT_STATUS_IS_OK(cli_open(cli, name, O_RDWR|O_CREAT|O_EXCL, DENY_NONE, &fnum))) {
-               printf("open of %s failed (%s)\n", name, cli_errstr(cli));
+       status = cli_openx(cli, name, O_RDWR|O_CREAT|O_EXCL, DENY_NONE, &fnum);
+       if (!NT_STATUS_IS_OK(status)) {
+               printf("open of %s failed (%s)\n", name, nt_errstr(status));
                return False;
        }
 
-       if (!NT_STATUS_IS_OK(cli_close(cli, fnum))) {
-               printf("close of %s failed (%s)\n", name, cli_errstr(cli));
+       status = cli_close(cli, fnum);
+       if (!NT_STATUS_IS_OK(status)) {
+               printf("close of %s failed (%s)\n", name, nt_errstr(status));
                return False;
        }
 
        /* get the short name */
        status = cli_qpathinfo_alt_name(cli, name, shortname);
        if (!NT_STATUS_IS_OK(status)) {
-               printf("query altname of %s failed (%s)\n", name, cli_errstr(cli));
+               printf("query altname of %s failed (%s)\n", name, nt_errstr(status));
                return False;
        }
 
        fstr_sprintf(name2, "\\mangle_test\\%s", shortname);
-       if (!NT_STATUS_IS_OK(cli_unlink(cli, name2, FILE_ATTRIBUTE_SYSTEM | FILE_ATTRIBUTE_HIDDEN))) {
+       status = cli_unlink(cli, name2, FILE_ATTRIBUTE_SYSTEM | FILE_ATTRIBUTE_HIDDEN);
+       if (!NT_STATUS_IS_OK(status)) {
                printf("unlink of %s  (%s) failed (%s)\n", 
-                      name2, name, cli_errstr(cli));
+                      name2, name, nt_errstr(status));
                return False;
        }
 
        /* recreate by short name */
-       if (!NT_STATUS_IS_OK(cli_open(cli, name2, O_RDWR|O_CREAT|O_EXCL, DENY_NONE, &fnum))) {
-               printf("open2 of %s failed (%s)\n", name2, cli_errstr(cli));
+       status = cli_openx(cli, name2, O_RDWR|O_CREAT|O_EXCL, DENY_NONE, &fnum);
+       if (!NT_STATUS_IS_OK(status)) {
+               printf("open2 of %s failed (%s)\n", name2, nt_errstr(status));
                return False;
        }
-       if (!NT_STATUS_IS_OK(cli_close(cli, fnum))) {
-               printf("close of %s failed (%s)\n", name, cli_errstr(cli));
+
+       status = cli_close(cli, fnum);
+       if (!NT_STATUS_IS_OK(status)) {
+               printf("close of %s failed (%s)\n", name, nt_errstr(status));
                return False;
        }
 
        /* and unlink by long name */
-       if (!NT_STATUS_IS_OK(cli_unlink(cli, name, FILE_ATTRIBUTE_SYSTEM | FILE_ATTRIBUTE_HIDDEN))) {
+       status = cli_unlink(cli, name, FILE_ATTRIBUTE_SYSTEM | FILE_ATTRIBUTE_HIDDEN);
+       if (!NT_STATUS_IS_OK(status)) {
                printf("unlink2 of %s  (%s) failed (%s)\n", 
-                      name, name2, cli_errstr(cli));
+                      name, name2, nt_errstr(status));
                failures++;
                cli_unlink(cli, name2, FILE_ATTRIBUTE_SYSTEM | FILE_ATTRIBUTE_HIDDEN);
                return True;
@@ -173,7 +181,7 @@ bool torture_mangle(int dummy)
        }
 
        /* we will use an internal tdb to store the names we have used */
-       tdb = tdb_open(NULL, 100000, TDB_INTERNAL, 0, 0);
+       tdb = tdb_open_compat(NULL, 100000, TDB_INTERNAL, 0, 0, NULL, NULL);
        if (!tdb) {
                printf("ERROR: Failed to open tdb\n");
                return False;