Cause cli_close to return an NTSTATUS.
authorJeremy Allison <jra@samba.org>
Thu, 30 Apr 2009 23:57:42 +0000 (16:57 -0700)
committerJeremy Allison <jra@samba.org>
Thu, 30 Apr 2009 23:57:42 +0000 (16:57 -0700)
Jeremy.

12 files changed:
source3/client/client.c
source3/client/clitar.c
source3/client/smbspool.c
source3/include/proto.h
source3/libsmb/clifile.c
source3/libsmb/libsmb_file.c
source3/rpc_client/rpc_transport_np.c
source3/torture/locktest2.c
source3/torture/mangle_test.c
source3/torture/nbio.c
source3/torture/torture.c
source3/utils/net_rpc_printer.c

index becb066153408183b8c120868d447ff9a73c1f77..d3cf08cce8125bc5bf5702b8772185b620c4e906 100644 (file)
@@ -1078,7 +1078,7 @@ static int do_get(const char *rname, const char *lname_in, bool reget)
                return 1;
        }
 
-       if (!cli_close(targetcli, fnum)) {
+       if (!NT_STATUS_IS_OK(cli_close(targetcli, fnum))) {
                d_printf("Error %s closing remote file\n",cli_errstr(cli));
                rc = 1;
        }
@@ -1690,7 +1690,7 @@ static int do_put(const char *rname, const char *lname, bool reput)
                d_fprintf(stderr, "cli_push returned %s\n", nt_errstr(status));
        }
 
