Get medieval on our ass about SMB1 file descriptors being 16 bits, not an int.
[nivanova/samba-autobuild/.git] / source3 / torture / masktest.c
index 8fea15877f14922a3008fc579640fcd2eb443f45..768323b9f73d27a0cc3eb6bbb7f1a40398c2687a 100644 (file)
@@ -212,8 +212,10 @@ static struct cli_state *connect_one(char *share)
 
        DEBUG(4,(" session request ok\n"));
 
-       if (!cli_negprot(c)) {
-               DEBUG(0,("protocol negotiation failed\n"));
+       status = cli_negprot(c);
+       if (!NT_STATUS_IS_OK(status)) {
+               DEBUG(0, ("protocol negotiation failed: %s\n",
+                         nt_errstr(status)));
                cli_shutdown(c);
                return NULL;
        }
@@ -247,9 +249,10 @@ static struct cli_state *connect_one(char *share)
 
        DEBUG(4,(" session setup ok\n"));
 
-       if (!cli_send_tconX(c, share, "?????",
-                           password, strlen(password)+1)) {
-               DEBUG(0,("tree connect failed: %s\n", cli_errstr(c)));
+       status = cli_tcon_andx(c, share, "?????", password,
+                              strlen(password)+1);
+       if (!NT_STATUS_IS_OK(status)) {
+               DEBUG(0,("tree connect failed: %s\n", nt_errstr(status)));
                cli_shutdown(c);
                return NULL;
        }
@@ -308,7 +311,7 @@ static void get_real_name(struct cli_state *cli,
 
 static void testpair(struct cli_state *cli, const char *mask, const char *file)
 {
-       int fnum;
+       uint16_t fnum;
        fstring res1;
        char *res2;
        static int count;
@@ -319,8 +322,7 @@ static void testpair(struct cli_state *cli, const char *mask, const char *file)
 
        fstrcpy(res1, "---");
 
-       fnum = cli_open(cli, file, O_CREAT|O_TRUNC|O_RDWR, 0);
-       if (fnum == -1) {
+       if (!NT_STATUS_IS_OK(cli_open(cli, file, O_CREAT|O_TRUNC|O_RDWR, 0, &fnum))) {
                DEBUG(0,("Can't create %s\n", file));
                return;
        }
@@ -347,7 +349,7 @@ static void testpair(struct cli_state *cli, const char *mask, const char *file)
                if (die_on_error) exit(1);
        }
 
-       cli_unlink(cli, file);
+       cli_unlink(cli, file, aSYSTEM | aHIDDEN);
 
        if (count % 100 == 0) DEBUG(0,("%d\n", count));
        SAFE_FREE(long_name);
@@ -364,7 +366,7 @@ static void test_mask(int argc, char *argv[],
 
        cli_mkdir(cli, "\\masktest");
 
-       cli_unlink(cli, "\\masktest\\*");
+       cli_unlink(cli, "\\masktest\\*", aSYSTEM | aHIDDEN);
 
        if (argc >= 2) {
                while (argc >= 2) {