-       if (!cli_close(targetcli, fnum)) {
+       if (!NT_STATUS_IS_OK(cli_close(targetcli, fnum))) {
                d_printf("%s closing remote file %s\n",cli_errstr(cli),rname);
                x_fclose(f);
                return 1;
@@ -2459,7 +2459,7 @@ static int cmd_close(void)
 
        fnum = atoi(buf);
        /* We really should use the targetcli here.... */
-       if (!cli_close(cli, fnum)) {
+       if (!NT_STATUS_IS_OK(cli_close(cli, fnum))) {
                d_printf("close %d: %s\n", fnum, cli_errstr(cli));
                return 1;
        }
index 3cc1a25dbbc463799147a9afc03b64c7a1a360ef..c7f2819c88a42ae2c8e3058364ecf9b67a345c5b 100644 (file)
@@ -1067,8 +1067,9 @@ static int get_file(file_info2 finfo)
 
        /* Now close the file ... */
 
-       if (!cli_close(cli, fnum)) {
-               DEBUG(0, ("Error closing remote file\n"));
+       if (!NT_STATUS_IS_OK(cli_close(cli, fnum))) {
+               DEBUG(0, ("Error %s closing remote file\n",
+                       cli_errstr(cli)));
                return(False);
        }
 
index 6b099dbc0bc2b8ae86926c56c55061b640a28629..07de579e017d17748d59a71c86a06111fa5e1c77 100644 (file)
@@ -602,7 +602,7 @@ smb_print(struct cli_state * cli,   /* I - SMB connection */
                tbytes += nbytes;
        }
 
-       if (!cli_close(cli, fnum)) {
+       if (!NT_STATUS_IS_OK(cli_close(cli, fnum))) {
                fprintf(stderr, "ERROR: %s closing remote spool %s\n",
                        cli_errstr(cli), title);
                return (get_exit_code(cli, cli_nt_error(cli)));
index f60fc9d89ca627b91eb2f9e9a9f9d6076bea5196..0d52e00760cf6281d7371b376eb3967835d2fbb7 100644 (file)
@@ -2418,7 +2418,7 @@ struct tevent_req *cli_close_send(TALLOC_CTX *mem_ctx,
                                  struct event_context *ev,
                                  struct cli_state *cli, uint16_t fnum);
 NTSTATUS cli_close_recv(struct tevent_req *req);
-bool cli_close(struct cli_state *cli, uint16_t fnum);
+NTSTATUS cli_close(struct cli_state *cli, uint16_t fnum);
 bool cli_ftruncate(struct cli_state *cli, uint16_t fnum, uint64_t size);
 NTSTATUS cli_locktype(struct cli_state *cli, uint16_t fnum,
                      uint32_t offset, uint32_t len,
index 05730413b001ab73b6da4cd194457d2cf48c2d47..abc93912349090411cec5cd7d780db280f15514a 100644 (file)
@@ -1120,70 +1120,6 @@ int cli_nt_delete_on_close(struct cli_state *cli, uint16_t fnum, bool flag)
        return true;
 }
 
-/****************************************************************************
- Open a file - exposing the full horror of the NT API :-).
- Used in smbtorture.
-****************************************************************************/
-
-#if 0
-int cli_nt_create_full(struct cli_state *cli, const char *fname,
-                      uint32_t CreatFlags, uint32_t DesiredAccess,
-                      uint32_t FileAttributes, uint32_t ShareAccess,
-                      uint32_t CreateDisposition, uint32_t CreateOptions,
-                      uint8_t SecurityFlags)
-{
-       char *p;
-       int len;
-
-       memset(cli->outbuf,'\0',smb_size);
-       memset(cli->inbuf,'\0',smb_size);
-
-       cli_set_message(cli->outbuf,24,0, true);
-
-       SCVAL(cli->outbuf,smb_com,SMBntcreateX);
-       SSVAL(cli->outbuf,smb_tid,cli->cnum);
-       cli_setup_packet(cli);
-
-       SSVAL(cli->outbuf,smb_vwv0,0xFF);
-       if (cli->use_oplocks)
-               CreatFlags |= (REQUEST_OPLOCK|REQUEST_BATCH_OPLOCK);
-
-       SIVAL(cli->outbuf,smb_ntcreate_Flags, CreatFlags);
-       SIVAL(cli->outbuf,smb_ntcreate_RootDirectoryFid, 0x0);
-       SIVAL(cli->outbuf,smb_ntcreate_DesiredAccess, DesiredAccess);
-       SIVAL(cli->outbuf,smb_ntcreate_FileAttributes, FileAttributes);
-       SIVAL(cli->outbuf,smb_ntcreate_ShareAccess, ShareAccess);
-       SIVAL(cli->outbuf,smb_ntcreate_CreateDisposition, CreateDisposition);
-       SIVAL(cli->outbuf,smb_ntcreate_CreateOptions, CreateOptions);
-       SIVAL(cli->outbuf,smb_ntcreate_ImpersonationLevel, 0x02);
-       SCVAL(cli->outbuf,smb_ntcreate_SecurityFlags, SecurityFlags);
-
-       p = smb_buf(cli->outbuf);
-       /* this alignment and termination is critical for netapp filers. Don't change */
-       p += clistr_align_out(cli, p, 0);
-       len = clistr_push(cli, p, fname,
-                       cli->bufsize - PTR_DIFF(p,cli->outbuf), 0);
-       p += len;
-       SSVAL(cli->outbuf,smb_ntcreate_NameLength, len);
-       /* sigh. this copes with broken netapp filer behaviour */
-       p += clistr_push(cli, p, "",
-                       cli->bufsize - PTR_DIFF(p,cli->outbuf), STR_TERMINATE);
-
-       cli_setup_bcc(cli, p);
-
-       cli_send_smb(cli);
-       if (!cli_receive_smb(cli)) {
-               return -1;
-       }
-
-       if (cli_is_error(cli)) {
-               return -1;
-       }
-
-       return SVAL(cli->inbuf,smb_vwv2 + 1);
-}
-#endif
-
 struct cli_ntcreate_state {
        uint16_t vwv[24];
        uint16_t fnum;
@@ -1346,18 +1282,6 @@ NTSTATUS cli_ntcreate(struct cli_state *cli,
        return status;
 }
 
-#if 0
-/****************************************************************************
- Open a file.
-****************************************************************************/
-
-int cli_nt_create(struct cli_state *cli, const char *fname, uint32_t DesiredAccess)
-{
-       return cli_nt_create_full(cli, fname, 0, DesiredAccess, 0,
-                               FILE_SHARE_READ|FILE_SHARE_WRITE, FILE_OPEN, 0x0, 0x0);
-}
-#endif
-
 uint8_t *smb_bytes_push_str(uint8_t *buf, bool ucs2,
                            const char *str, size_t str_len,
                            size_t *pconverted_size)
@@ -1675,13 +1599,12 @@ NTSTATUS cli_close_recv(struct tevent_req *req)
        return tevent_req_simple_recv_ntstatus(req);
 }
 
-bool cli_close(struct cli_state *cli, uint16_t fnum)
+NTSTATUS cli_close(struct cli_state *cli, uint16_t fnum)
 {
        TALLOC_CTX *frame = talloc_stackframe();
        struct event_context *ev;
        struct tevent_req *req;
        NTSTATUS status = NT_STATUS_OK;
-       bool result = false;
 
        if (cli_has_async_calls(cli)) {
                /*
@@ -1708,13 +1631,13 @@ bool cli_close(struct cli_state *cli, uint16_t fnum)
                goto fail;
        }
 
-       result = NT_STATUS_IS_OK(cli_close_recv(req));
+       status = cli_close_recv(req);
  fail:
        TALLOC_FREE(frame);
        if (!NT_STATUS_IS_OK(status)) {
                cli_set_error(cli, status);
        }
-       return result;
+       return status;
 }
 
 /****************************************************************************
index 4724658fe3f704b8304f2d2dfc2c9094596804f4..bf53267054b09925ae517787313f74ae53f1021d 100644 (file)
@@ -477,7 +477,7 @@ SMBC_close_ctx(SMBCCTX *context,
        }
        /*d_printf(">>>close: resolved path as %s\n", targetpath);*/
         
-       if (!cli_close(targetcli, file->cli_fd)) {
+       if (!NT_STATUS_IS_OK(cli_close(targetcli, file->cli_fd))) {
                 
                DEBUG(3, ("cli_close failed on %s. purging server.\n", 
                          file->fname));
index dceacf68157353fa6f7aaf83cde2daff36c7e948..73d23d8857e017198e128d36292785dd38fb7ea2 100644 (file)
@@ -30,15 +30,12 @@ struct rpc_transport_np_state {
 
 static int rpc_transport_np_state_destructor(struct rpc_transport_np_state *s)
 {
-       bool ret;
-
        if (s->cli->fd == -1) {
                DEBUG(10, ("socket was closed, no need to send close request.\n"));
                return 0;
        }
        
-       ret = cli_close(s->cli, s->fnum);
-       if (!ret) {
+       if (!NT_STATUS_IS_OK(cli_close(s->cli, s->fnum))) {
                DEBUG(1, ("rpc_transport_np_state_destructor: cli_close "
                          "failed on pipe %s. Error was %s\n", s->pipe_name,
                          cli_errstr(s->cli)));
index 9cb531450c940aee492bb1720ea50497432dc900..93adcb51a6f8df75cb8d01730f36587ee1702505 100644 (file)
@@ -94,7 +94,7 @@ static bool try_close(struct cli_state *c, int fstype, int fd)
 {
        switch (fstype) {
        case FSTYPE_SMB:
-               return cli_close(c, fd);
+               return NT_STATUS_IS_OK(cli_close(c, fd));
 
        case FSTYPE_NFS:
                return close(fd) == 0;
index 6ea6c5732c686822e1a24dd636b86bba04d3aeef..34c908e64239033691b427d3663e6ae1e52ae842 100644 (file)
@@ -42,7 +42,7 @@ static bool test_one(struct cli_state *cli, const char *name)
                return False;
        }
 
-       if (!cli_close(cli, fnum)) {
+       if (!NT_STATUS_IS_OK(cli_close(cli, fnum))) {
                printf("close of %s failed (%s)\n", name, cli_errstr(cli));
                return False;
        }
@@ -66,7 +66,7 @@ static bool test_one(struct cli_state *cli, const char *name)
                printf("open2 of %s failed (%s)\n", name2, cli_errstr(cli));
                return False;
        }
-       if (!cli_close(cli, fnum)) {
+       if (!NT_STATUS_IS_OK(cli_close(cli, fnum))) {
                printf("close of %s failed (%s)\n", name, cli_errstr(cli));
                return False;
        }
index c5a5388f08707670025e38debe875f8a22da78c2..bef54f75fe6257127b80fc3ea1901dfc82b5bc00 100644 (file)
@@ -213,7 +213,7 @@ void nb_close(int handle)
 {
        int i;
        i = find_handle(handle);
-       if (!cli_close(c, ftable[i].fd)) {
+       if (!NT_STATUS_IS_OK(cli_close(c, ftable[i].fd))) {
                printf("(%d) close failed on handle %d\n", line_count, handle);
                exit(1);
        }
index e06a7629afc2c11f25ab80c55152489437848892..4689d8ff55d0e2519409b9005abd26ea0ca0f20b 100644 (file)
@@ -482,7 +482,7 @@ static bool rw_torture(struct cli_state *c)
                        correct = False;
                }
 
-               if (!cli_close(c, fnum)) {
+               if (!NT_STATUS_IS_OK(cli_close(c, fnum))) {
                        printf("close failed (%s)\n", cli_errstr(c));
                        correct = False;
                }
@@ -618,7 +618,7 @@ static bool rw_torture3(struct cli_state *c, char *lockfname)
 
        }
 
-       if (!cli_close(c, fnum)) {
+       if (!NT_STATUS_IS_OK(cli_close(c, fnum))) {
                printf("close failed (%s)\n", cli_errstr(c));
                correct = False;
        }
@@ -686,11 +686,11 @@ static bool rw_torture2(struct cli_state *c1, struct cli_state *c2)
                }
        }
 
-       if (!cli_close(c2, fnum2)) {
+       if (!NT_STATUS_IS_OK(cli_close(c2, fnum2))) {
                printf("close failed (%s)\n", cli_errstr(c2));
                correct = False;
        }
-       if (!cli_close(c1, fnum1)) {
+       if (!NT_STATUS_IS_OK(cli_close(c1, fnum1))) {
                printf("close failed (%s)\n", cli_errstr(c1));
                correct = False;
        }
@@ -796,7 +796,7 @@ static bool run_readwritelarge(int dummy)
                correct = False;
        }
 
-       if (!cli_close(cli1, fnum1)) {
+       if (!NT_STATUS_IS_OK(cli_close(cli1, fnum1))) {
                printf("close failed (%s)\n", cli_errstr(cli1));
                correct = False;
        }
@@ -843,7 +843,7 @@ static bool run_readwritelarge(int dummy)
                printf("readwritelarge test 3 (truncate test) succeeded (size = %x)\n", fsize);
 #endif
 
-       if (!cli_close(cli1, fnum1)) {
+       if (!NT_STATUS_IS_OK(cli_close(cli1, fnum1))) {
                printf("close failed (%s)\n", cli_errstr(cli1));
                correct = False;
        }
@@ -1050,7 +1050,7 @@ static bool run_locktest1(int dummy)
        printf("server slept for %u seconds for a %u second timeout\n",
               (unsigned int)(t2-t1), lock_timeout);
 
-       if (!cli_close(cli1, fnum2)) {
+       if (!NT_STATUS_IS_OK(cli_close(cli1, fnum2))) {
                printf("close1 failed (%s)\n", cli_errstr(cli1));
                return False;
        }
@@ -1063,12 +1063,12 @@ static bool run_locktest1(int dummy)
                                 NT_STATUS_FILE_LOCK_CONFLICT)) return False;
        }
 
-       if (!cli_close(cli1, fnum1)) {
+       if (!NT_STATUS_IS_OK(cli_close(cli1, fnum1))) {
                printf("close2 failed (%s)\n", cli_errstr(cli1));
                return False;
        }
 
-       if (!cli_close(cli2, fnum3)) {
+       if (!NT_STATUS_IS_OK(cli_close(cli2, fnum3))) {
                printf("close3 failed (%s)\n", cli_errstr(cli2));
                return False;
        }
@@ -1178,7 +1178,7 @@ static bool run_tcon_test(int dummy)
        cli->cnum = cnum1;
        cli->vuid = vuid1;
 
-       if (!cli_close(cli, fnum1)) {
+       if (!NT_STATUS_IS_OK(cli_close(cli, fnum1))) {
                printf("close failed (%s)\n", cli_errstr(cli));
                return False;
        }
@@ -1461,17 +1461,17 @@ static bool run_locktest2(int dummy)
 
        cli_setpid(cli, 1);
 
-       if (!cli_close(cli, fnum1)) {
+       if (!NT_STATUS_IS_OK(cli_close(cli, fnum1))) {
                printf("close1 failed (%s)\n", cli_errstr(cli));
                return False;
        }
 
-       if (!cli_close(cli, fnum2)) {
+       if (!NT_STATUS_IS_OK(cli_close(cli, fnum2))) {
                printf("close2 failed (%s)\n", cli_errstr(cli));
                return False;
        }
 
-       if (!cli_close(cli, fnum3)) {
+       if (!NT_STATUS_IS_OK(cli_close(cli, fnum3))) {
                printf("close3 failed (%s)\n", cli_errstr(cli));
                return False;
        }
@@ -1580,12 +1580,12 @@ static bool run_locktest3(int dummy)
                }
        }
 
-       if (!cli_close(cli1, fnum1)) {
+       if (!NT_STATUS_IS_OK(cli_close(cli1, fnum1))) {
                printf("close1 failed (%s)\n", cli_errstr(cli1));
                return False;
        }
 
-       if (!cli_close(cli2, fnum2)) {
+       if (!NT_STATUS_IS_OK(cli_close(cli2, fnum2))) {
                printf("close2 failed (%s)\n", cli_errstr(cli2));
                return False;
        }
@@ -1764,8 +1764,8 @@ static bool run_locktest4(int dummy)
        cli_open(cli1, fname, O_RDWR, DENY_NONE, &f);
        ret = cli_lock(cli1, fnum1, 0, 8, 0, READ_LOCK) &&
              cli_lock(cli1, f, 0, 1, 0, READ_LOCK) &&
-             cli_close(cli1, fnum1) &&
-             (NT_STATUS_IS_OK(cli_open(cli1, fname, O_RDWR, DENY_NONE, &fnum1))) &&
+             NT_STATUS_IS_OK(cli_close(cli1, fnum1)) &&
+             NT_STATUS_IS_OK(cli_open(cli1, fname, O_RDWR, DENY_NONE, &fnum1)) &&
              cli_lock(cli1, fnum1, 7, 1, 0, WRITE_LOCK);
         cli_close(cli1, f);
        cli_close(cli1, fnum1);
@@ -2736,7 +2736,7 @@ static bool run_oplock1(int dummy)
        cli_unlink(cli1, fname, aSYSTEM | aHIDDEN);
        cli_unlink(cli1, fname, aSYSTEM | aHIDDEN);
 
-       if (!cli_close(cli1, fnum1)) {
+       if (!NT_STATUS_IS_OK(cli_close(cli1, fnum1))) {
                printf("close2 failed (%s)\n", cli_errstr(cli1));
                return False;
        }
@@ -2815,7 +2815,7 @@ static bool run_oplock2(int dummy)
 
                sleep(2);
 
-               if (!cli_close(cli2, fnum2)) {
+               if (!NT_STATUS_IS_OK(cli_close(cli2, fnum2))) {
                        printf("close2 failed (%s)\n", cli_errstr(cli1));
                        *shared_correct = False;
                }
@@ -2863,7 +2863,7 @@ static bool run_oplock2(int dummy)
        }
 #endif
 
-       if (!cli_close(cli1, fnum1)) {
+       if (!NT_STATUS_IS_OK(cli_close(cli1, fnum1))) {
                printf("close1 failed (%s)\n", cli_errstr(cli1));
                correct = False;
        }
@@ -2991,7 +2991,7 @@ static bool run_deletetest(int dummy)
         }
 #endif
 
-       if (!cli_close(cli1, fnum1)) {
+       if (!NT_STATUS_IS_OK(cli_close(cli1, fnum1))) {
                printf("[1] close failed (%s)\n", cli_errstr(cli1));
                correct = False;
                goto fail;
@@ -3024,7 +3024,7 @@ static bool run_deletetest(int dummy)
                goto fail;
        }
 
-       if (!cli_close(cli1, fnum1)) {
+       if (!NT_STATUS_IS_OK(cli_close(cli1, fnum1))) {
                printf("[2] close failed (%s)\n", cli_errstr(cli1));
                correct = False;
                goto fail;
@@ -3032,7 +3032,7 @@ static bool run_deletetest(int dummy)
 
        if (NT_STATUS_IS_OK(cli_open(cli1, fname, O_RDONLY, DENY_NONE, &fnum1))) {
                printf("[2] open of %s succeeded should have been deleted on close !\n", fname);
-               if (!cli_close(cli1, fnum1)) {
+               if (!NT_STATUS_IS_OK(cli_close(cli1, fnum1))) {
                        printf("[2] close failed (%s)\n", cli_errstr(cli1));
                        correct = False;
                        goto fail;
@@ -3077,13 +3077,13 @@ static bool run_deletetest(int dummy)
                goto fail;
        }
 
-       if (!cli_close(cli1, fnum1)) {
+       if (!NT_STATUS_IS_OK(cli_close(cli1, fnum1))) {
                printf("[3] close 1 failed (%s)\n", cli_errstr(cli1));
                correct = False;
                goto fail;
        }
 
-       if (!cli_close(cli1, fnum2)) {
+       if (!NT_STATUS_IS_OK(cli_close(cli1, fnum2))) {
                printf("[3] close 2 failed (%s)\n", cli_errstr(cli1));
                correct = False;
                goto fail;
@@ -3093,7 +3093,7 @@ static bool run_deletetest(int dummy)
 
        if (NT_STATUS_IS_OK(cli_open(cli1, fname, O_RDONLY, DENY_NONE, &fnum1))) {
                printf("[3] open of %s succeeded should have been deleted on close !\n", fname);
-               if (!cli_close(cli1, fnum1)) {
+               if (!NT_STATUS_IS_OK(cli_close(cli1, fnum1))) {
                        printf("[3] close failed (%s)\n", cli_errstr(cli1));
                }
                cli_unlink(cli1, fname, aSYSTEM | aHIDDEN);
@@ -3121,7 +3121,7 @@ static bool run_deletetest(int dummy)
                goto fail;
        }
 
-       if (!cli_close(cli1, fnum2)) {
+       if (!NT_STATUS_IS_OK(cli_close(cli1, fnum2))) {
                printf("[4] close - 1 failed (%s)\n", cli_errstr(cli1));
                correct = False;
                goto fail;
@@ -3143,7 +3143,7 @@ static bool run_deletetest(int dummy)
        } else
                printf("fourth delete on close test succeeded.\n");
 
-       if (!cli_close(cli1, fnum1)) {
+       if (!NT_STATUS_IS_OK(cli_close(cli1, fnum1))) {
                printf("[4] close - 2 failed (%s)\n", cli_errstr(cli1));
                correct = False;
                goto fail;
@@ -3167,7 +3167,7 @@ static bool run_deletetest(int dummy)
                goto fail;
        }
 
-       if (!cli_close(cli1, fnum1)) {
+       if (!NT_STATUS_IS_OK(cli_close(cli1, fnum1))) {
                printf("[5] close - 2 failed (%s)\n", cli_errstr(cli1));
                correct = False;
                goto fail;
@@ -3195,7 +3195,7 @@ static bool run_deletetest(int dummy)
                goto fail;
        }
 
-       if (!cli_close(cli1, fnum1)) {
+       if (!NT_STATUS_IS_OK(cli_close(cli1, fnum1))) {
                printf("[6] close - 2 failed (%s)\n", cli_errstr(cli1));
                correct = False;
                goto fail;
@@ -3226,7 +3226,7 @@ static bool run_deletetest(int dummy)
                goto fail;
        }
 
-       if (!cli_close(cli1, fnum1)) {
+       if (!NT_STATUS_IS_OK(cli_close(cli1, fnum1))) {
                printf("[7] close - 2 failed (%s)\n", cli_errstr(cli1));
                correct = False;
                goto fail;
@@ -3240,7 +3240,7 @@ static bool run_deletetest(int dummy)
                goto fail;
        }
 
-       if (!cli_close(cli1, fnum1)) {
+       if (!NT_STATUS_IS_OK(cli_close(cli1, fnum1))) {
                printf("[7] close - 2 failed (%s)\n", cli_errstr(cli1));
                correct = False;
                goto fail;
@@ -3282,13 +3282,13 @@ static bool run_deletetest(int dummy)
                goto fail;
        }
 
-       if (!cli_close(cli1, fnum1)) {
+       if (!NT_STATUS_IS_OK(cli_close(cli1, fnum1))) {
                printf("[8] close - 1 failed (%s)\n", cli_errstr(cli1));
                correct = False;
                goto fail;
        }
 
-       if (!cli_close(cli2, fnum2)) {
+       if (!NT_STATUS_IS_OK(cli_close(cli2, fnum2))) {
                printf("[8] close - 2 failed (%s)\n", cli_errstr(cli2));
                correct = False;
                goto fail;
@@ -3320,7 +3320,7 @@ static bool run_deletetest(int dummy)
        }
 
        /* This should delete the file. */
-       if (!cli_close(cli1, fnum1)) {
+       if (!NT_STATUS_IS_OK(cli_close(cli1, fnum1))) {
                printf("[10] close failed (%s)\n", cli_errstr(cli1));
                correct = False;
                goto fail;
@@ -3348,7 +3348,7 @@ static bool run_deletetest(int dummy)
                goto fail;
        }
 
-       if (!cli_close(cli1, fnum1)) {
+       if (!NT_STATUS_IS_OK(cli_close(cli1, fnum1))) {
                printf("[11] close failed (%s)\n", cli_errstr(cli1));
                correct = False;
                goto fail;
@@ -3514,7 +3514,7 @@ static bool run_rename(int dummy)
                correct = False;
        }
 
-       if (!cli_close(cli1, fnum1)) {
+       if (!NT_STATUS_IS_OK(cli_close(cli1, fnum1))) {
                printf("close - 1 failed (%s)\n", cli_errstr(cli1));
                return False;
        }
@@ -3538,7 +3538,7 @@ static bool run_rename(int dummy)
                printf("Second rename succeeded (SHARE_DELETE | SHARE_READ)\n");
        }
 
-       if (!cli_close(cli1, fnum1)) {
+       if (!NT_STATUS_IS_OK(cli_close(cli1, fnum1))) {
                printf("close - 2 failed (%s)\n", cli_errstr(cli1));
                return False;
        }
@@ -3567,7 +3567,7 @@ static bool run_rename(int dummy)
                return False;
        }
 
-       if (!cli_close(cli1, fnum2)) {
+       if (!NT_STATUS_IS_OK(cli_close(cli1, fnum2))) {
                printf("close - 4 failed (%s)\n", cli_errstr(cli1));
                return False;
        }
@@ -3581,7 +3581,7 @@ static bool run_rename(int dummy)
                printf("Third rename succeeded (SHARE_NONE)\n");
        }
 
-       if (!cli_close(cli1, fnum1)) {
+       if (!NT_STATUS_IS_OK(cli_close(cli1, fnum1))) {
                printf("close - 3 failed (%s)\n", cli_errstr(cli1));
                return False;
        }
@@ -3604,7 +3604,7 @@ static bool run_rename(int dummy)
                correct = False;
        }
 
-       if (!cli_close(cli1, fnum1)) {
+       if (!NT_STATUS_IS_OK(cli_close(cli1, fnum1))) {
                printf("close - 4 failed (%s)\n", cli_errstr(cli1));
                return False;
        }
@@ -3645,7 +3645,7 @@ static bool run_rename(int dummy)
         /*--*/
 
 
-       if (!cli_close(cli1, fnum1)) {
+       if (!NT_STATUS_IS_OK(cli_close(cli1, fnum1))) {
                printf("close - 5 failed (%s)\n", cli_errstr(cli1));
                return False;
        }
@@ -3718,7 +3718,7 @@ static bool run_opentest(int dummy)
                return False;
        }
 
-       if (!cli_close(cli1, fnum1)) {
+       if (!NT_STATUS_IS_OK(cli_close(cli1, fnum1))) {
                printf("close2 failed (%s)\n", cli_errstr(cli1));
                return False;
        }
@@ -3762,7 +3762,7 @@ static bool run_opentest(int dummy)
                printf("correct error code ERRDOS/ERRbadshare returned\n");
        }
 
-       if (!cli_close(cli1, fnum1)) {
+       if (!NT_STATUS_IS_OK(cli_close(cli1, fnum1))) {
                printf("close2 failed (%s)\n", cli_errstr(cli1));
                return False;
        }
@@ -3787,7 +3787,7 @@ static bool run_opentest(int dummy)
                correct = False;
        }
 
-       if (!cli_close(cli1, fnum1)) {
+       if (!NT_STATUS_IS_OK(cli_close(cli1, fnum1))) {
                printf("(3) close1 failed (%s)\n", cli_errstr(cli1));
                return False;
        }
@@ -3810,7 +3810,7 @@ static bool run_opentest(int dummy)
                return False;
        }
 
-       if (!cli_close(cli1, fnum1)) {
+       if (!NT_STATUS_IS_OK(cli_close(cli1, fnum1))) {
                printf("close2 failed (%s)\n", cli_errstr(cli1));
                return False;
        }
@@ -3837,7 +3837,7 @@ static bool run_opentest(int dummy)
                return False;
        }
        printf("ctemp gave path %s\n", tmp_path);
-       if (!cli_close(cli1, fnum1)) {
+       if (!NT_STATUS_IS_OK(cli_close(cli1, fnum1))) {
                printf("close of temp failed (%s)\n", cli_errstr(cli1));
        }
        if (!NT_STATUS_IS_OK(cli_unlink(cli1, tmp_path, aSYSTEM | aHIDDEN))) {
@@ -3869,11 +3869,11 @@ static bool run_opentest(int dummy)
                return False;
        }
 
-       if (!cli_close(cli1, fnum1)) {
+       if (!NT_STATUS_IS_OK(cli_close(cli1, fnum1))) {
                printf("test 1 close 1 of %s failed (%s)\n", fname, cli_errstr(cli1));
                return False;
        }
-       if (!cli_close(cli2, fnum2)) {
+       if (!NT_STATUS_IS_OK(cli_close(cli2, fnum2))) {
                printf("test 1 close 2 of %s failed (%s)\n", fname, cli_errstr(cli2));
                return False;
        }
@@ -3896,11 +3896,11 @@ static bool run_opentest(int dummy)
                return False;
        }
 
-       if (!cli_close(cli1, fnum1)) {
+       if (!NT_STATUS_IS_OK(cli_close(cli1, fnum1))) {
                printf("test 1 close 1 of %s failed (%s)\n", fname, cli_errstr(cli1));
                return False;
        }
-       if (!cli_close(cli2, fnum2)) {
+       if (!NT_STATUS_IS_OK(cli_close(cli2, fnum2))) {
                printf("test 1 close 2 of %s failed (%s)\n", fname, cli_errstr(cli1));
                return False;
        }
@@ -3923,11 +3923,11 @@ static bool run_opentest(int dummy)
                return False;
        }
 
-       if (!cli_close(cli1, fnum1)) {
+       if (!NT_STATUS_IS_OK(cli_close(cli1, fnum1))) {
                printf("test 3 close 1 of %s failed (%s)\n", fname, cli_errstr(cli1));
                return False;
        }
-       if (!cli_close(cli2, fnum2)) {
+       if (!NT_STATUS_IS_OK(cli_close(cli2, fnum2))) {
                printf("test 3 close 2 of %s failed (%s)\n", fname, cli_errstr(cli2));
                return False;
        }
@@ -3952,7 +3952,7 @@ static bool run_opentest(int dummy)
 
        printf("test 3 open 2 of %s gave %s (correct error should be %s)\n", fname, cli_errstr(cli2), "sharing violation");
 
-       if (!cli_close(cli1, fnum1)) {
+       if (!NT_STATUS_IS_OK(cli_close(cli1, fnum1))) {
                printf("test 4 close 1 of %s failed (%s)\n", fname, cli_errstr(cli1));
                return False;
        }
@@ -3975,12 +3975,12 @@ static bool run_opentest(int dummy)
                return False;
        }
 
-       if (!cli_close(cli1, fnum1)) {
+       if (!NT_STATUS_IS_OK(cli_close(cli1, fnum1))) {
                printf("test 5 close 1 of %s failed (%s)\n", fname, cli_errstr(cli1));
                return False;
        }
 
-       if (!cli_close(cli2, fnum2)) {
+       if (!NT_STATUS_IS_OK(cli_close(cli2, fnum2))) {
                printf("test 5 close 2 of %s failed (%s)\n", fname, cli_errstr(cli2));
                return False;
        }
@@ -4003,12 +4003,12 @@ static bool run_opentest(int dummy)
                return False;
        }
 
-       if (!cli_close(cli1, fnum1)) {
+       if (!NT_STATUS_IS_OK(cli_close(cli1, fnum1))) {
                printf("test 6 close 1 of %s failed (%s)\n", fname, cli_errstr(cli1));
                return False;
        }
 
-       if (!cli_close(cli2, fnum2)) {
+       if (!NT_STATUS_IS_OK(cli_close(cli2, fnum2))) {
                printf("test 6 close 2 of %s failed (%s)\n", fname, cli_errstr(cli2));
                return False;
        }
@@ -4033,7 +4033,7 @@ static bool run_opentest(int dummy)
 
        printf("test 7 open 2 of %s gave %s (correct error should be %s)\n", fname, cli_errstr(cli2), "sharing violation");
 
-       if (!cli_close(cli1, fnum1)) {
+       if (!NT_STATUS_IS_OK(cli_close(cli1, fnum1))) {
                printf("test 7 close 1 of %s failed (%s)\n", fname, cli_errstr(cli1));
                return False;
        }
@@ -4107,7 +4107,7 @@ static bool run_simple_posix_open_test(int dummy)
                goto out;
        }
 
-       if (!cli_close(cli1, fnum1)) {
+       if (!NT_STATUS_IS_OK(cli_close(cli1, fnum1))) {
                printf("close failed (%s)\n", cli_errstr(cli1));
                goto out;
        }
@@ -4125,7 +4125,7 @@ static bool run_simple_posix_open_test(int dummy)
                goto out;
        }
 
-       if (!cli_close(cli1, fnum1)) {
+       if (!NT_STATUS_IS_OK(cli_close(cli1, fnum1))) {
                printf("close(2) failed (%s)\n", cli_errstr(cli1));
                goto out;
        }
@@ -4247,7 +4247,7 @@ static bool run_openattrtest(int dummy)
                        return False;
                }
 
-               if (!cli_close(cli1, fnum1)) {
+               if (!NT_STATUS_IS_OK(cli_close(cli1, fnum1))) {
                        printf("close %d (1) of %s failed (%s)\n", i, fname, cli_errstr(cli1));
                        return False;
                }
@@ -4277,7 +4277,7 @@ static bool run_openattrtest(int dummy)
                                continue;
                        }
 
-                       if (!cli_close(cli1, fnum1)) {
+                       if (!NT_STATUS_IS_OK(cli_close(cli1, fnum1))) {
                                printf("close %d (2) of %s failed (%s)\n", j, fname, cli_errstr(cli1));
                                return False;
                        }
index 770d3cac4955ed555caf534722a57b396e9a51e6..8e8103c2e2fde766afae9cdb21d1d5a5f42d6aa5 100644 (file)
@@ -254,14 +254,14 @@ NTSTATUS net_copy_fileattr(struct net_context *c,
 
        /* closing files */
 
-       if (!cli_close(cli_share_src, fnum_src)) {
+       if (!NT_STATUS_IS_OK(cli_close(cli_share_src, fnum_src))) {
                d_fprintf(stderr, "could not close %s on originating server: %s\n",
                        is_file?"file":"dir", cli_errstr(cli_share_src));
                nt_status = cli_nt_error(cli_share_src);
                goto out;
        }
 
-       if (!cli_close(cli_share_dst, fnum_dst)) {
+       if (!NT_STATUS_IS_OK(cli_close(cli_share_dst, fnum_dst))) {
                d_fprintf(stderr, "could not close %s on destination server: %s\n",
                        is_file?"file":"dir", cli_errstr(cli_share_dst));
                nt_status = cli_nt_error(cli_share_dst);
@@ -420,14 +420,14 @@ NTSTATUS net_copy_file(struct net_context *c,
 
 
        /* closing files */
-       if (!cli_close(cli_share_src, fnum_src)) {
+       if (!NT_STATUS_IS_OK(cli_close(cli_share_src, fnum_src))) {
                d_fprintf(stderr, "could not close file on originating server: %s\n",
                        cli_errstr(cli_share_src));
                nt_status = cli_nt_error(cli_share_src);
                goto out;
        }
 
-       if (is_file && !cli_close(cli_share_dst, fnum_dst)) {
+       if (is_file && !NT_STATUS_IS_OK(cli_close(cli_share_dst, fnum_dst))) {
                d_fprintf(stderr, "could not close file on destination server: %s\n",
                        cli_errstr(cli_share_dst));
                nt_status = cli_nt_error(cli_share_dst);