Convert libcli routines to return NTSTATUS instead of BOOL. Again, the
authorTim Potter <tpot@samba.org>
Tue, 10 Feb 2004 11:33:35 +0000 (11:33 +0000)
committerTim Potter <tpot@samba.org>
Tue, 10 Feb 2004 11:33:35 +0000 (11:33 +0000)
only users are smbclient and smbtorture.
(This used to be commit 54cb508c78e5c1faa3ade46b46b165983c880d10)

26 files changed:
source4/client/client.c
source4/client/clitar.c
source4/libcli/cliconnect.c
source4/libcli/clideltree.c
source4/libcli/clifile.c
source4/libcli/clitrans2.c
source4/torture/aliases.c
source4/torture/gentest.c
source4/torture/locktest.c
source4/torture/mangle_test.c
source4/torture/nbio.c
source4/torture/raw/chkpath.c
source4/torture/raw/context.c
source4/torture/raw/ioctl.c
source4/torture/raw/lock.c
source4/torture/raw/mux.c
source4/torture/raw/open.c
source4/torture/raw/read.c
source4/torture/raw/rename.c
source4/torture/raw/search.c
source4/torture/raw/seek.c
source4/torture/raw/setfileinfo.c
source4/torture/raw/unlink.c
source4/torture/raw/write.c
source4/torture/torture.c
source4/torture/utable.c

index ce754498f834a32a9975701baac7cf2bff5dd7ec..fef258a6b20c983d53dd15e38fbe6c3ec789c1ac 100644 (file)
@@ -243,7 +243,7 @@ static int do_dskattr(void)
 {
        int total, bsize, avail;
 
-       if (!cli_dskattr(cli->tree, &bsize, &total, &avail)) {
+       if (NT_STATUS_IS_ERR(cli_dskattr(cli->tree, &bsize, &total, &avail))) {
                d_printf("Error in dskattr: %s\n",cli_errstr(cli->tree)); 
                return 1;
        }
@@ -292,7 +292,7 @@ static int do_cd(char *newdir)
        dos_clean_name(cur_dir);
        
        if (!strequal(cur_dir,"\\")) {
-               if (!cli_chkpath(cli->tree, dname)) {
+               if (NT_STATUS_IS_ERR(cli_chkpath(cli->tree, dname))) {
                        d_printf("cd %s: %s\n", dname, cli_errstr(cli->tree));
                        pstrcpy(cur_dir,saved_dir);
                }
@@ -759,10 +759,10 @@ static int do_get(char *rname, const char *lname, BOOL reget)
        }
 
 
-       if (!cli_qfileinfo(cli->tree, fnum, 
-                          &attr, &size, NULL, NULL, NULL, NULL, NULL) &&
-           !cli_getattrE(cli->tree, fnum, 
-                         &attr, &size, NULL, NULL, NULL)) {
+       if (NT_STATUS_IS_ERR(cli_qfileinfo(cli->tree, fnum, 
+                          &attr, &size, NULL, NULL, NULL, NULL, NULL)) &&
+           NT_STATUS_IS_ERR(cli_getattrE(cli->tree, fnum, 
+                         &attr, &size, NULL, NULL, NULL))) {
                d_printf("getattrib: %s\n",cli_errstr(cli->tree));
                return 1;
        }
@@ -799,7 +799,7 @@ static int do_get(char *rname, const char *lname, BOOL reget)
 
        SAFE_FREE(data);
        
-       if (!cli_close(cli->tree, fnum)) {
+       if (NT_STATUS_IS_ERR(cli_close(cli->tree, fnum))) {
                d_printf("Error %s closing remote file\n",cli_errstr(cli->tree));
                rc = 1;
        }
@@ -1011,15 +1011,17 @@ static int cmd_mget(void)
 /****************************************************************************
 make a directory of name "name"
 ****************************************************************************/
-static BOOL do_mkdir(char *name)
+static NTSTATUS do_mkdir(char *name)
 {
-       if (!cli_mkdir(cli->tree, name)) {
+       NTSTATUS status;
+
+       if (NT_STATUS_IS_ERR(status = cli_mkdir(cli->tree, name))) {
                d_printf("%s making remote directory %s\n",
                         cli_errstr(cli->tree),name);
-               return(False);
+               return status;
        }
 
-       return(True);
+       return status;
 }
 
 /****************************************************************************
@@ -1079,7 +1081,7 @@ static int cmd_mkdir(void)
                p = strtok(ddir,"/\\");
                while (p) {
                        pstrcat(ddir2,p);
-                       if (!cli_chkpath(cli->tree, ddir2)) { 
+                       if (NT_STATUS_IS_ERR(cli_chkpath(cli->tree, ddir2))) { 
                                do_mkdir(ddir2);
                        }
                        pstrcat(ddir2,"\\");
@@ -1135,8 +1137,8 @@ static int do_put(char *rname, char *lname, BOOL reput)
        if (reput) {
                fnum = cli_open(cli->tree, rname, O_RDWR|O_CREAT, DENY_NONE);
                if (fnum >= 0) {
-                       if (!cli_qfileinfo(cli->tree, fnum, NULL, &start, NULL, NULL, NULL, NULL, NULL) &&
-                           !cli_getattrE(cli->tree, fnum, NULL, &start, NULL, NULL, NULL)) {
+                       if (NT_STATUS_IS_ERR(cli_qfileinfo(cli->tree, fnum, NULL, &start, NULL, NULL, NULL, NULL, NULL)) &&
+                           NT_STATUS_IS_ERR(cli_getattrE(cli->tree, fnum, NULL, &start, NULL, NULL, NULL))) {
                                d_printf("getattrib: %s\n",cli_errstr(cli->tree));
                                return 1;
                        }
@@ -1207,7 +1209,7 @@ static int do_put(char *rname, char *lname, BOOL reput)
                nread += n;
        }
 
-       if (!cli_close(cli->tree, fnum)) {
+       if (NT_STATUS_IS_ERR(cli_close(cli->tree, fnum))) {
                d_printf("%s closing remote file %s\n",cli_errstr(cli->tree),rname);
                x_fclose(f);
                SAFE_FREE(buf);
@@ -1453,8 +1455,8 @@ static int cmd_mput(void)
                                        SAFE_FREE(rname);
                                        if(asprintf(&rname, "%s%s", cur_dir, lname) < 0) break;
                                        dos_format(rname);
-                                       if (!cli_chkpath(cli->tree, rname) && 
-                                           !do_mkdir(rname)) {
+                                       if (NT_STATUS_IS_ERR(cli_chkpath(cli->tree, rname)) && 
+                                           NT_STATUS_IS_ERR(do_mkdir(rname))) {
                                                DEBUG (0, ("Unable to make dir, skipping..."));
                                                /* Skip the directory */
                                                lname[strlen(lname)-1] = '/';
@@ -1570,7 +1572,7 @@ static void do_del(file_info *finfo)
        if (finfo->mode & FILE_ATTRIBUTE_DIRECTORY) 
                return;
 
-       if (!cli_unlink(cli->tree, mask)) {
+       if (NT_STATUS_IS_ERR(cli_unlink(cli->tree, mask))) {
                d_printf("%s deleting remote file %s\n",cli_errstr(cli->tree),mask);
        }
 }
@@ -1822,7 +1824,7 @@ static int cmd_rmdir(void)
        }
        pstrcat(mask,buf);
 
-       if (!cli_rmdir(cli->tree, mask)) {
+       if (NT_STATUS_IS_ERR(cli_rmdir(cli->tree, mask))) {
                d_printf("%s removing remote directory file %s\n",
                         cli_errstr(cli->tree),mask);
        }
@@ -1855,7 +1857,7 @@ static int cmd_link(void)
        pstrcat(src,buf);
        pstrcat(dest,buf2);
 
-       if (!cli_unix_hardlink(cli->tree, src, dest)) {
+       if (NT_STATUS_IS_ERR(cli_unix_hardlink(cli->tree, src, dest))) {
                d_printf("%s linking files (%s -> %s)\n", cli_errstr(cli->tree), src, dest);
                return 1;
        }  
@@ -1889,7 +1891,7 @@ static int cmd_symlink(void)
        pstrcat(src,buf);
        pstrcat(dest,buf2);
 
-       if (!cli_unix_symlink(cli->tree, src, dest)) {
+       if (NT_STATUS_IS_ERR(cli_unix_symlink(cli->tree, src, dest))) {
                d_printf("%s symlinking files (%s -> %s)\n",
                        cli_errstr(cli->tree), src, dest);
                return 1;
@@ -1924,7 +1926,7 @@ static int cmd_chmod(void)
        mode = (mode_t)strtol(buf, NULL, 8);
        pstrcat(src,buf2);
 
-       if (!cli_unix_chmod(cli->tree, src, mode)) {
+       if (NT_STATUS_IS_ERR(cli_unix_chmod(cli->tree, src, mode))) {
                d_printf("%s chmod file %s 0%o\n",
                        cli_errstr(cli->tree), src, (unsigned int)mode);
                return 1;
@@ -1962,7 +1964,7 @@ static int cmd_chown(void)
        gid = (gid_t)atoi(buf2);
        pstrcat(src,buf3);
 
-       if (!cli_unix_chown(cli->tree, src, uid, gid)) {
+       if (NT_STATUS_IS_ERR(cli_unix_chown(cli->tree, src, uid, gid))) {
                d_printf("%s chown file %s uid=%d, gid=%d\n",
                        cli_errstr(cli->tree), src, (int)uid, (int)gid);
                return 1;
@@ -1991,7 +1993,7 @@ static int cmd_rename(void)
        pstrcat(src,buf);
        pstrcat(dest,buf2);
 
-       if (!cli_rename(cli->tree, src, dest)) {
+       if (NT_STATUS_IS_ERR(cli_rename(cli->tree, src, dest))) {
                d_printf("%s renaming files\n",cli_errstr(cli->tree));
                return 1;
        }
@@ -2732,7 +2734,7 @@ static struct cli_state *do_connect(const char *server, const char *share)
 
        DEBUG(4,(" session request ok\n"));
 
-       if (!cli_negprot(c)) {
+       if (NT_STATUS_IS_ERR(cli_negprot(c))) {
                d_printf("protocol negotiation failed\n");
                cli_shutdown(c);
                return NULL;
@@ -2745,11 +2747,11 @@ static struct cli_state *do_connect(const char *server, const char *share)
                }
        }
 
-       if (!cli_session_setup(c, username, password, 
-                              lp_workgroup())) {
+       if (NT_STATUS_IS_ERR(cli_session_setup(c, username, password, 
+                                              lp_workgroup()))) {
                /* if a password was not supplied then try again with a null username */
                if (password[0] || !username[0] || use_kerberos ||
-                   !cli_session_setup(c, "", "", lp_workgroup())) { 
+                   NT_STATUS_IS_ERR(cli_session_setup(c, "", "", lp_workgroup()))) { 
                        d_printf("session setup failed: %s\n", cli_errstr(c->tree));
                        cli_shutdown(c);
                        return NULL;
@@ -2759,7 +2761,7 @@ static struct cli_state *do_connect(const char *server, const char *share)
 
        DEBUG(4,(" session setup ok\n"));
 
-       if (!cli_send_tconX(c, sharename, "?????", password)) {
+       if (NT_STATUS_IS_ERR(cli_send_tconX(c, sharename, "?????", password))) {
                d_printf("tree connect failed: %s\n", cli_errstr(c->tree));
                cli_shutdown(c);
                return NULL;
index 2f423ede7d263f4ad03473bb2763deaf92a0fd35..da91ba4bebb9b98dbe5826041e572283c8d7874c 100644 (file)
@@ -539,8 +539,8 @@ static BOOL ensurepath(char *fname)
     {
       safe_strcat(partpath, p, strlen(fname) + 1);
 
-      if (!cli_chkpath(cli->tree, partpath)) {
-       if (!cli_mkdir(cli->tree, partpath))
+      if (NT_STATUS_IS_ERR(cli_chkpath(cli->tree, partpath))) {
+       if (NT_STATUS_IS_ERR(cli_mkdir(cli->tree, partpath)))
          {
            DEBUG(0, ("Error mkdirhiering\n"));
            return False;
@@ -578,7 +578,8 @@ static void do_setrattr(char *name, uint16 attr, int set)
 {
        uint16 oldattr;
 
-       if (!cli_getatr(cli->tree, name, &oldattr, NULL, NULL)) return;
+       if (NT_STATUS_IS_ERR(cli_getatr(cli->tree, name, &oldattr, NULL, NULL)))
+               return;
 
        if (set == ATTRSET) {
                attr |= oldattr;
@@ -586,7 +587,7 @@ static void do_setrattr(char *name, uint16 attr, int set)
                attr = oldattr & ~attr;
        }
 
-       if (!cli_setatr(cli->tree, name, attr, 0)) {
+       if (NT_STATUS_IS_ERR(cli_setatr(cli->tree, name, attr, 0))) {
                DEBUG(1,("setatr failed: %s\n", cli_errstr(cli->tree)));
        }
 }
@@ -663,7 +664,7 @@ static void do_atar(char *rname,char *lname,file_info *finfo1)
   safe_strcpy(finfo.name,rname, strlen(rname));
   if (!finfo1) {
          size_t size;
-         if (!cli_getattrE(cli->tree, fnum, &finfo.mode, &size, NULL, &finfo.atime, &finfo.mtime)) {
+         if (NT_STATUS_IS_ERR(cli_getattrE(cli->tree, fnum, &finfo.mode, &size, NULL, &finfo.atime, &finfo.mtime))) {
                  DEBUG(0, ("getattrE: %s\n", cli_errstr(cli->tree)));
                  return;
          }
@@ -1036,7 +1037,7 @@ static int get_file(file_info2 finfo)
 
   /* Now close the file ... */
 
-  if (!cli_close(cli->tree, fnum)) {
+  if (NT_STATUS_IS_ERR(cli_close(cli->tree, fnum))) {
          DEBUG(0, ("Error closing remote file\n"));
          return(False);
   }
@@ -1045,7 +1046,7 @@ static int get_file(file_info2 finfo)
 
   DEBUG(5, ("Updating creation date on %s\n", finfo.name));
 
-  if (!cli_setatr(cli->tree, finfo.name, finfo.mode, finfo.mtime)) {
+  if (NT_STATUS_IS_ERR(cli_setatr(cli->tree, finfo.name, finfo.mode, finfo.mtime))) {
          if (tar_real_noisy) {
                  DEBUG(0, ("Could not set time on file: %s\n", finfo.name));
                  /*return(False); */ /* Ignore, as Win95 does not allow changes */
index 4fdffa628712e7327e7dabce31d4066d39aebd68..e2d9665792148e3adbbe2fcf6672a6fb572744b7 100644 (file)
@@ -53,28 +53,26 @@ BOOL cli_transport_establish(struct cli_state *cli,
 }
 
 /* wrapper around smb_raw_negotiate() */
-BOOL cli_negprot(struct cli_state *cli)
+NTSTATUS cli_negprot(struct cli_state *cli)
 {
-       NTSTATUS status;
-       status = smb_raw_negotiate(cli->transport);
-       return NT_STATUS_IS_OK(status);
+       return smb_raw_negotiate(cli->transport);
 }
 
 /* wrapper around smb_raw_session_setup() */
-BOOL cli_session_setup(struct cli_state *cli, 
-                      const char *user, 
-                      const char *password, 
-                      const char *domain)
+NTSTATUS cli_session_setup(struct cli_state *cli, 
+                          const char *user, 
+                          const char *password, 
+                          const char *domain)
 {
        union smb_sesssetup setup;
        NTSTATUS status;
        TALLOC_CTX *mem_ctx;
 
        cli->session = cli_session_init(cli->transport);
-       if (!cli->session) return False;
+       if (!cli->session) return NT_STATUS_UNSUCCESSFUL;
 
        mem_ctx = talloc_init("cli_session_setup");
-       if (!mem_ctx) return False;
+       if (!mem_ctx) return NT_STATUS_NO_MEMORY;
 
        setup.generic.level = RAW_SESSSETUP_GENERIC;
        setup.generic.in.sesskey = cli->transport->negotiate.sesskey;
@@ -91,19 +89,19 @@ BOOL cli_session_setup(struct cli_state *cli,
 
        talloc_destroy(mem_ctx);
 
-       return NT_STATUS_IS_OK(status);
+       return status;
 }
 
 /* wrapper around smb_tree_connect() */
-BOOL cli_send_tconX(struct cli_state *cli, const char *sharename, const char *devtype,
-                   const char *password)
+NTSTATUS cli_send_tconX(struct cli_state *cli, const char *sharename, 
+                       const char *devtype, const char *password)
 {
        union smb_tcon tcon;
        TALLOC_CTX *mem_ctx;
        NTSTATUS status;
 
        cli->tree = cli_tree_init(cli->session);
-       if (!cli->tree) return False;
+       if (!cli->tree) return NT_STATUS_UNSUCCESSFUL;
 
        cli->tree->reference_count++;
 
@@ -115,9 +113,8 @@ BOOL cli_send_tconX(struct cli_state *cli, const char *sharename, const char *de
        tcon.tconx.in.device = devtype;
        
        mem_ctx = talloc_init("tcon");
-       if (!mem_ctx) {
-               return False;
-       }
+       if (!mem_ctx)
+               return NT_STATUS_NO_MEMORY;
 
        status = smb_tree_connect(cli->tree, mem_ctx, &tcon);
 
@@ -125,7 +122,7 @@ BOOL cli_send_tconX(struct cli_state *cli, const char *sharename, const char *de
 
        talloc_destroy(mem_ctx);
 
-       return NT_STATUS_IS_OK(status);
+       return status;
 }
 
 
@@ -182,11 +179,9 @@ done:
 /*
   disconnect the tree
 */
-BOOL cli_tdis(struct cli_state *cli)
+NTSTATUS cli_tdis(struct cli_state *cli)
 {
-       NTSTATUS status;
-       status = smb_tree_disconnect(cli->tree);
-       return NT_STATUS_IS_OK(status);
+       return smb_tree_disconnect(cli->tree);
 }
 
 /****************************************************************************
index d28950f1368f21f185b0db883b3b2287486a3118..2bbfd9bd228e0eb3dd96032cf142c9b869d48950 100644 (file)
@@ -41,7 +41,7 @@ static void delete_fn(file_info *finfo, const char *name, void *state)
        asprintf(&s, "%s%s", n, finfo->name);
 
        if (finfo->mode & FILE_ATTRIBUTE_READONLY) {
-               if (!cli_setatr(dstate->tree, s, 0, 0)) {
+               if (NT_STATUS_IS_ERR(cli_setatr(dstate->tree, s, 0, 0))) {
                        DEBUG(2,("Failed to remove READONLY on %s - %s\n",
                                 s, cli_errstr(dstate->tree)));                 
                }
@@ -55,14 +55,14 @@ static void delete_fn(file_info *finfo, const char *name, void *state)
                         FILE_ATTRIBUTE_DIRECTORY|FILE_ATTRIBUTE_HIDDEN|FILE_ATTRIBUTE_SYSTEM, 
                         delete_fn, state);
                free(s2);
-               if (!cli_rmdir(dstate->tree, s)) {
+               if (NT_STATUS_IS_ERR(cli_rmdir(dstate->tree, s))) {
                        DEBUG(2,("Failed to delete %s - %s\n", 
                                 s, cli_errstr(dstate->tree)));
                        dstate->failed = True;
                }
                dstate->total_deleted++;
        } else {
-               if (!cli_unlink(dstate->tree, s)) {
+               if (NT_STATUS_IS_ERR(cli_unlink(dstate->tree, s))) {
                        DEBUG(2,("Failed to delete %s - %s\n", 
                                 s, cli_errstr(dstate->tree)));
                        dstate->failed = True;
@@ -87,7 +87,7 @@ int cli_deltree(struct cli_tree *tree, const char *dname)
        dstate.failed = False;
 
        /* it might be a file */
-       if (cli_unlink(tree, dname)) {
+       if (NT_STATUS_IS_OK(cli_unlink(tree, dname))) {
                return 1;
        }
        if (NT_STATUS_EQUAL(cli_nt_error(tree), NT_STATUS_OBJECT_NAME_NOT_FOUND) ||
@@ -102,7 +102,7 @@ int cli_deltree(struct cli_tree *tree, const char *dname)
                 FILE_ATTRIBUTE_DIRECTORY|FILE_ATTRIBUTE_HIDDEN|FILE_ATTRIBUTE_SYSTEM, 
                 delete_fn, &dstate);
        free(mask);
-       if (!cli_rmdir(dstate.tree, dname)) {
+       if (NT_STATUS_IS_ERR(cli_rmdir(dstate.tree, dname))) {
                DEBUG(2,("Failed to delete %s - %s\n", 
                         dname, cli_errstr(dstate.tree)));
                return -1;
index 6606455e49e046955ce588cdf6c05dd44726d7ee..543283452279f2ef0ea039de9194e34e285e5942 100644 (file)
@@ -26,9 +26,9 @@
  Hard/Symlink a file (UNIX extensions).
 ****************************************************************************/
 
-static BOOL cli_link_internal(struct cli_tree *tree, 
-                             const char *fname_src, 
-                             const char *fname_dst, BOOL hard_link)
+static NTSTATUS cli_link_internal(struct cli_tree *tree, 
+                                 const char *fname_src, 
+                                 const char *fname_dst, BOOL hard_link)
 {
        union smb_setfileinfo parms;
        NTSTATUS status;
@@ -45,13 +45,13 @@ static BOOL cli_link_internal(struct cli_tree *tree,
        
        status = smb_raw_setpathinfo(tree, &parms);
 
-       return NT_STATUS_IS_OK(status);
+       return status;
 }
 
 /****************************************************************************
  Map standard UNIX permissions onto wire representations.
 ****************************************************************************/
-static uint32  unix_perms_to_wire(mode_t perms)
+static uint32 unix_perms_to_wire(mode_t perms)
 {
         unsigned int ret = 0;
 
@@ -79,8 +79,8 @@ static uint32  unix_perms_to_wire(mode_t perms)
 /****************************************************************************
  Symlink a file (UNIX extensions).
 ****************************************************************************/
-BOOL cli_unix_symlink(struct cli_tree *tree, const char *fname_src, 
-                     const char *fname_dst)
+NTSTATUS cli_unix_symlink(struct cli_tree *tree, const char *fname_src, 
+                         const char *fname_dst)
 {
        return cli_link_internal(tree, fname_src, fname_dst, False);
 }
@@ -88,8 +88,8 @@ BOOL cli_unix_symlink(struct cli_tree *tree, const char *fname_src,
 /****************************************************************************
  Hard a file (UNIX extensions).
 ****************************************************************************/
-BOOL cli_unix_hardlink(struct cli_tree *tree, const char *fname_src, 
-                      const char *fname_dst)
+NTSTATUS cli_unix_hardlink(struct cli_tree *tree, const char *fname_src, 
+                          const char *fname_dst)
 {
        return cli_link_internal(tree, fname_src, fname_dst, True);
 }
@@ -98,9 +98,10 @@ BOOL cli_unix_hardlink(struct cli_tree *tree, const char *fname_src,
 /****************************************************************************
  Chmod or chown a file internal (UNIX extensions).
 ****************************************************************************/
-static BOOL cli_unix_chmod_chown_internal(struct cli_tree *tree, 
-                                         const char *fname, 
-                                         uint32 mode, uint32 uid, uint32 gid)
+static NTSTATUS cli_unix_chmod_chown_internal(struct cli_tree *tree, 
+                                             const char *fname, 
+                                             uint32 mode, uint32 uid, 
+                                             uint32 gid)
 {
        union smb_setfileinfo parms;
        NTSTATUS status;
@@ -113,14 +114,14 @@ static BOOL cli_unix_chmod_chown_internal(struct cli_tree *tree,
        
        status = smb_raw_setpathinfo(tree, &parms);
 
-       return NT_STATUS_IS_OK(status);
+       return status;
 }
 
 /****************************************************************************
  chmod a file (UNIX extensions).
 ****************************************************************************/
 
-BOOL cli_unix_chmod(struct cli_tree *tree, const char *fname, mode_t mode)
+NTSTATUS cli_unix_chmod(struct cli_tree *tree, const char *fname, mode_t mode)
 {
        return cli_unix_chmod_chown_internal(tree, fname, 
                                             unix_perms_to_wire(mode), 
@@ -131,8 +132,8 @@ BOOL cli_unix_chmod(struct cli_tree *tree, const char *fname, mode_t mode)
 /****************************************************************************
  chown a file (UNIX extensions).
 ****************************************************************************/
-BOOL cli_unix_chown(struct cli_tree *tree, const char *fname, uid_t uid, 
-                   gid_t gid)
+NTSTATUS cli_unix_chown(struct cli_tree *tree, const char *fname, uid_t uid, 
+                       gid_t gid)
 {
        return cli_unix_chmod_chown_internal(tree, fname, SMB_MODE_NO_CHANGE, 
                                             (uint32)uid, (uint32)gid);
@@ -142,8 +143,8 @@ BOOL cli_unix_chown(struct cli_tree *tree, const char *fname, uid_t uid,
 /****************************************************************************
  Rename a file.
 ****************************************************************************/
-BOOL cli_rename(struct cli_tree *tree, const char *fname_src, 
-               const char *fname_dst)
+NTSTATUS cli_rename(struct cli_tree *tree, const char *fname_src, 
+                   const char *fname_dst)
 {
        union smb_rename parms;
 
@@ -151,14 +152,15 @@ BOOL cli_rename(struct cli_tree *tree, const char *fname_src,
        parms.rename.in.attrib = FILE_ATTRIBUTE_SYSTEM | FILE_ATTRIBUTE_HIDDEN | FILE_ATTRIBUTE_DIRECTORY;
        parms.rename.in.pattern1 = fname_src;
        parms.rename.in.pattern2 = fname_dst;
-       return NT_STATUS_IS_OK(smb_raw_rename(tree, &parms));
+
+       return smb_raw_rename(tree, &parms);
 }
 
 
 /****************************************************************************
  Delete a file.
 ****************************************************************************/
-BOOL cli_unlink(struct cli_tree *tree, const char *fname)
+NTSTATUS cli_unlink(struct cli_tree *tree, const char *fname)
 {
        struct smb_unlink parms;
 
@@ -168,39 +170,41 @@ BOOL cli_unlink(struct cli_tree *tree, const char *fname)
        } else {
                parms.in.attrib = FILE_ATTRIBUTE_SYSTEM | FILE_ATTRIBUTE_HIDDEN | FILE_ATTRIBUTE_DIRECTORY;
        }
-       return NT_STATUS_IS_OK(smb_raw_unlink(tree, &parms));
+
+       return smb_raw_unlink(tree, &parms);
 }
 
 /****************************************************************************
  Create a directory.
 ****************************************************************************/
-BOOL cli_mkdir(struct cli_tree *tree, const char *dname)
+NTSTATUS cli_mkdir(struct cli_tree *tree, const char *dname)
 {
        union smb_mkdir parms;
 
        parms.mkdir.level = RAW_MKDIR_MKDIR;
        parms.mkdir.in.path = dname;
 
-       return NT_STATUS_IS_OK(smb_raw_mkdir(tree, &parms));
+       return smb_raw_mkdir(tree, &parms);
 }
 
 
 /****************************************************************************
  Remove a directory.
 ****************************************************************************/
-BOOL cli_rmdir(struct cli_tree *tree, const char *dname)
+NTSTATUS cli_rmdir(struct cli_tree *tree, const char *dname)
 {
        struct smb_rmdir parms;
 
        parms.in.path = dname;
-       return NT_STATUS_IS_OK(smb_raw_rmdir(tree, &parms));
+
+       return smb_raw_rmdir(tree, &parms);
 }
 
 
 /****************************************************************************
  Set or clear the delete on close flag.
 ****************************************************************************/
-BOOL cli_nt_delete_on_close(struct cli_tree *tree, int fnum, BOOL flag)
+NTSTATUS cli_nt_delete_on_close(struct cli_tree *tree, int fnum, BOOL flag)
 {
        union smb_setfileinfo parms;
        NTSTATUS status;
@@ -211,7 +215,7 @@ BOOL cli_nt_delete_on_close(struct cli_tree *tree, int fnum, BOOL flag)
        
        status = smb_raw_setfileinfo(tree, &parms);
 
-       return NT_STATUS_IS_OK(status);
+       return status;
 }
 
 
@@ -326,7 +330,7 @@ int cli_open(struct cli_tree *tree, const char *fname, int flags,
 /****************************************************************************
  Close a file.
 ****************************************************************************/
-BOOL cli_close(struct cli_tree *tree, int fnum)
+NTSTATUS cli_close(struct cli_tree *tree, int fnum)
 {
        union smb_close close_parms;
        NTSTATUS status;
@@ -335,7 +339,7 @@ BOOL cli_close(struct cli_tree *tree, int fnum)
        close_parms.close.in.fnum = fnum;
        close_parms.close.in.write_time = 0;
        status = smb_raw_close(tree, &close_parms);
-       return NT_STATUS_IS_OK(status);
+       return status;
 }
 
 /****************************************************************************
@@ -343,7 +347,8 @@ BOOL cli_close(struct cli_tree *tree, int fnum)
  this is used for testing LOCKING_ANDX_CANCEL_LOCK
 ****************************************************************************/
 NTSTATUS cli_locktype(struct cli_tree *tree, int fnum, 
-                     uint32 offset, uint32 len, int timeout, unsigned char locktype)
+                     uint32 offset, uint32 len, int timeout, 
+                     unsigned char locktype)
 {
        union smb_lock parms;
        struct smb_lock_entry lock[1];
@@ -369,8 +374,9 @@ NTSTATUS cli_locktype(struct cli_tree *tree, int fnum,
 /****************************************************************************
  Lock a file.
 ****************************************************************************/
-BOOL cli_lock(struct cli_tree *tree, int fnum, 
-             uint32 offset, uint32 len, int timeout, enum brl_type lock_type)
+NTSTATUS cli_lock(struct cli_tree *tree, int fnum, 
+                 uint32 offset, uint32 len, int timeout, 
+                 enum brl_type lock_type)
 {
        union smb_lock parms;
        struct smb_lock_entry lock[1];
@@ -389,14 +395,14 @@ BOOL cli_lock(struct cli_tree *tree, int fnum,
 
        status = smb_raw_lock(tree, &parms);
 
-       return NT_STATUS_IS_OK(status);
+       return status;
 }
 
 
 /****************************************************************************
  Unlock a file.
 ****************************************************************************/
-BOOL cli_unlock(struct cli_tree *tree, int fnum, uint32 offset, uint32 len)
+NTSTATUS cli_unlock(struct cli_tree *tree, int fnum, uint32 offset, uint32 len)
 {
        union smb_lock parms;
        struct smb_lock_entry lock[1];
@@ -414,15 +420,16 @@ BOOL cli_unlock(struct cli_tree *tree, int fnum, uint32 offset, uint32 len)
        parms.lockx.in.locks = &lock[0];
        
        status = smb_raw_lock(tree, &parms);
-       return NT_STATUS_IS_OK(status);
+       return status;
 }
        
 
 /****************************************************************************
  Lock a file with 64 bit offsets.
 ****************************************************************************/
-BOOL cli_lock64(struct cli_tree *tree, int fnum, 
-               SMB_OFF_T offset, SMB_OFF_T len, int timeout, enum brl_type lock_type)
+NTSTATUS cli_lock64(struct cli_tree *tree, int fnum, 
+                   SMB_OFF_T offset, SMB_OFF_T len, int timeout, 
+                   enum brl_type lock_type)
 {
        union smb_lock parms;
        int ltype;
@@ -449,14 +456,15 @@ BOOL cli_lock64(struct cli_tree *tree, int fnum,
 
        status = smb_raw_lock(tree, &parms);
        
-       return NT_STATUS_IS_OK(status);
+       return status;
 }
 
 
 /****************************************************************************
  Unlock a file with 64 bit offsets.
 ****************************************************************************/
-BOOL cli_unlock64(struct cli_tree *tree, int fnum, SMB_OFF_T offset, SMB_OFF_T len)
+NTSTATUS cli_unlock64(struct cli_tree *tree, int fnum, SMB_OFF_T offset, 
+                     SMB_OFF_T len)
 {
        union smb_lock parms;
        struct smb_lock_entry lock[1];
@@ -479,16 +487,16 @@ BOOL cli_unlock64(struct cli_tree *tree, int fnum, SMB_OFF_T offset, SMB_OFF_T l
 
        status = smb_raw_lock(tree, &parms);
 
-       return NT_STATUS_IS_OK(status);
+       return status;
 }
 
 
 /****************************************************************************
  Do a SMBgetattrE call.
 ****************************************************************************/
-BOOL cli_getattrE(struct cli_tree *tree, int fd,
-                 uint16 *attr, size_t *size,
-                 time_t *c_time, time_t *a_time, time_t *m_time)
+NTSTATUS cli_getattrE(struct cli_tree *tree, int fd,
+                     uint16 *attr, size_t *size,
+                     time_t *c_time, time_t *a_time, time_t *m_time)
 {              
        union smb_fileinfo parms;
        NTSTATUS status;
@@ -499,7 +507,7 @@ BOOL cli_getattrE(struct cli_tree *tree, int fd,
        status = smb_raw_fileinfo(tree, NULL, &parms);
 
        if (!NT_STATUS_IS_OK(status))
-               return False;
+               return status;
 
        if (size) {
                *size = parms.getattre.out.size;
@@ -521,14 +529,14 @@ BOOL cli_getattrE(struct cli_tree *tree, int fd,
                *m_time = parms.getattre.out.write_time;
        }
 
-       return True;
+       return status;
 }
 
 /****************************************************************************
  Do a SMBgetatr call
 ****************************************************************************/
-BOOL cli_getatr(struct cli_tree *tree, const char *fname, 
-               uint16 *attr, size_t *size, time_t *t)
+NTSTATUS cli_getatr(struct cli_tree *tree, const char *fname, 
+                   uint16 *attr, size_t *size, time_t *t)
 {
        union smb_fileinfo parms;
        NTSTATUS status;
@@ -539,7 +547,7 @@ BOOL cli_getatr(struct cli_tree *tree, const char *fname,
        status = smb_raw_pathinfo(tree, NULL, &parms);
        
        if (!NT_STATUS_IS_OK(status)) {
-               return False;
+               return status;
        }
 
        if (size) {
@@ -554,14 +562,15 @@ BOOL cli_getatr(struct cli_tree *tree, const char *fname,
                *attr = parms.getattr.out.attrib;
        }
 
-       return True;
+       return status;
 }
 
 
 /****************************************************************************
  Do a SMBsetatr call.
 ****************************************************************************/
-BOOL cli_setatr(struct cli_tree *tree, const char *fname, uint16 mode, time_t t)
+NTSTATUS cli_setatr(struct cli_tree *tree, const char *fname, uint16 mode, 
+                   time_t t)
 {
        union smb_setfileinfo parms;
        NTSTATUS status;
@@ -573,14 +582,14 @@ BOOL cli_setatr(struct cli_tree *tree, const char *fname, uint16 mode, time_t t)
        
        status = smb_raw_setpathinfo(tree, &parms);
 
-       return NT_STATUS_IS_OK(status);
+       return status;
 }
 
 
 /****************************************************************************
  Check for existence of a dir.
 ****************************************************************************/
-BOOL cli_chkpath(struct cli_tree *tree, const char *path)
+NTSTATUS cli_chkpath(struct cli_tree *tree, const char *path)
 {
        struct smb_chkpath parms;
        char *path2;
@@ -599,14 +608,14 @@ BOOL cli_chkpath(struct cli_tree *tree, const char *path)
 
        free(path2);
 
-       return NT_STATUS_IS_OK(status);
+       return status;
 }
 
 
 /****************************************************************************
  Query disk space.
 ****************************************************************************/
-BOOL cli_dskattr(struct cli_tree *tree, int *bsize, int *total, int *avail)
+NTSTATUS cli_dskattr(struct cli_tree *tree, int *bsize, int *total, int *avail)
 {
        union smb_fsinfo fsinfo_parms;
        TALLOC_CTX *mem_ctx;
@@ -624,7 +633,7 @@ BOOL cli_dskattr(struct cli_tree *tree, int *bsize, int *total, int *avail)
 
        talloc_destroy(mem_ctx);
        
-       return NT_STATUS_IS_OK(status);
+       return status;
 }
 
 
@@ -654,4 +663,3 @@ int cli_ctemp(struct cli_tree *tree, const char *path, char **tmp_path)
        }
        return -1;
 }
-
index c8f7db5a9d94fb1c7d84eb6b21d7e32a5dde6e87..777150a2577141ae7993326c12e658284700b3b1 100644 (file)
 /****************************************************************************
 send a qpathinfo call
 ****************************************************************************/
-BOOL cli_qpathinfo(struct cli_tree *tree, const char *fname, 
-                  time_t *c_time, time_t *a_time, time_t *m_time, 
-                  size_t *size, uint16 *mode)
+NTSTATUS cli_qpathinfo(struct cli_tree *tree, const char *fname, 
+                      time_t *c_time, time_t *a_time, time_t *m_time, 
+                      size_t *size, uint16 *mode)
 {
        union smb_fileinfo parms;
        TALLOC_CTX *mem_ctx;
        NTSTATUS status;
 
        mem_ctx = talloc_init("cli_qpathinfo");
-       if (!mem_ctx) return False;
+       if (!mem_ctx) return NT_STATUS_NO_MEMORY;
 
        parms.standard.level = RAW_FILEINFO_STANDARD;
        parms.standard.in.fname = fname;
 
        status = smb_raw_pathinfo(tree, mem_ctx, &parms);
        talloc_destroy(mem_ctx);
-       if (!NT_STATUS_IS_OK(status)) {
-               return False;
-       }
+       if (!NT_STATUS_IS_OK(status))
+               return status;
 
        if (c_time) {
                *c_time = parms.standard.out.create_time;
@@ -59,32 +58,31 @@ BOOL cli_qpathinfo(struct cli_tree *tree, const char *fname,
                *mode = parms.standard.out.attrib;
        }
 
-       return True;
+       return status;
 }
 
 /****************************************************************************
 send a qpathinfo call with the SMB_QUERY_FILE_ALL_INFO info level
 ****************************************************************************/
-BOOL cli_qpathinfo2(struct cli_tree *tree, const char *fname, 
-                   time_t *c_time, time_t *a_time, time_t *m_time, 
-                   time_t *w_time, size_t *size, uint16 *mode,
-                   SMB_INO_T *ino)
+NTSTATUS cli_qpathinfo2(struct cli_tree *tree, const char *fname, 
+                       time_t *c_time, time_t *a_time, time_t *m_time, 
+                       time_t *w_time, size_t *size, uint16 *mode,
+                       SMB_INO_T *ino)
 {
        union smb_fileinfo parms;
        TALLOC_CTX *mem_ctx;
        NTSTATUS status;
 
        mem_ctx = talloc_init("cli_qfilename");
-       if (!mem_ctx) return False;
+       if (!mem_ctx) return NT_STATUS_NO_MEMORY;
 
        parms.all_info.level = RAW_FILEINFO_ALL_INFO;
        parms.all_info.in.fname = fname;
 
        status = smb_raw_pathinfo(tree, mem_ctx, &parms);
        talloc_destroy(mem_ctx);
-       if (!NT_STATUS_IS_OK(status)) {
-               return False;
-       }
+       if (!NT_STATUS_IS_OK(status))
+               return status;
 
        if (c_time) {
                *c_time = nt_time_to_unix(&parms.all_info.out.create_time);
@@ -105,22 +103,21 @@ BOOL cli_qpathinfo2(struct cli_tree *tree, const char *fname,
                *mode = parms.all_info.out.attrib;
        }
 
-       return True;
+       return status;
 }
 
 
 /****************************************************************************
 send a qfileinfo QUERY_FILE_NAME_INFO call
 ****************************************************************************/
-BOOL cli_qfilename(struct cli_tree *tree, int fnum, 
-                  const char **name)
+NTSTATUS cli_qfilename(struct cli_tree *tree, int fnum, const char **name)
 {
        union smb_fileinfo parms;
        TALLOC_CTX *mem_ctx;
        NTSTATUS status;
 
        mem_ctx = talloc_init("cli_qfilename");
-       if (!mem_ctx) return False;
+       if (!mem_ctx) return NT_STATUS_NO_MEMORY;
 
        parms.name_info.level = RAW_FILEINFO_NAME_INFO;
        parms.name_info.in.fnum = fnum;
@@ -129,31 +126,32 @@ BOOL cli_qfilename(struct cli_tree *tree, int fnum,
        if (!NT_STATUS_IS_OK(status)) {
                talloc_destroy(mem_ctx);
                *name = NULL;
-               return False;
+               return status;
        }
 
        *name = strdup(parms.name_info.out.fname.s);
 
        talloc_destroy(mem_ctx);
 
-       return True;
+       return status;
 }
 
 
 /****************************************************************************
 send a qfileinfo call
 ****************************************************************************/
-BOOL cli_qfileinfo(struct cli_tree *tree, int fnum, 
-                  uint16 *mode, size_t *size,
-                  time_t *c_time, time_t *a_time, time_t *m_time, 
-                  time_t *w_time, SMB_INO_T *ino)
+NTSTATUS cli_qfileinfo(struct cli_tree *tree, int fnum, 
+                      uint16 *mode, size_t *size,
+                      time_t *c_time, time_t *a_time, time_t *m_time, 
+                      time_t *w_time, SMB_INO_T *ino)
 {
        union smb_fileinfo parms;
        TALLOC_CTX *mem_ctx;
        NTSTATUS status;
 
        mem_ctx = talloc_init("cli_qfileinfo");
-       if (!mem_ctx) return False;
+       if (!mem_ctx) 
+               return NT_STATUS_NO_MEMORY;
 
        parms.all_info.level = RAW_FILEINFO_ALL_INFO;
        parms.all_info.in.fnum = fnum;
@@ -161,7 +159,7 @@ BOOL cli_qfileinfo(struct cli_tree *tree, int fnum,
        status = smb_raw_fileinfo(tree, mem_ctx, &parms);
        talloc_destroy(mem_ctx);
        if (!NT_STATUS_IS_OK(status)) {
-               return False;
+               return status;
        }
 
        if (c_time) {
@@ -186,7 +184,7 @@ BOOL cli_qfileinfo(struct cli_tree *tree, int fnum,
                *ino = 0;
        }
 
-       return True;
+       return status;
 }
 
 
index 9c8c366fd16fbdfc556bf637e8366afece980971..c4d6f947009fe45449079188bb6cf3d68f6b3a78 100644 (file)
@@ -371,7 +371,7 @@ static void setpathinfo_aliases(struct cli_state *cli)
 
        gen_set_aliases(cli, &t2, 0);
 
-       if (!cli_unlink(cli->tree, fname)) {
+       if (NT_STATUS_IS_ERR(cli_unlink(cli->tree, fname))) {
                printf("unlink: %s\n", cli_errstr(cli->tree));
        }
        talloc_destroy(mem_ctx);
index 484ee9aee9c196693ca45bb1b5df327122ab7ef9..03a66487fa7413e64473130208929277ae5d2380 100644 (file)
@@ -127,8 +127,8 @@ static BOOL connect_servers_fast(void)
        for (h=0;h<options.max_open_handles;h++) {
                if (!open_handles[h].active) continue;
                for (i=0;i<NSERVERS;i++) {
-                       if (!cli_close(servers[i].cli[open_handles[h].instance]->tree,
-                                      open_handles[h].server_fnum[i])) {
+                       if (NT_STATUS_IS_ERR((cli_close(servers[i].cli[open_handles[h].instance]->tree,
+                                      open_handles[h].server_fnum[i])))) {
                                return False;
                        }
                        open_handles[h].active = False;
@@ -234,8 +234,8 @@ static void gen_add_handle(int instance, const char *name, uint16 fnums[NSERVERS
                /* we have to force close a random handle */
                h = random() % options.max_open_handles;
                for (i=0;i<NSERVERS;i++) {
-                       if (!cli_close(servers[i].cli[open_handles[h].instance]->tree, 
-                                      open_handles[h].server_fnum[i])) {
+                       if (NT_STATUS_IS_ERR((cli_close(servers[i].cli[open_handles[h].instance]->tree, 
+                                      open_handles[h].server_fnum[i])))) {
                                printf("INTERNAL ERROR: Close failed when recovering handle! - %s\n",
                                       cli_errstr(servers[i].cli[open_handles[h].instance]->tree));
                        }
@@ -1811,7 +1811,7 @@ static void wipe_files(void)
                        printf("Failed to wipe tree on server %d\n", i);
                        exit(1);
                }
-               if (!cli_mkdir(servers[i].cli[0]->tree, "\\gentest")) {
+               if (NT_STATUS_IS_ERR(cli_mkdir(servers[i].cli[0]->tree, "\\gentest"))) {
                        printf("Failed to create \\gentest - %s\n",
                               cli_errstr(servers[i].cli[0]->tree));
                        exit(1);
index fcb229df083db9992c260ec5ca46357926796e27..cfc3d95cde9294dd1af9891ce65723ca7df52159 100644 (file)
@@ -177,9 +177,9 @@ static BOOL test_one(struct cli_state *cli[NSERVERS][NCONNECTIONS],
        case OP_LOCK:
                /* set a lock */
                for (server=0;server<NSERVERS;server++) {
-                       ret[server] = cli_lock64(cli[server][conn]->tree, 
+                       ret[server] = NT_STATUS_IS_OK(cli_lock64(cli[server][conn]->tree, 
                                                 fnum[server][conn][f],
-                                                start, len, LOCK_TIMEOUT, op);
+                                                start, len, LOCK_TIMEOUT, op));
                        status[server] = cli_nt_error(cli[server][conn]->tree);
                        if (!exact_error_codes && 
                            NT_STATUS_EQUAL(status[server], 
@@ -200,9 +200,9 @@ static BOOL test_one(struct cli_state *cli[NSERVERS][NCONNECTIONS],
        case OP_UNLOCK:
                /* unset a lock */
                for (server=0;server<NSERVERS;server++) {
-                       ret[server] = cli_unlock64(cli[server][conn]->tree, 
+                       ret[server] = NT_STATUS_IS_OK(cli_unlock64(cli[server][conn]->tree, 
                                                   fnum[server][conn][f],
-                                                  start, len);
+                                                  start, len));
                        status[server] = cli_nt_error(cli[server][conn]->tree);
                }
                if (showall || 
index f0aaee18ec5cf5714282478d5f23d4f5d053f544..94dac45b9d17e6a9a9601a56c69f8b43cb536268 100644 (file)
@@ -42,7 +42,7 @@ static BOOL test_one(struct cli_state *cli, const char *name)
                return False;
        }
 
-       if (!cli_close(cli->tree, fnum)) {
+       if (NT_STATUS_IS_ERR(cli_close(cli->tree, fnum))) {
                printf("close of %s failed (%s)\n", name, cli_errstr(cli->tree));
                return False;
        }
@@ -55,7 +55,7 @@ static BOOL test_one(struct cli_state *cli, const char *name)
        }
 
        snprintf(name2, sizeof(name2), "\\mangle_test\\%s", shortname);
-       if (!cli_unlink(cli->tree, name2)) {
+       if (NT_STATUS_IS_ERR(cli_unlink(cli->tree, name2))) {
                printf("unlink of %s  (%s) failed (%s)\n", 
                       name2, name, cli_errstr(cli->tree));
                return False;
@@ -67,13 +67,13 @@ static BOOL test_one(struct cli_state *cli, const char *name)
                printf("open2 of %s failed (%s)\n", name2, cli_errstr(cli->tree));
                return False;
        }
-       if (!cli_close(cli->tree, fnum)) {
+       if (NT_STATUS_IS_ERR(cli_close(cli->tree, fnum))) {
                printf("close of %s failed (%s)\n", name, cli_errstr(cli->tree));
                return False;
        }
 
        /* and unlink by long name */
-       if (!cli_unlink(cli->tree, name)) {
+       if (NT_STATUS_IS_ERR(cli_unlink(cli->tree, name))) {
                printf("unlink2 of %s  (%s) failed (%s)\n", 
                       name, name2, cli_errstr(cli->tree));
                failures++;
@@ -170,7 +170,7 @@ BOOL torture_mangle(int dummy)
        cli_unlink(cli->tree, "\\mangle_test\\*");
        cli_rmdir(cli->tree, "\\mangle_test");
 
-       if (!cli_mkdir(cli->tree, "\\mangle_test")) {
+       if (NT_STATUS_IS_ERR(cli_mkdir(cli->tree, "\\mangle_test"))) {
                printf("ERROR: Failed to make directory\n");
                return False;
        }
@@ -190,7 +190,7 @@ BOOL torture_mangle(int dummy)
        }
 
        cli_unlink(cli->tree, "\\mangle_test\\*");
-       if (!cli_rmdir(cli->tree, "\\mangle_test")) {
+       if (NT_STATUS_IS_ERR(cli_rmdir(cli->tree, "\\mangle_test"))) {
                printf("ERROR: Failed to remove directory\n");
                return False;
        }
index 49688d635433b48fa16929dff3fee264a5809fcc..65584b1852eb0409b284619c9b5b80375f118122 100644 (file)
@@ -118,7 +118,7 @@ void nb_setup(struct cli_state *cli)
 
 void nb_unlink(const char *fname)
 {
-       if (!cli_unlink(c->tree, fname)) {
+       if (NT_STATUS_IS_ERR(cli_unlink(c->tree, fname))) {
 #if NBDEBUG
                printf("(%d) unlink %s failed (%s)\n", 
                       line_count, fname, cli_errstr(c));
@@ -201,7 +201,7 @@ void nb_close(int handle)
 {
        int i;
        i = find_handle(handle);
-       if (!cli_close(c->tree, ftable[i].fd)) {
+       if (NT_STATUS_IS_ERR(cli_close(c->tree, ftable[i].fd))) {
                printf("(%d) close failed on handle %d\n", line_count, handle);
                exit(1);
        }
@@ -210,7 +210,7 @@ void nb_close(int handle)
 
 void nb_rmdir(const char *fname)
 {
-       if (!cli_rmdir(c->tree, fname)) {
+       if (NT_STATUS_IS_ERR(cli_rmdir(c->tree, fname))) {
                printf("ERROR: rmdir %s failed (%s)\n", 
                       fname, cli_errstr(c->tree));
                exit(1);
@@ -219,7 +219,7 @@ void nb_rmdir(const char *fname)
 
 void nb_rename(const char *old, const char *new)
 {
-       if (!cli_rename(c->tree, old, new)) {
+       if (NT_STATUS_IS_ERR(cli_rename(c->tree, old, new))) {
                printf("ERROR: rename %s %s failed (%s)\n", 
                       old, new, cli_errstr(c->tree));
                exit(1);
index 6e128a01a4e2884a91c6100a803ecdb89a4503af..72ddf3b5a2eed28d65c0670e79f37b8cf8e2623b 100644 (file)
@@ -124,7 +124,7 @@ BOOL torture_raw_chkpath(int dummy)
                printf("Failed to clean " BASEDIR "\n");
                return False;
        }
-       if (!cli_mkdir(cli->tree, BASEDIR)) {
+       if (NT_STATUS_IS_ERR(cli_mkdir(cli->tree, BASEDIR))) {
                printf("Failed to create " BASEDIR " - %s\n", cli_errstr(cli->tree));
                return False;
        }
index 4fc9b3788ef5f3a1956da0657435bc06507ab09a..91763da86fd6d0c651bb5bc87c0361dec8f4f5a5 100644 (file)
@@ -60,7 +60,7 @@ static BOOL test_session(struct cli_state *cli, TALLOC_CTX *mem_ctx)
        printf("TESTING SESSION HANDLING\n");
 
        if (cli_deltree(cli->tree, BASEDIR) == -1 ||
-           !cli_mkdir(cli->tree, BASEDIR)) {
+           NT_STATUS_IS_ERR(cli_mkdir(cli->tree, BASEDIR))) {
                printf("Unable to setup %s - %s\n", BASEDIR, cli_errstr(cli->tree));
                return False;
        }
@@ -168,7 +168,7 @@ static BOOL test_tree(struct cli_state *cli, TALLOC_CTX *mem_ctx)
        printf("TESTING TREE HANDLING\n");
 
        if (cli_deltree(cli->tree, BASEDIR) == -1 ||
-           !cli_mkdir(cli->tree, BASEDIR)) {
+           NT_STATUS_IS_ERR(cli_mkdir(cli->tree, BASEDIR))) {
                printf("Unable to setup %s - %s\n", BASEDIR, cli_errstr(cli->tree));
                return False;
        }
@@ -270,7 +270,7 @@ static BOOL test_pid(struct cli_state *cli, TALLOC_CTX *mem_ctx)
        printf("TESTING PID HANDLING\n");
 
        if (cli_deltree(cli->tree, BASEDIR) == -1 ||
-           !cli_mkdir(cli->tree, BASEDIR)) {
+           NT_STATUS_IS_ERR(cli_mkdir(cli->tree, BASEDIR))) {
                printf("Unable to setup %s - %s\n", BASEDIR, cli_errstr(cli->tree));
                return False;
        }
index a7787b6d28c6acbf34119b05fa919b206be3b590..4fd296d8115a3c66e6fd50753d09d2a90747109b 100644 (file)
@@ -137,7 +137,7 @@ BOOL torture_raw_ioctl(int dummy)
                printf("Failed to clean " BASEDIR "\n");
                return False;
        }
-       if (!cli_mkdir(cli->tree, BASEDIR)) {
+       if (NT_STATUS_IS_ERR(cli_mkdir(cli->tree, BASEDIR))) {
                printf("Failed to create " BASEDIR " - %s\n", cli_errstr(cli->tree));
                return False;
        }
index e36f9edddf856e806933212ec7c6c516de4fde47..9a9b8415681fb57f62423f77fe0d74bc7658f399 100644 (file)
@@ -51,7 +51,7 @@ static BOOL test_lock(struct cli_state *cli, TALLOC_CTX *mem_ctx)
        const char *fname = BASEDIR "\\test.txt";
 
        if (cli_deltree(cli->tree, BASEDIR) == -1 ||
-           !cli_mkdir(cli->tree, BASEDIR)) {
+           NT_STATUS_IS_ERR(cli_mkdir(cli->tree, BASEDIR))) {
                printf("Unable to setup %s - %s\n", BASEDIR, cli_errstr(cli->tree));
                return False;
        }
@@ -153,7 +153,7 @@ static BOOL test_lockx(struct cli_state *cli, TALLOC_CTX *mem_ctx)
        const char *fname = BASEDIR "\\test.txt";
 
        if (cli_deltree(cli->tree, BASEDIR) == -1 ||
-           !cli_mkdir(cli->tree, BASEDIR)) {
+           NT_STATUS_IS_ERR(cli_mkdir(cli->tree, BASEDIR))) {
                printf("Unable to setup %s - %s\n", BASEDIR, cli_errstr(cli->tree));
                return False;
        }
@@ -203,7 +203,7 @@ static BOOL test_pidhigh(struct cli_state *cli, TALLOC_CTX *mem_ctx)
        char c = 1;
 
        if (cli_deltree(cli->tree, BASEDIR) == -1 ||
-           !cli_mkdir(cli->tree, BASEDIR)) {
+           NT_STATUS_IS_ERR(cli_mkdir(cli->tree, BASEDIR))) {
                printf("Unable to setup %s - %s\n", BASEDIR, cli_errstr(cli->tree));
                return False;
        }
index 70e6c09d9e97754d7e993e98e647030276f9651f..8b3bcc12e3b75db91fc2a2f8c25cdd33371d3d6e 100644 (file)
@@ -110,7 +110,7 @@ static BOOL test_mux_write(struct cli_state *cli, TALLOC_CTX *mem_ctx)
        cli->session->pid = 1;
 
        /* lock a range */
-       if (!cli_lock(cli->tree, fnum, 0, 4, 0, WRITE_LOCK)) {
+       if (NT_STATUS_IS_ERR(cli_lock(cli->tree, fnum, 0, 4, 0, WRITE_LOCK))) {
                printf("lock failed in mux_write - %s\n", cli_errstr(cli->tree));
                ret = False;
                goto done;
@@ -271,7 +271,7 @@ BOOL torture_raw_mux(int dummy)
        }
 
 
-       if (!cli_mkdir(cli->tree, BASEDIR)) {
+       if (NT_STATUS_IS_ERR(cli_mkdir(cli->tree, BASEDIR))) {
                printf("Failed to create %s\n", BASEDIR);
                ret = False;
                goto done;
index 567940b2e874ab4aa1b1dd27e26e91ac21c7de20..d2055536a1146a73f6ab357e95f4d245ab00e2e5 100644 (file)
@@ -912,7 +912,7 @@ BOOL torture_raw_open(int dummy)
                printf("Failed to clean " BASEDIR "\n");
                return False;
        }
-       if (!cli_mkdir(cli->tree, BASEDIR)) {
+       if (NT_STATUS_IS_ERR(cli_mkdir(cli->tree, BASEDIR))) {
                printf("Failed to create " BASEDIR " - %s\n", cli_errstr(cli->tree));
                return False;
        }
index 0836b4d0211ef0c652dbaac626dc41a8a95f31ca..3e9547856cf502d7564b3df9717de2b46931f9b0 100644 (file)
@@ -91,7 +91,7 @@ static BOOL test_read(struct cli_state *cli, TALLOC_CTX *mem_ctx)
        buf = talloc_zero(mem_ctx, maxsize);
 
        if (cli_deltree(cli->tree, BASEDIR) == -1 ||
-           !cli_mkdir(cli->tree, BASEDIR)) {
+           NT_STATUS_IS_ERR(cli_mkdir(cli->tree, BASEDIR))) {
                printf("Unable to setup %s - %s\n", BASEDIR, cli_errstr(cli->tree));
                return False;
        }
@@ -178,7 +178,7 @@ static BOOL test_read(struct cli_state *cli, TALLOC_CTX *mem_ctx)
 
        printf("Trying locked region\n");
        cli->session->pid++;
-       if (!cli_lock(cli->tree, fnum, 103, 1, 0, WRITE_LOCK)) {
+       if (NT_STATUS_IS_ERR(cli_lock(cli->tree, fnum, 103, 1, 0, WRITE_LOCK))) {
                printf("Failed to lock file at %d\n", __LINE__);
                ret = False;
                goto done;
@@ -217,7 +217,7 @@ static BOOL test_lockread(struct cli_state *cli, TALLOC_CTX *mem_ctx)
        buf = talloc_zero(mem_ctx, maxsize);
 
        if (cli_deltree(cli->tree, BASEDIR) == -1 ||
-           !cli_mkdir(cli->tree, BASEDIR)) {
+           NT_STATUS_IS_ERR(cli_mkdir(cli->tree, BASEDIR))) {
                printf("Unable to setup %s - %s\n", BASEDIR, cli_errstr(cli->tree));
                return False;
        }
@@ -322,7 +322,7 @@ static BOOL test_lockread(struct cli_state *cli, TALLOC_CTX *mem_ctx)
 
        printf("Trying locked region\n");
        cli->session->pid++;
-       if (!cli_lock(cli->tree, fnum, 103, 1, 0, WRITE_LOCK)) {
+       if (NT_STATUS_IS_ERR(cli_lock(cli->tree, fnum, 103, 1, 0, WRITE_LOCK))) {
                printf("Failed to lock file at %d\n", __LINE__);
                ret = False;
                goto done;
@@ -360,7 +360,7 @@ static BOOL test_readx(struct cli_state *cli, TALLOC_CTX *mem_ctx)
        buf = talloc_zero(mem_ctx, maxsize);
 
        if (cli_deltree(cli->tree, BASEDIR) == -1 ||
-           !cli_mkdir(cli->tree, BASEDIR)) {
+           NT_STATUS_IS_ERR(cli_mkdir(cli->tree, BASEDIR))) {
                printf("Unable to setup %s - %s\n", BASEDIR, cli_errstr(cli->tree));
                return False;
        }
@@ -489,7 +489,7 @@ static BOOL test_readx(struct cli_state *cli, TALLOC_CTX *mem_ctx)
 
        printf("Trying locked region\n");
        cli->session->pid++;
-       if (!cli_lock(cli->tree, fnum, 103, 1, 0, WRITE_LOCK)) {
+       if (NT_STATUS_IS_ERR(cli_lock(cli->tree, fnum, 103, 1, 0, WRITE_LOCK))) {
                printf("Failed to lock file at %d\n", __LINE__);
                ret = False;
                goto done;
@@ -511,7 +511,7 @@ static BOOL test_readx(struct cli_state *cli, TALLOC_CTX *mem_ctx)
        CHECK_STATUS(status, NT_STATUS_OK);
        CHECK_VALUE(io.readx.out.nread, 0);
 
-       if (!cli_lock64(cli->tree, fnum, io.readx.in.offset, 1, 0, WRITE_LOCK)) {
+       if (NT_STATUS_IS_ERR(cli_lock64(cli->tree, fnum, io.readx.in.offset, 1, 0, WRITE_LOCK))) {
                printf("Failed to lock file at %d\n", __LINE__);
                ret = False;
                goto done;
@@ -547,7 +547,7 @@ static BOOL test_readbraw(struct cli_state *cli, TALLOC_CTX *mem_ctx)
        buf = talloc_zero(mem_ctx, maxsize);
 
        if (cli_deltree(cli->tree, BASEDIR) == -1 ||
-           !cli_mkdir(cli->tree, BASEDIR)) {
+           NT_STATUS_IS_ERR(cli_mkdir(cli->tree, BASEDIR))) {
                printf("Unable to setup %s - %s\n", BASEDIR, cli_errstr(cli->tree));
                return False;
        }
@@ -660,7 +660,7 @@ static BOOL test_readbraw(struct cli_state *cli, TALLOC_CTX *mem_ctx)
 
        printf("Trying locked region\n");
        cli->session->pid++;
-       if (!cli_lock(cli->tree, fnum, 103, 1, 0, WRITE_LOCK)) {
+       if (NT_STATUS_IS_ERR(cli_lock(cli->tree, fnum, 103, 1, 0, WRITE_LOCK))) {
                printf("Failed to lock file at %d\n", __LINE__);
                ret = False;
                goto done;
index d2f922cdfd94991b2062c0445fe780a4310f6048..98a6ce5fdea33e5fbbb6d7903b290fcbdccdd6a4 100644 (file)
@@ -52,7 +52,7 @@ static BOOL test_mv(struct cli_state *cli, TALLOC_CTX *mem_ctx)
        printf("Testing SMBmv\n");
 
        if (cli_deltree(cli->tree, BASEDIR) == -1 ||
-           !cli_mkdir(cli->tree, BASEDIR)) {
+           NT_STATUS_IS_ERR(cli_mkdir(cli->tree, BASEDIR))) {
                printf("Unable to setup %s - %s\n", BASEDIR, cli_errstr(cli->tree));
                return False;
        }
@@ -142,7 +142,7 @@ static BOOL test_ntrename(struct cli_state *cli, TALLOC_CTX *mem_ctx)
        printf("Testing SMBntrename\n");
 
        if (cli_deltree(cli->tree, BASEDIR) == -1 ||
-           !cli_mkdir(cli->tree, BASEDIR)) {
+           NT_STATUS_IS_ERR(cli_mkdir(cli->tree, BASEDIR))) {
                printf("Unable to setup %s - %s\n", BASEDIR, cli_errstr(cli->tree));
                return False;
        }
index 164c9bb4d88f2e3deb467541072648465d021c39..9881a45cb17e8862aea90f5f0d3db6ebaff4acc1 100644 (file)
@@ -551,7 +551,7 @@ static BOOL test_many_files(struct cli_state *cli, TALLOC_CTX *mem_ctx)
        };
 
        if (cli_deltree(cli->tree, BASEDIR) == -1 || 
-           !cli_mkdir(cli->tree, BASEDIR)) {
+           NT_STATUS_IS_ERR(cli_mkdir(cli->tree, BASEDIR))) {
                printf("Failed to create " BASEDIR " - %s\n", cli_errstr(cli->tree));
                return False;
        }
index fa95156969738647eefb7a0f5345f5f736f3a0ec..89528c72ad7e9ac7ab56065d91b17557fb8aeae8 100644 (file)
@@ -53,7 +53,7 @@ static BOOL test_seek(struct cli_state *cli, TALLOC_CTX *mem_ctx)
        char c[2];
 
        if (cli_deltree(cli->tree, BASEDIR) == -1 ||
-           !cli_mkdir(cli->tree, BASEDIR)) {
+           NT_STATUS_IS_ERR(cli_mkdir(cli->tree, BASEDIR))) {
                printf("Unable to setup %s - %s\n", BASEDIR, cli_errstr(cli->tree));
                return False;
        }
index f82a63180a4896cb5a405086b2f44a9f6f98ce91..fa286ae4daf0a016e0d90e0de069d4eb2854eecd 100644 (file)
@@ -500,10 +500,10 @@ BOOL torture_raw_sfileinfo(int dummy)
 done:
        smb_raw_exit(cli->session);
        cli_close(cli->tree, fnum);
-       if (!cli_unlink(cli->tree, fnum_fname)) {
+       if (NT_STATUS_IS_ERR(cli_unlink(cli->tree, fnum_fname))) {
                printf("Failed to delete %s - %s\n", fnum_fname, cli_errstr(cli->tree));
        }
-       if (!cli_unlink(cli->tree, path_fname)) {
+       if (NT_STATUS_IS_ERR(cli_unlink(cli->tree, path_fname))) {
                printf("Failed to delete %s - %s\n", path_fname, cli_errstr(cli->tree));
        }
 
index 741f8c61f76e5f8188f1ca9eab5fa419d83b05ce..f4598bc1d7ff482db5b3902f05118314b78e81ba 100644 (file)
@@ -41,7 +41,7 @@ static BOOL test_unlink(struct cli_state *cli, TALLOC_CTX *mem_ctx)
        const char *fname = BASEDIR "\\test.txt";
 
        if (cli_deltree(cli->tree, BASEDIR) == -1 ||
-           !cli_mkdir(cli->tree, BASEDIR)) {
+           NT_STATUS_IS_ERR(cli_mkdir(cli->tree, BASEDIR))) {
                printf("Unable to setup %s - %s\n", BASEDIR, cli_errstr(cli->tree));
                return False;
        }
index 3b356f109594102ec83dd446760e29f5bb742308..eb20fe3b842c287603a7d270c2917b5b28378734 100644 (file)
@@ -104,7 +104,7 @@ static BOOL test_write(struct cli_state *cli, TALLOC_CTX *mem_ctx)
        buf = talloc_zero(mem_ctx, maxsize);
 
        if (cli_deltree(cli->tree, BASEDIR) == -1 ||
-           !cli_mkdir(cli->tree, BASEDIR)) {
+           NT_STATUS_IS_ERR(cli_mkdir(cli->tree, BASEDIR))) {
                printf("Unable to setup %s - %s\n", BASEDIR, cli_errstr(cli->tree));
                return False;
        }
@@ -223,7 +223,7 @@ static BOOL test_writex(struct cli_state *cli, TALLOC_CTX *mem_ctx)
        buf = talloc_zero(mem_ctx, maxsize);
 
        if (cli_deltree(cli->tree, BASEDIR) == -1 ||
-           !cli_mkdir(cli->tree, BASEDIR)) {
+           NT_STATUS_IS_ERR(cli_mkdir(cli->tree, BASEDIR))) {
                printf("Unable to setup %s - %s\n", BASEDIR, cli_errstr(cli->tree));
                return False;
        }
@@ -312,7 +312,7 @@ static BOOL test_writex(struct cli_state *cli, TALLOC_CTX *mem_ctx)
 
        printf("Trying locked region\n");
        cli->session->pid++;
-       if (!cli_lock(cli->tree, fnum, 3, 1, 0, WRITE_LOCK)) {
+       if (NT_STATUS_IS_ERR(cli_lock(cli->tree, fnum, 3, 1, 0, WRITE_LOCK))) {
                printf("Failed to lock file at %d\n", __LINE__);
                ret = False;
                goto done;
@@ -397,7 +397,7 @@ static BOOL test_writeunlock(struct cli_state *cli, TALLOC_CTX *mem_ctx)
        buf = talloc_zero(mem_ctx, maxsize);
 
        if (cli_deltree(cli->tree, BASEDIR) == -1 ||
-           !cli_mkdir(cli->tree, BASEDIR)) {
+           NT_STATUS_IS_ERR(cli_mkdir(cli->tree, BASEDIR))) {
                printf("Unable to setup %s - %s\n", BASEDIR, cli_errstr(cli->tree));
                return False;
        }
@@ -536,7 +536,7 @@ static BOOL test_writeclose(struct cli_state *cli, TALLOC_CTX *mem_ctx)
        buf = talloc_zero(mem_ctx, maxsize);
 
        if (cli_deltree(cli->tree, BASEDIR) == -1 ||
-           !cli_mkdir(cli->tree, BASEDIR)) {
+           NT_STATUS_IS_ERR(cli_mkdir(cli->tree, BASEDIR))) {
                printf("Unable to setup %s - %s\n", BASEDIR, cli_errstr(cli->tree));
                return False;
        }
index 393ac9c56b1c6eb89919f4c63e7eb777b766a73a..9c71508bdf0b8ad16928da02079e07a424b774b3 100644 (file)
@@ -120,7 +120,7 @@ BOOL torture_close_connection(struct cli_state *c)
        BOOL ret = True;
        DEBUG(9,("torture_close_connection: cli_state@%p\n", c));
        if (!c) return True;
-       if (!cli_tdis(c)) {
+       if (NT_STATUS_IS_ERR(cli_tdis(c))) {
                printf("tdis failed (%s)\n", cli_errstr(c->tree));
                ret = False;
        }
@@ -201,7 +201,7 @@ static BOOL check_error(int line, struct cli_state *c,
 
 static BOOL wait_lock(struct cli_state *c, int fnum, uint32 offset, uint32 len)
 {
-       while (!cli_lock(c->tree, fnum, offset, len, -1, WRITE_LOCK)) {
+       while (NT_STATUS_IS_ERR(cli_lock(c->tree, fnum, offset, len, -1, WRITE_LOCK))) {
                if (!check_error(__LINE__, c, ERRDOS, ERRlock, NT_STATUS_LOCK_NOT_GRANTED)) return False;
        }
        return True;
@@ -273,17 +273,17 @@ static BOOL rw_torture(struct cli_state *c)
                        correct = False;
                }
 
-               if (!cli_close(c->tree, fnum)) {
+               if (NT_STATUS_IS_ERR(cli_close(c->tree, fnum))) {
                        printf("close failed (%s)\n", cli_errstr(c->tree));
                        correct = False;
                }
 
-               if (!cli_unlink(c->tree, fname)) {
+               if (NT_STATUS_IS_ERR(cli_unlink(c->tree, fname))) {
                        printf("unlink failed (%s)\n", cli_errstr(c->tree));
                        correct = False;
                }
 
-               if (!cli_unlock(c->tree, fnum2, n*sizeof(int), sizeof(int))) {
+               if (NT_STATUS_IS_ERR(cli_unlock(c->tree, fnum2, n*sizeof(int), sizeof(int)))) {
                        printf("unlock failed (%s)\n", cli_errstr(c->tree));
                        correct = False;
                }
@@ -406,7 +406,7 @@ static BOOL rw_torture3(struct cli_state *c, const char *lockfname)
 
        }
 
-       if (!cli_close(c->tree, fnum)) {
+       if (NT_STATUS_IS_ERR(cli_close(c->tree, fnum))) {
                printf("close failed (%s)\n", cli_errstr(c->tree));
                correct = False;
        }
@@ -478,16 +478,16 @@ static BOOL rw_torture2(struct cli_state *c1, struct cli_state *c2)
                }
        }
 
-       if (!cli_close(c2->tree, fnum2)) {
+       if (NT_STATUS_IS_ERR(cli_close(c2->tree, fnum2))) {
                printf("close failed (%s)\n", cli_errstr(c2->tree));
                correct = False;
        }
-       if (!cli_close(c1->tree, fnum1)) {
+       if (NT_STATUS_IS_ERR(cli_close(c1->tree, fnum1))) {
                printf("close failed (%s)\n", cli_errstr(c1->tree));
                correct = False;
        }
 
-       if (!cli_unlink(c1->tree, lockfname)) {
+       if (NT_STATUS_IS_ERR(cli_unlink(c1->tree, lockfname))) {
                printf("unlink failed (%s)\n", cli_errstr(c1->tree));
                correct = False;
        }
@@ -703,13 +703,13 @@ static BOOL run_locktest1(int dummy)
                return False;
        }
 
-       if (!cli_lock(cli1->tree, fnum1, 0, 4, 0, WRITE_LOCK)) {
+       if (NT_STATUS_IS_ERR(cli_lock(cli1->tree, fnum1, 0, 4, 0, WRITE_LOCK))) {
                printf("lock1 failed (%s)\n", cli_errstr(cli1->tree));
                return False;
        }
 
 
-       if (cli_lock(cli2->tree, fnum3, 0, 4, 0, WRITE_LOCK)) {
+       if (NT_STATUS_IS_OK(cli_lock(cli2->tree, fnum3, 0, 4, 0, WRITE_LOCK))) {
                printf("lock2 succeeded! This is a locking bug\n");
                return False;
        } else {
@@ -721,7 +721,7 @@ static BOOL run_locktest1(int dummy)
        lock_timeout = (6 + (random() % 20));
        printf("Testing lock timeout with timeout=%u\n", lock_timeout);
        t1 = time(NULL);
-       if (cli_lock(cli2->tree, fnum3, 0, 4, lock_timeout * 1000, WRITE_LOCK)) {
+       if (NT_STATUS_IS_OK(cli_lock(cli2->tree, fnum3, 0, 4, lock_timeout * 1000, WRITE_LOCK))) {
                printf("lock3 succeeded! This is a locking bug\n");
                return False;
        } else {
@@ -736,12 +736,12 @@ 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->tree, fnum2)) {
+       if (NT_STATUS_IS_ERR(cli_close(cli1->tree, fnum2))) {
                printf("close1 failed (%s)\n", cli_errstr(cli1->tree));
                return False;
        }
 
-       if (cli_lock(cli2->tree, fnum3, 0, 4, 0, WRITE_LOCK)) {
+       if (NT_STATUS_IS_OK(cli_lock(cli2->tree, fnum3, 0, 4, 0, WRITE_LOCK))) {
                printf("lock4 succeeded! This is a locking bug\n");
                return False;
        } else {
@@ -749,17 +749,17 @@ static BOOL run_locktest1(int dummy)
                                 NT_STATUS_FILE_LOCK_CONFLICT)) return False;
        }
 
-       if (!cli_close(cli1->tree, fnum1)) {
+       if (NT_STATUS_IS_ERR(cli_close(cli1->tree, fnum1))) {
                printf("close2 failed (%s)\n", cli_errstr(cli1->tree));
                return False;
        }
 
-       if (!cli_close(cli2->tree, fnum3)) {
+       if (NT_STATUS_IS_ERR(cli_close(cli2->tree, fnum3))) {
                printf("close3 failed (%s)\n", cli_errstr(cli2->tree));
                return False;
        }
 
-       if (!cli_unlink(cli1->tree, fname)) {
+       if (NT_STATUS_IS_ERR(cli_unlink(cli1->tree, fname))) {
                printf("unlink failed (%s)\n", cli_errstr(cli1->tree));
                return False;
        }
@@ -821,8 +821,7 @@ static BOOL run_tcon_test(int dummy)
        }
 
        tree1 = cli->tree;      /* save old tree connection */
-       if (!cli_send_tconX(cli, share, "?????",
-                           password)) {
+       if (NT_STATUS_IS_ERR(cli_send_tconX(cli, share, "?????", password))) {
                printf("%s refused 2nd tree connect (%s)\n", host,
                           cli_errstr(cli->tree));
                cli_shutdown(cli);
@@ -868,14 +867,14 @@ static BOOL run_tcon_test(int dummy)
        cli->session->vuid = vuid1;
        cli->tree->tid = cnum1;
 
-       if (!cli_close(cli->tree, fnum1)) {
+       if (NT_STATUS_IS_ERR(cli_close(cli->tree, fnum1))) {
                printf("close failed (%s)\n", cli_errstr(cli->tree));
                return False;
        }
 
        cli->tree->tid = cnum2;
 
-       if (!cli_tdis(cli)) {
+       if (NT_STATUS_IS_ERR(cli_tdis(cli))) {
                printf("secondary tdis failed (%s)\n", cli_errstr(cli->tree));
                return False;
        }
@@ -900,8 +899,8 @@ static BOOL tcon_devtest(struct cli_state *cli,
        BOOL ret;
        char *password = lp_parm_string(-1, "torture", "password");
 
-       status = cli_send_tconX(cli, myshare, devtype,
-                               password);
+       status = NT_STATUS_IS_OK(cli_send_tconX(cli, myshare, devtype, 
+                                               password));
 
        printf("Trying share %s with devtype %s\n", myshare, devtype);
 
@@ -1051,12 +1050,12 @@ static BOOL run_locktest2(int dummy)
 
        cli->session->pid = 1;
 
-       if (!cli_lock(cli->tree, fnum1, 0, 4, 0, WRITE_LOCK)) {
+       if (NT_STATUS_IS_ERR(cli_lock(cli->tree, fnum1, 0, 4, 0, WRITE_LOCK))) {
                printf("lock1 failed (%s)\n", cli_errstr(cli->tree));
                return False;
        }
 
-       if (cli_lock(cli->tree, fnum1, 0, 4, 0, WRITE_LOCK)) {
+       if (NT_STATUS_IS_OK(cli_lock(cli->tree, fnum1, 0, 4, 0, WRITE_LOCK))) {
                printf("WRITE lock1 succeeded! This is a locking bug\n");
                correct = False;
        } else {
@@ -1064,7 +1063,7 @@ static BOOL run_locktest2(int dummy)
                                 NT_STATUS_LOCK_NOT_GRANTED)) return False;
        }
 
-       if (cli_lock(cli->tree, fnum2, 0, 4, 0, WRITE_LOCK)) {
+       if (NT_STATUS_IS_OK(cli_lock(cli->tree, fnum2, 0, 4, 0, WRITE_LOCK))) {
                printf("WRITE lock2 succeeded! This is a locking bug\n");
                correct = False;
        } else {
@@ -1072,7 +1071,7 @@ static BOOL run_locktest2(int dummy)
                                 NT_STATUS_LOCK_NOT_GRANTED)) return False;
        }
 
-       if (cli_lock(cli->tree, fnum2, 0, 4, 0, READ_LOCK)) {
+       if (NT_STATUS_IS_OK(cli_lock(cli->tree, fnum2, 0, 4, 0, READ_LOCK))) {
                printf("READ lock2 succeeded! This is a locking bug\n");
                correct = False;
        } else {
@@ -1080,18 +1079,18 @@ static BOOL run_locktest2(int dummy)
                                 NT_STATUS_FILE_LOCK_CONFLICT)) return False;
        }
 
-       if (!cli_lock(cli->tree, fnum1, 100, 4, 0, WRITE_LOCK)) {
+       if (NT_STATUS_IS_ERR(cli_lock(cli->tree, fnum1, 100, 4, 0, WRITE_LOCK))) {
                printf("lock at 100 failed (%s)\n", cli_errstr(cli->tree));
        }
 
        cli->session->pid = 2;
 
-       if (cli_unlock(cli->tree, fnum1, 100, 4)) {
+       if (NT_STATUS_IS_OK(cli_unlock(cli->tree, fnum1, 100, 4))) {
                printf("unlock at 100 succeeded! This is a locking bug\n");
                correct = False;
        }
 
-       if (cli_unlock(cli->tree, fnum1, 0, 4)) {
+       if (NT_STATUS_IS_OK(cli_unlock(cli->tree, fnum1, 0, 4))) {
                printf("unlock1 succeeded! This is a locking bug\n");
                correct = False;
        } else {
@@ -1100,7 +1099,7 @@ static BOOL run_locktest2(int dummy)
                                 NT_STATUS_RANGE_NOT_LOCKED)) return False;
        }
 
-       if (cli_unlock(cli->tree, fnum1, 0, 8)) {
+       if (NT_STATUS_IS_OK(cli_unlock(cli->tree, fnum1, 0, 8))) {
                printf("unlock2 succeeded! This is a locking bug\n");
                correct = False;
        } else {
@@ -1109,7 +1108,7 @@ static BOOL run_locktest2(int dummy)
                                 NT_STATUS_RANGE_NOT_LOCKED)) return False;
        }
 
-       if (cli_lock(cli->tree, fnum3, 0, 4, 0, WRITE_LOCK)) {
+       if (NT_STATUS_IS_OK(cli_lock(cli->tree, fnum3, 0, 4, 0, WRITE_LOCK))) {
                printf("lock3 succeeded! This is a locking bug\n");
                correct = False;
        } else {
@@ -1118,17 +1117,17 @@ static BOOL run_locktest2(int dummy)
 
        cli->session->pid = 1;
 
-       if (!cli_close(cli->tree, fnum1)) {
+       if (NT_STATUS_IS_ERR(cli_close(cli->tree, fnum1))) {
                printf("close1 failed (%s)\n", cli_errstr(cli->tree));
                return False;
        }
 
-       if (!cli_close(cli->tree, fnum2)) {
+       if (NT_STATUS_IS_ERR(cli_close(cli->tree, fnum2))) {
                printf("close2 failed (%s)\n", cli_errstr(cli->tree));
                return False;
        }
 
-       if (!cli_close(cli->tree, fnum3)) {
+       if (NT_STATUS_IS_ERR(cli_close(cli->tree, fnum3))) {
                printf("close3 failed (%s)\n", cli_errstr(cli->tree));
                return False;
        }
@@ -1183,14 +1182,14 @@ static BOOL run_locktest3(int dummy)
 
        for (offset=i=0;i<torture_numops;i++) {
                NEXT_OFFSET;
-               if (!cli_lock(cli1->tree, fnum1, offset-1, 1, 0, WRITE_LOCK)) {
+               if (NT_STATUS_IS_ERR(cli_lock(cli1->tree, fnum1, offset-1, 1, 0, WRITE_LOCK))) {
                        printf("lock1 %d failed (%s)\n", 
                               i,
                               cli_errstr(cli1->tree));
                        return False;
                }
 
-               if (!cli_lock(cli2->tree, fnum2, offset-2, 1, 0, WRITE_LOCK)) {
+               if (NT_STATUS_IS_ERR(cli_lock(cli2->tree, fnum2, offset-2, 1, 0, WRITE_LOCK))) {
                        printf("lock2 %d failed (%s)\n", 
                               i,
                               cli_errstr(cli1->tree));
@@ -1203,22 +1202,22 @@ static BOOL run_locktest3(int dummy)
        for (offset=i=0;i<torture_numops;i++) {
                NEXT_OFFSET;
 
-               if (cli_lock(cli1->tree, fnum1, offset-2, 1, 0, WRITE_LOCK)) {
+               if (NT_STATUS_IS_OK(cli_lock(cli1->tree, fnum1, offset-2, 1, 0, WRITE_LOCK))) {
                        printf("error: lock1 %d succeeded!\n", i);
                        return False;
                }
 
-               if (cli_lock(cli2->tree, fnum2, offset-1, 1, 0, WRITE_LOCK)) {
+               if (NT_STATUS_IS_OK(cli_lock(cli2->tree, fnum2, offset-1, 1, 0, WRITE_LOCK))) {
                        printf("error: lock2 %d succeeded!\n", i);
                        return False;
                }
 
-               if (cli_lock(cli1->tree, fnum1, offset-1, 1, 0, WRITE_LOCK)) {
+               if (NT_STATUS_IS_OK(cli_lock(cli1->tree, fnum1, offset-1, 1, 0, WRITE_LOCK))) {
                        printf("error: lock3 %d succeeded!\n", i);
                        return False;
                }
 
-               if (cli_lock(cli2->tree, fnum2, offset-2, 1, 0, WRITE_LOCK)) {
+               if (NT_STATUS_IS_OK(cli_lock(cli2->tree, fnum2, offset-2, 1, 0, WRITE_LOCK))) {
                        printf("error: lock4 %d succeeded!\n", i);
                        return False;
                }
@@ -1229,14 +1228,14 @@ static BOOL run_locktest3(int dummy)
        for (offset=i=0;i<torture_numops;i++) {
                NEXT_OFFSET;
 
-               if (!cli_unlock(cli1->tree, fnum1, offset-1, 1)) {
+               if (NT_STATUS_IS_ERR(cli_unlock(cli1->tree, fnum1, offset-1, 1))) {
                        printf("unlock1 %d failed (%s)\n", 
                               i,
                               cli_errstr(cli1->tree));
                        return False;
                }
 
-               if (!cli_unlock(cli2->tree, fnum2, offset-2, 1)) {
+               if (NT_STATUS_IS_ERR(cli_unlock(cli2->tree, fnum2, offset-2, 1))) {
                        printf("unlock2 %d failed (%s)\n", 
                               i,
                               cli_errstr(cli1->tree));
@@ -1244,17 +1243,17 @@ static BOOL run_locktest3(int dummy)
                }
        }
 
-       if (!cli_close(cli1->tree, fnum1)) {
+       if (NT_STATUS_IS_ERR(cli_close(cli1->tree, fnum1))) {
                printf("close1 failed (%s)\n", cli_errstr(cli1->tree));
                return False;
        }
 
-       if (!cli_close(cli2->tree, fnum2)) {
+       if (NT_STATUS_IS_ERR(cli_close(cli2->tree, fnum2))) {
                printf("close2 failed (%s)\n", cli_errstr(cli2->tree));
                return False;
        }
 
-       if (!cli_unlink(cli1->tree, fname)) {
+       if (NT_STATUS_IS_ERR(cli_unlink(cli1->tree, fname))) {
                printf("unlink failed (%s)\n", cli_errstr(cli1->tree));
                return False;
        }
@@ -1307,113 +1306,113 @@ static BOOL run_locktest4(int dummy)
                goto fail;
        }
 
-       ret = cli_lock(cli1->tree, fnum1, 0, 4, 0, WRITE_LOCK) &&
-             cli_lock(cli1->tree, fnum1, 2, 4, 0, WRITE_LOCK);
+       ret = NT_STATUS_IS_OK(cli_lock(cli1->tree, fnum1, 0, 4, 0, WRITE_LOCK)) &&
+             NT_STATUS_IS_OK(cli_lock(cli1->tree, fnum1, 2, 4, 0, WRITE_LOCK));
        EXPECTED(ret, False);
        printf("the same process %s set overlapping write locks\n", ret?"can":"cannot");
            
-       ret = cli_lock(cli1->tree, fnum1, 10, 4, 0, READ_LOCK) &&
-             cli_lock(cli1->tree, fnum1, 12, 4, 0, READ_LOCK);
+       ret = NT_STATUS_IS_OK(cli_lock(cli1->tree, fnum1, 10, 4, 0, READ_LOCK)) &&
+             NT_STATUS_IS_OK(cli_lock(cli1->tree, fnum1, 12, 4, 0, READ_LOCK));
        EXPECTED(ret, True);
        printf("the same process %s set overlapping read locks\n", ret?"can":"cannot");
 
-       ret = cli_lock(cli1->tree, fnum1, 20, 4, 0, WRITE_LOCK) &&
-             cli_lock(cli2->tree, fnum2, 22, 4, 0, WRITE_LOCK);
+       ret = NT_STATUS_IS_OK(cli_lock(cli1->tree, fnum1, 20, 4, 0, WRITE_LOCK)) &&
+             NT_STATUS_IS_OK(cli_lock(cli2->tree, fnum2, 22, 4, 0, WRITE_LOCK));
        EXPECTED(ret, False);
        printf("a different connection %s set overlapping write locks\n", ret?"can":"cannot");
            
-       ret = cli_lock(cli1->tree, fnum1, 30, 4, 0, READ_LOCK) &&
-             cli_lock(cli2->tree, fnum2, 32, 4, 0, READ_LOCK);
+       ret = NT_STATUS_IS_OK(cli_lock(cli1->tree, fnum1, 30, 4, 0, READ_LOCK)) &&
+               NT_STATUS_IS_OK(cli_lock(cli2->tree, fnum2, 32, 4, 0, READ_LOCK));
        EXPECTED(ret, True);
        printf("a different connection %s set overlapping read locks\n", ret?"can":"cannot");
        
-       ret = (cli1->session->pid = 1, cli_lock(cli1->tree, fnum1, 40, 4, 0, WRITE_LOCK)) &&
-             (cli1->session->pid = 2, cli_lock(cli1->tree, fnum1, 42, 4, 0, WRITE_LOCK));
+       ret = NT_STATUS_IS_OK((cli1->session->pid = 1, cli_lock(cli1->tree, fnum1, 40, 4, 0, WRITE_LOCK))) &&
+             NT_STATUS_IS_OK((cli1->session->pid = 2, cli_lock(cli1->tree, fnum1, 42, 4, 0, WRITE_LOCK)));
        EXPECTED(ret, False);
        printf("a different pid %s set overlapping write locks\n", ret?"can":"cannot");
            
-       ret = (cli1->session->pid = 1, cli_lock(cli1->tree, fnum1, 50, 4, 0, READ_LOCK)) &&
-             (cli1->session->pid = 2, cli_lock(cli1->tree, fnum1, 52, 4, 0, READ_LOCK));
+       ret = NT_STATUS_IS_OK((cli1->session->pid = 1, cli_lock(cli1->tree, fnum1, 50, 4, 0, READ_LOCK))) &&
+             NT_STATUS_IS_OK((cli1->session->pid = 2, cli_lock(cli1->tree, fnum1, 52, 4, 0, READ_LOCK)));
        EXPECTED(ret, True);
        printf("a different pid %s set overlapping read locks\n", ret?"can":"cannot");
 
-       ret = cli_lock(cli1->tree, fnum1, 60, 4, 0, READ_LOCK) &&
-             cli_lock(cli1->tree, fnum1, 60, 4, 0, READ_LOCK);
+       ret = NT_STATUS_IS_OK(cli_lock(cli1->tree, fnum1, 60, 4, 0, READ_LOCK)) &&
+             NT_STATUS_IS_OK(cli_lock(cli1->tree, fnum1, 60, 4, 0, READ_LOCK));
        EXPECTED(ret, True);
        printf("the same process %s set the same read lock twice\n", ret?"can":"cannot");
 
-       ret = cli_lock(cli1->tree, fnum1, 70, 4, 0, WRITE_LOCK) &&
-             cli_lock(cli1->tree, fnum1, 70, 4, 0, WRITE_LOCK);
+       ret = NT_STATUS_IS_OK(cli_lock(cli1->tree, fnum1, 70, 4, 0, WRITE_LOCK)) &&
+             NT_STATUS_IS_OK(cli_lock(cli1->tree, fnum1, 70, 4, 0, WRITE_LOCK));
        EXPECTED(ret, False);
        printf("the same process %s set the same write lock twice\n", ret?"can":"cannot");
 
-       ret = cli_lock(cli1->tree, fnum1, 80, 4, 0, READ_LOCK) &&
-             cli_lock(cli1->tree, fnum1, 80, 4, 0, WRITE_LOCK);
+       ret = NT_STATUS_IS_OK(cli_lock(cli1->tree, fnum1, 80, 4, 0, READ_LOCK)) &&
+             NT_STATUS_IS_OK(cli_lock(cli1->tree, fnum1, 80, 4, 0, WRITE_LOCK));
        EXPECTED(ret, False);
        printf("the same process %s overlay a read lock with a write lock\n", ret?"can":"cannot");
 
-       ret = cli_lock(cli1->tree, fnum1, 90, 4, 0, WRITE_LOCK) &&
-             cli_lock(cli1->tree, fnum1, 90, 4, 0, READ_LOCK);
+       ret = NT_STATUS_IS_OK(cli_lock(cli1->tree, fnum1, 90, 4, 0, WRITE_LOCK)) &&
+             NT_STATUS_IS_OK(cli_lock(cli1->tree, fnum1, 90, 4, 0, READ_LOCK));
        EXPECTED(ret, True);
        printf("the same process %s overlay a write lock with a read lock\n", ret?"can":"cannot");
 
-       ret = (cli1->session->pid = 1, cli_lock(cli1->tree, fnum1, 100, 4, 0, WRITE_LOCK)) &&
-             (cli1->session->pid = 2, cli_lock(cli1->tree, fnum1, 100, 4, 0, READ_LOCK));
+       ret = NT_STATUS_IS_OK((cli1->session->pid = 1, cli_lock(cli1->tree, fnum1, 100, 4, 0, WRITE_LOCK))) &&
+             NT_STATUS_IS_OK((cli1->session->pid = 2, cli_lock(cli1->tree, fnum1, 100, 4, 0, READ_LOCK)));
        EXPECTED(ret, False);
        printf("a different pid %s overlay a write lock with a read lock\n", ret?"can":"cannot");
 
-       ret = cli_lock(cli1->tree, fnum1, 110, 4, 0, READ_LOCK) &&
-             cli_lock(cli1->tree, fnum1, 112, 4, 0, READ_LOCK) &&
-             cli_unlock(cli1->tree, fnum1, 110, 6);
+       ret = NT_STATUS_IS_OK(cli_lock(cli1->tree, fnum1, 110, 4, 0, READ_LOCK)) &&
+             NT_STATUS_IS_OK(cli_lock(cli1->tree, fnum1, 112, 4, 0, READ_LOCK)) &&
+             NT_STATUS_IS_OK(cli_unlock(cli1->tree, fnum1, 110, 6));
        EXPECTED(ret, False);
        printf("the same process %s coalesce read locks\n", ret?"can":"cannot");
 
 
-       ret = cli_lock(cli1->tree, fnum1, 120, 4, 0, WRITE_LOCK) &&
+       ret = NT_STATUS_IS_OK(cli_lock(cli1->tree, fnum1, 120, 4, 0, WRITE_LOCK)) &&
              (cli_read(cli2->tree, fnum2, buf, 120, 4) == 4);
        EXPECTED(ret, False);
        printf("this server %s strict write locking\n", ret?"doesn't do":"does");
 
-       ret = cli_lock(cli1->tree, fnum1, 130, 4, 0, READ_LOCK) &&
+       ret = NT_STATUS_IS_OK(cli_lock(cli1->tree, fnum1, 130, 4, 0, READ_LOCK)) &&
              (cli_write(cli2->tree, fnum2, 0, buf, 130, 4) == 4);
        EXPECTED(ret, False);
        printf("this server %s strict read locking\n", ret?"doesn't do":"does");
 
 
-       ret = cli_lock(cli1->tree, fnum1, 140, 4, 0, READ_LOCK) &&
-             cli_lock(cli1->tree, fnum1, 140, 4, 0, READ_LOCK) &&
-             cli_unlock(cli1->tree, fnum1, 140, 4) &&
-             cli_unlock(cli1->tree, fnum1, 140, 4);
+       ret = NT_STATUS_IS_OK(cli_lock(cli1->tree, fnum1, 140, 4, 0, READ_LOCK)) &&
+             NT_STATUS_IS_OK(cli_lock(cli1->tree, fnum1, 140, 4, 0, READ_LOCK)) &&
+             NT_STATUS_IS_OK(cli_unlock(cli1->tree, fnum1, 140, 4)) &&
+             NT_STATUS_IS_OK(cli_unlock(cli1->tree, fnum1, 140, 4));
        EXPECTED(ret, True);
        printf("this server %s do recursive read locking\n", ret?"does":"doesn't");
 
 
-       ret = cli_lock(cli1->tree, fnum1, 150, 4, 0, WRITE_LOCK) &&
-             cli_lock(cli1->tree, fnum1, 150, 4, 0, READ_LOCK) &&
-             cli_unlock(cli1->tree, fnum1, 150, 4) &&
+       ret = NT_STATUS_IS_OK(cli_lock(cli1->tree, fnum1, 150, 4, 0, WRITE_LOCK)) &&
+             NT_STATUS_IS_OK(cli_lock(cli1->tree, fnum1, 150, 4, 0, READ_LOCK)) &&
+             NT_STATUS_IS_OK(cli_unlock(cli1->tree, fnum1, 150, 4)) &&
              (cli_read(cli2->tree, fnum2, buf, 150, 4) == 4) &&
              !(cli_write(cli2->tree, fnum2, 0, buf, 150, 4) == 4) &&
-             cli_unlock(cli1->tree, fnum1, 150, 4);
+             NT_STATUS_IS_OK(cli_unlock(cli1->tree, fnum1, 150, 4));
        EXPECTED(ret, True);
        printf("this server %s do recursive lock overlays\n", ret?"does":"doesn't");
 
-       ret = cli_lock(cli1->tree, fnum1, 160, 4, 0, READ_LOCK) &&
-             cli_unlock(cli1->tree, fnum1, 160, 4) &&
+       ret = NT_STATUS_IS_OK(cli_lock(cli1->tree, fnum1, 160, 4, 0, READ_LOCK)) &&
+             NT_STATUS_IS_OK(cli_unlock(cli1->tree, fnum1, 160, 4)) &&
              (cli_write(cli2->tree, fnum2, 0, buf, 160, 4) == 4) &&            
              (cli_read(cli2->tree, fnum2, buf, 160, 4) == 4);          
        EXPECTED(ret, True);
        printf("the same process %s remove a read lock using write locking\n", ret?"can":"cannot");
 
-       ret = cli_lock(cli1->tree, fnum1, 170, 4, 0, WRITE_LOCK) &&
-             cli_unlock(cli1->tree, fnum1, 170, 4) &&
+       ret = NT_STATUS_IS_OK(cli_lock(cli1->tree, fnum1, 170, 4, 0, WRITE_LOCK)) &&
+             NT_STATUS_IS_OK(cli_unlock(cli1->tree, fnum1, 170, 4)) &&
              (cli_write(cli2->tree, fnum2, 0, buf, 170, 4) == 4) &&            
              (cli_read(cli2->tree, fnum2, buf, 170, 4) == 4);          
        EXPECTED(ret, True);
        printf("the same process %s remove a write lock using read locking\n", ret?"can":"cannot");
 
-       ret = cli_lock(cli1->tree, fnum1, 190, 4, 0, WRITE_LOCK) &&
-             cli_lock(cli1->tree, fnum1, 190, 4, 0, READ_LOCK) &&
-             cli_unlock(cli1->tree, fnum1, 190, 4) &&
+       ret = NT_STATUS_IS_OK(cli_lock(cli1->tree, fnum1, 190, 4, 0, WRITE_LOCK)) &&
+             NT_STATUS_IS_OK(cli_lock(cli1->tree, fnum1, 190, 4, 0, READ_LOCK)) &&
+             NT_STATUS_IS_OK(cli_unlock(cli1->tree, fnum1, 190, 4)) &&
              !(cli_write(cli2->tree, fnum2, 0, buf, 190, 4) == 4) &&           
              (cli_read(cli2->tree, fnum2, buf, 190, 4) == 4);          
        EXPECTED(ret, True);
@@ -1423,11 +1422,11 @@ static BOOL run_locktest4(int dummy)
        cli_close(cli2->tree, fnum2);
        fnum1 = cli_open(cli1->tree, fname, O_RDWR, DENY_NONE);
        f = cli_open(cli1->tree, fname, O_RDWR, DENY_NONE);
-       ret = cli_lock(cli1->tree, fnum1, 0, 8, 0, READ_LOCK) &&
-             cli_lock(cli1->tree, f, 0, 1, 0, READ_LOCK) &&
-             cli_close(cli1->tree, fnum1) &&
+       ret = NT_STATUS_IS_OK(cli_lock(cli1->tree, fnum1, 0, 8, 0, READ_LOCK)) &&
+             NT_STATUS_IS_OK(cli_lock(cli1->tree, f, 0, 1, 0, READ_LOCK)) &&
+             NT_STATUS_IS_OK(cli_close(cli1->tree, fnum1)) &&
              ((fnum1 = cli_open(cli1->tree, fname, O_RDWR, DENY_NONE)) != -1) &&
-             cli_lock(cli1->tree, fnum1, 7, 1, 0, WRITE_LOCK);
+             NT_STATUS_IS_OK(cli_lock(cli1->tree, fnum1, 7, 1, 0, WRITE_LOCK));
         cli_close(cli1->tree, f);
        cli_close(cli1->tree, fnum1);
        EXPECTED(ret, True);
@@ -1477,23 +1476,23 @@ static BOOL run_locktest5(int dummy)
        }
 
        /* Check for NT bug... */
-       ret = cli_lock(cli1->tree, fnum1, 0, 8, 0, READ_LOCK) &&
-                 cli_lock(cli1->tree, fnum3, 0, 1, 0, READ_LOCK);
+       ret = NT_STATUS_IS_OK(cli_lock(cli1->tree, fnum1, 0, 8, 0, READ_LOCK)) &&
+                 NT_STATUS_IS_OK(cli_lock(cli1->tree, fnum3, 0, 1, 0, READ_LOCK));
        cli_close(cli1->tree, fnum1);
        fnum1 = cli_open(cli1->tree, fname, O_RDWR, DENY_NONE);
-       ret = cli_lock(cli1->tree, fnum1, 7, 1, 0, WRITE_LOCK);
+       ret = NT_STATUS_IS_OK(cli_lock(cli1->tree, fnum1, 7, 1, 0, WRITE_LOCK));
        EXPECTED(ret, True);
        printf("this server %s the NT locking bug\n", ret ? "doesn't have" : "has");
        cli_close(cli1->tree, fnum1);
        fnum1 = cli_open(cli1->tree, fname, O_RDWR, DENY_NONE);
        cli_unlock(cli1->tree, fnum3, 0, 1);
 
-       ret = cli_lock(cli1->tree, fnum1, 0, 4, 0, WRITE_LOCK) &&
-             cli_lock(cli1->tree, fnum1, 1, 1, 0, READ_LOCK);
+       ret = NT_STATUS_IS_OK(cli_lock(cli1->tree, fnum1, 0, 4, 0, WRITE_LOCK)) &&
+             NT_STATUS_IS_OK(cli_lock(cli1->tree, fnum1, 1, 1, 0, READ_LOCK));
        EXPECTED(ret, True);
        printf("the same process %s overlay a write with a read lock\n", ret?"can":"cannot");
 
-       ret = cli_lock(cli2->tree, fnum2, 0, 4, 0, READ_LOCK);
+       ret = NT_STATUS_IS_OK(cli_lock(cli2->tree, fnum2, 0, 4, 0, READ_LOCK));
        EXPECTED(ret, False);
 
        printf("a different processs %s get a read lock on the first process lock stack\n", ret?"can":"cannot");
@@ -1501,7 +1500,7 @@ static BOOL run_locktest5(int dummy)
        /* Unlock the process 2 lock. */
        cli_unlock(cli2->tree, fnum2, 0, 4);
 
-       ret = cli_lock(cli1->tree, fnum3, 0, 4, 0, READ_LOCK);
+       ret = NT_STATUS_IS_OK(cli_lock(cli1->tree, fnum3, 0, 4, 0, READ_LOCK));
        EXPECTED(ret, False);
 
        printf("the same processs on a different fnum %s get a read lock\n", ret?"can":"cannot");
@@ -1510,8 +1509,8 @@ static BOOL run_locktest5(int dummy)
        cli_unlock(cli1->tree, fnum3, 0, 4);
 
        /* Stack 2 more locks here. */
-       ret = cli_lock(cli1->tree, fnum1, 0, 4, 0, READ_LOCK) &&
-                 cli_lock(cli1->tree, fnum1, 0, 4, 0, READ_LOCK);
+       ret = NT_STATUS_IS_OK(cli_lock(cli1->tree, fnum1, 0, 4, 0, READ_LOCK)) &&
+                 NT_STATUS_IS_OK(cli_lock(cli1->tree, fnum1, 0, 4, 0, READ_LOCK));
 
        EXPECTED(ret, True);
        printf("the same process %s stack read locks\n", ret?"can":"cannot");
@@ -1519,8 +1518,8 @@ static BOOL run_locktest5(int dummy)
        /* Unlock the first process lock, then check this was the WRITE lock that was
                removed. */
 
-       ret = cli_unlock(cli1->tree, fnum1, 0, 4) &&
-                       cli_lock(cli2->tree, fnum2, 0, 4, 0, READ_LOCK);
+ret = NT_STATUS_IS_OK(cli_unlock(cli1->tree, fnum1, 0, 4)) &&
+       NT_STATUS_IS_OK(cli_lock(cli2->tree, fnum2, 0, 4, 0, READ_LOCK));
 
        EXPECTED(ret, True);
        printf("the first unlock removes the %s lock\n", ret?"WRITE":"READ");
@@ -1530,20 +1529,20 @@ static BOOL run_locktest5(int dummy)
 
        /* We should have 3 stacked locks here. Ensure we need to do 3 unlocks. */
 
-       ret = cli_unlock(cli1->tree, fnum1, 1, 1) &&
-                 cli_unlock(cli1->tree, fnum1, 0, 4) &&
-                 cli_unlock(cli1->tree, fnum1, 0, 4);
+       ret = NT_STATUS_IS_OK(cli_unlock(cli1->tree, fnum1, 1, 1)) &&
+                 NT_STATUS_IS_OK(cli_unlock(cli1->tree, fnum1, 0, 4)) &&
+                 NT_STATUS_IS_OK(cli_unlock(cli1->tree, fnum1, 0, 4));
 
        EXPECTED(ret, True);
        printf("the same process %s unlock the stack of 4 locks\n", ret?"can":"cannot"); 
 
        /* Ensure the next unlock fails. */
-       ret = cli_unlock(cli1->tree, fnum1, 0, 4);
+       ret = NT_STATUS_IS_OK(cli_unlock(cli1->tree, fnum1, 0, 4));
        EXPECTED(ret, False);
        printf("the same process %s count the lock stack\n", !ret?"can":"cannot"); 
 
        /* Ensure connection 2 can get a write lock. */
-       ret = cli_lock(cli2->tree, fnum2, 0, 4, 0, WRITE_LOCK);
+       ret = NT_STATUS_IS_OK(cli_lock(cli2->tree, fnum2, 0, 4, 0, WRITE_LOCK));
        EXPECTED(ret, True);
 
        printf("a different processs %s get a write lock on the unlocked stack\n", ret?"can":"cannot");
@@ -1633,7 +1632,7 @@ static BOOL run_locktest7(int dummy)
 
        cli1->session->pid = 1;
 
-       if (!cli_lock(cli1->tree, fnum1, 130, 4, 0, READ_LOCK)) {
+       if (NT_STATUS_IS_ERR(cli_lock(cli1->tree, fnum1, 130, 4, 0, READ_LOCK))) {
                printf("Unable to apply read lock on range 130:4, error was %s\n", cli_errstr(cli1->tree));
                goto fail;
        } else {
@@ -1680,7 +1679,7 @@ static BOOL run_locktest7(int dummy)
        cli1->session->pid = 1;
        cli_unlock(cli1->tree, fnum1, 130, 4);
 
-       if (!cli_lock(cli1->tree, fnum1, 130, 4, 0, WRITE_LOCK)) {
+       if (NT_STATUS_IS_ERR(cli_lock(cli1->tree, fnum1, 130, 4, 0, WRITE_LOCK))) {
                printf("Unable to apply write lock on range 130:4, error was %s\n", cli_errstr(cli1->tree));
                goto fail;
        } else {
@@ -1829,7 +1828,7 @@ static BOOL run_unlinktest(int dummy)
 
        printf("Unlinking a open file\n");
 
-       if (cli_unlink(cli->tree, fname)) {
+       if (NT_STATUS_IS_OK(cli_unlink(cli->tree, fname))) {
                printf("error: server allowed unlink on an open file\n");
                correct = False;
        } else {
@@ -1890,10 +1889,10 @@ static BOOL run_maxfidtest(int dummy)
        printf("cleaning up\n");
        for (;i>=0;i--) {
                asprintf(&fname, template, i,(int)getpid());
-               if (!cli_close(cli->tree, fnums[i])) {
+               if (NT_STATUS_IS_ERR(cli_close(cli->tree, fnums[i]))) {
                        printf("Close of fnum %d failed - %s\n", fnums[i], cli_errstr(cli->tree));
                }
-               if (!cli_unlink(cli->tree, fname)) {
+               if (NT_STATUS_IS_ERR(cli_unlink(cli->tree, fname))) {
                        printf("unlink of %s failed (%s)\n", 
                               fname, cli_errstr(cli->tree));
                        correct = False;
@@ -1962,7 +1961,7 @@ static BOOL run_attrtest(int dummy)
                        O_RDWR | O_CREAT | O_TRUNC, DENY_NONE);
        cli_close(cli->tree, fnum);
 
-       if (!cli_getatr(cli->tree, fname, NULL, NULL, &t)) {
+       if (NT_STATUS_IS_ERR(cli_getatr(cli->tree, fname, NULL, NULL, &t))) {
                printf("getatr failed (%s)\n", cli_errstr(cli->tree));
                correct = False;
        }
@@ -1980,12 +1979,12 @@ static BOOL run_attrtest(int dummy)
 
        printf("Setting file time to %s", ctime(&t2));
 
-       if (!cli_setatr(cli->tree, fname, 0, t2)) {
+       if (NT_STATUS_IS_ERR(cli_setatr(cli->tree, fname, 0, t2))) {
                printf("setatr failed (%s)\n", cli_errstr(cli->tree));
                correct = True;
        }
 
-       if (!cli_getatr(cli->tree, fname, NULL, NULL, &t)) {
+       if (NT_STATUS_IS_ERR(cli_getatr(cli->tree, fname, NULL, NULL, &t))) {
                printf("getatr failed (%s)\n", cli_errstr(cli->tree));
                correct = True;
        }
@@ -2038,15 +2037,15 @@ static BOOL run_trans2test(int dummy)
        
        fnum = cli_open(cli->tree, fname, 
                        O_RDWR | O_CREAT | O_TRUNC, DENY_NONE);
-       if (!cli_qfileinfo(cli->tree, fnum, NULL, &size, &c_time, &a_time, &m_time,
-                          NULL, NULL)) {
+       if (NT_STATUS_IS_ERR(cli_qfileinfo(cli->tree, fnum, NULL, &size, &c_time, &a_time, &m_time,
+                          NULL, NULL))) {
                printf("ERROR: qfileinfo failed (%s)\n", cli_errstr(cli->tree));
                correct = False;
        }
 
        printf("Testing NAME_INFO\n");
 
-       if (!cli_qfilename(cli->tree, fnum, &pname)) {
+       if (NT_STATUS_IS_ERR(cli_qfilename(cli->tree, fnum, &pname))) {
                printf("ERROR: qfilename failed (%s)\n", cli_errstr(cli->tree));
                correct = False;
        }
@@ -2070,7 +2069,7 @@ static BOOL run_trans2test(int dummy)
 
        printf("Checking for sticky create times\n");
 
-       if (!cli_qpathinfo(cli->tree, fname, &c_time, &a_time, &m_time, &size, NULL)) {
+       if (NT_STATUS_IS_ERR(cli_qpathinfo(cli->tree, fname, &c_time, &a_time, &m_time, &size, NULL))) {
                printf("ERROR: qpathinfo failed (%s)\n", cli_errstr(cli->tree));
                correct = False;
        } else {
@@ -2096,8 +2095,7 @@ static BOOL run_trans2test(int dummy)
        fnum = cli_open(cli->tree, fname, 
                        O_RDWR | O_CREAT | O_TRUNC, DENY_NONE);
        cli_close(cli->tree, fnum);
-       if (!cli_qpathinfo2(cli->tree, fname, &c_time, &a_time, &m_time, 
-                           &w_time, &size, NULL, NULL)) {
+       if (NT_STATUS_IS_ERR(cli_qpathinfo2(cli->tree, fname, &c_time, &a_time, &m_time, &w_time, &size, NULL, NULL))) {
                printf("ERROR: qpathinfo2 failed (%s)\n", cli_errstr(cli->tree));
                correct = False;
        } else {
@@ -2113,13 +2111,12 @@ static BOOL run_trans2test(int dummy)
 
        /* check if the server updates the directory modification time
            when creating a new file */
-       if (!cli_mkdir(cli->tree, dname)) {
+       if (NT_STATUS_IS_ERR(cli_mkdir(cli->tree, dname))) {
                printf("ERROR: mkdir failed (%s)\n", cli_errstr(cli->tree));
                correct = False;
        }
        sleep(3);
-       if (!cli_qpathinfo2(cli->tree, "\\trans2\\", &c_time, &a_time, &m_time, 
-                           &w_time, &size, NULL, NULL)) {
+       if (NT_STATUS_IS_ERR(cli_qpathinfo2(cli->tree, "\\trans2\\", &c_time, &a_time, &m_time, &w_time, &size, NULL, NULL))) {
                printf("ERROR: qpathinfo2 failed (%s)\n", cli_errstr(cli->tree));
                correct = False;
        }
@@ -2128,8 +2125,7 @@ static BOOL run_trans2test(int dummy)
                        O_RDWR | O_CREAT | O_TRUNC, DENY_NONE);
        cli_write(cli->tree, fnum,  0, (char *)&fnum, 0, sizeof(fnum));
        cli_close(cli->tree, fnum);
-       if (!cli_qpathinfo2(cli->tree, "\\trans2\\", &c_time, &a_time, &m_time2, 
-                           &w_time, &size, NULL, NULL)) {
+       if (NT_STATUS_IS_ERR(cli_qpathinfo2(cli->tree, "\\trans2\\", &c_time, &a_time, &m_time2, &w_time, &size, NULL, NULL))) {
                printf("ERROR: qpathinfo2 failed (%s)\n", cli_errstr(cli->tree));
                correct = False;
        } else {
@@ -2183,7 +2179,7 @@ static BOOL run_deletetest(int dummy)
                goto fail;
        }
        
-       if (!cli_close(cli1->tree, fnum1)) {
+       if (NT_STATUS_IS_ERR(cli_close(cli1->tree, fnum1))) {
                printf("[1] close failed (%s)\n", cli_errstr(cli1->tree));
                correct = False;
                goto fail;
@@ -2213,13 +2209,13 @@ static BOOL run_deletetest(int dummy)
                goto fail;
        }
        
-       if (!cli_nt_delete_on_close(cli1->tree, fnum1, True)) {
+       if (NT_STATUS_IS_ERR(cli_nt_delete_on_close(cli1->tree, fnum1, True))) {
                printf("[2] setting delete_on_close failed (%s)\n", cli_errstr(cli1->tree));
                correct = False;
                goto fail;
        }
        
-       if (!cli_close(cli1->tree, fnum1)) {
+       if (NT_STATUS_IS_ERR(cli_close(cli1->tree, fnum1))) {
                printf("[2] close failed (%s)\n", cli_errstr(cli1->tree));
                correct = False;
                goto fail;
@@ -2228,7 +2224,7 @@ static BOOL run_deletetest(int dummy)
        fnum1 = cli_open(cli1->tree, fname, O_RDONLY, DENY_NONE);
        if (fnum1 != -1) {
                printf("[2] open of %s succeeded should have been deleted on close !\n", fname);
-               if (!cli_close(cli1->tree, fnum1)) {
+               if (NT_STATUS_IS_ERR(cli_close(cli1->tree, fnum1))) {
                        printf("[2] close failed (%s)\n", cli_errstr(cli1->tree));
                        correct = False;
                        goto fail;
@@ -2274,19 +2270,19 @@ static BOOL run_deletetest(int dummy)
                goto fail;
        }
 
-       if (!cli_nt_delete_on_close(cli1->tree, fnum1, True)) {
+       if (NT_STATUS_IS_ERR(cli_nt_delete_on_close(cli1->tree, fnum1, True))) {
                printf("[3] setting delete_on_close failed (%s)\n", cli_errstr(cli1->tree));
                correct = False;
                goto fail;
        }
        
-       if (!cli_close(cli1->tree, fnum1)) {
+       if (NT_STATUS_IS_ERR(cli_close(cli1->tree, fnum1))) {
                printf("[3] close 1 failed (%s)\n", cli_errstr(cli1->tree));
                correct = False;
                goto fail;
        }
        
-       if (!cli_close(cli1->tree, fnum2)) {
+       if (NT_STATUS_IS_ERR(cli_close(cli1->tree, fnum2))) {
                printf("[3] close 2 failed (%s)\n", cli_errstr(cli1->tree));
                correct = False;
                goto fail;
@@ -2297,7 +2293,7 @@ static BOOL run_deletetest(int dummy)
        fnum1 = cli_open(cli1->tree, fname, O_RDONLY, DENY_NONE);
        if (fnum1 != -1) {
                printf("[3] open of %s succeeded should have been deleted on close !\n", fname);
-               if (!cli_close(cli1->tree, fnum1)) {
+               if (NT_STATUS_IS_ERR(cli_close(cli1->tree, fnum1))) {
                        printf("[3] close failed (%s)\n", cli_errstr(cli1->tree));
                }
                cli_unlink(cli1->tree, fname);
@@ -2337,13 +2333,13 @@ static BOOL run_deletetest(int dummy)
                goto fail;
        }
        
-       if (!cli_close(cli1->tree, fnum2)) {
+       if (NT_STATUS_IS_ERR(cli_close(cli1->tree, fnum2))) {
                printf("[4] close - 1 failed (%s)\n", cli_errstr(cli1->tree));
                correct = False;
                goto fail;
        }
        
-       if (!cli_nt_delete_on_close(cli1->tree, fnum1, True)) {
+       if (NT_STATUS_IS_ERR(cli_nt_delete_on_close(cli1->tree, fnum1, True))) {
                printf("[4] setting delete_on_close failed (%s)\n", cli_errstr(cli1->tree));
                correct = False;
                goto fail;
@@ -2360,7 +2356,7 @@ static BOOL run_deletetest(int dummy)
        } else
                printf("fourth delete on close test succeeded.\n");
        
-       if (!cli_close(cli1->tree, fnum1)) {
+       if (NT_STATUS_IS_ERR(cli_close(cli1->tree, fnum1))) {
                printf("[4] close - 2 failed (%s)\n", cli_errstr(cli1->tree));
                correct = False;
                goto fail;
@@ -2379,13 +2375,13 @@ static BOOL run_deletetest(int dummy)
 
        /* This should fail - only allowed on NT opens with DELETE access. */
 
-       if (cli_nt_delete_on_close(cli1->tree, fnum1, True)) {
+       if (NT_STATUS_IS_OK(cli_nt_delete_on_close(cli1->tree, fnum1, True))) {
                printf("[5] setting delete_on_close on OpenX file succeeded - should fail !\n");
                correct = False;
                goto fail;
        }
 
-       if (!cli_close(cli1->tree, fnum1)) {
+       if (NT_STATUS_IS_ERR(cli_close(cli1->tree, fnum1))) {
                printf("[5] close - 2 failed (%s)\n", cli_errstr(cli1->tree));
                correct = False;
                goto fail;
@@ -2413,13 +2409,13 @@ static BOOL run_deletetest(int dummy)
        
        /* This should fail - only allowed on NT opens with DELETE access. */
        
-       if (cli_nt_delete_on_close(cli1->tree, fnum1, True)) {
+       if (NT_STATUS_IS_OK(cli_nt_delete_on_close(cli1->tree, fnum1, True))) {
                printf("[6] setting delete_on_close on file with no delete access succeeded - should fail !\n");
                correct = False;
                goto fail;
        }
 
-       if (!cli_close(cli1->tree, fnum1)) {
+       if (NT_STATUS_IS_ERR(cli_close(cli1->tree, fnum1))) {
                printf("[6] close - 2 failed (%s)\n", cli_errstr(cli1->tree));
                correct = False;
                goto fail;
@@ -2443,19 +2439,19 @@ static BOOL run_deletetest(int dummy)
                goto fail;
        }
 
-       if (!cli_nt_delete_on_close(cli1->tree, fnum1, True)) {
+       if (NT_STATUS_IS_ERR(cli_nt_delete_on_close(cli1->tree, fnum1, True))) {
                printf("[7] setting delete_on_close on file failed !\n");
                correct = False;
                goto fail;
        }
        
-       if (!cli_nt_delete_on_close(cli1->tree, fnum1, False)) {
+       if (NT_STATUS_IS_ERR(cli_nt_delete_on_close(cli1->tree, fnum1, False))) {
                printf("[7] unsetting delete_on_close on file failed !\n");
                correct = False;
                goto fail;
        }
 
-       if (!cli_close(cli1->tree, fnum1)) {
+       if (NT_STATUS_IS_ERR(cli_close(cli1->tree, fnum1))) {
                printf("[7] close - 2 failed (%s)\n", cli_errstr(cli1->tree));
                correct = False;
                goto fail;
@@ -2470,7 +2466,7 @@ static BOOL run_deletetest(int dummy)
                goto fail;
        }
 
-       if (!cli_close(cli1->tree, fnum1)) {
+       if (NT_STATUS_IS_ERR(cli_close(cli1->tree, fnum1))) {
                printf("[7] close - 2 failed (%s)\n", cli_errstr(cli1->tree));
                correct = False;
                goto fail;
@@ -2508,19 +2504,19 @@ static BOOL run_deletetest(int dummy)
                goto fail;
        }
 
-       if (!cli_nt_delete_on_close(cli1->tree, fnum1, True)) {
+       if (NT_STATUS_IS_ERR(cli_nt_delete_on_close(cli1->tree, fnum1, True))) {
                printf("[8] setting delete_on_close on file failed !\n");
                correct = False;
                goto fail;
        }
        
-       if (!cli_close(cli1->tree, fnum1)) {
+       if (NT_STATUS_IS_ERR(cli_close(cli1->tree, fnum1))) {
                printf("[8] close - 1 failed (%s)\n", cli_errstr(cli1->tree));
                correct = False;
                goto fail;
        }
 
-       if (!cli_close(cli2->tree, fnum2)) {
+       if (NT_STATUS_IS_ERR(cli_close(cli2->tree, fnum2))) {
                printf("[8] close - 2 failed (%s)\n", cli_errstr(cli2->tree));
                correct = False;
                goto fail;
@@ -2556,7 +2552,7 @@ static BOOL run_deletetest(int dummy)
        }
 
        /* This should delete the file. */
-       if (!cli_close(cli1->tree, fnum1)) {
+       if (NT_STATUS_IS_ERR(cli_close(cli1->tree, fnum1))) {
                printf("[10] close failed (%s)\n", cli_errstr(cli1->tree));
                correct = False;
                goto fail;
@@ -2707,14 +2703,14 @@ static BOOL run_rename(int dummy)
                return False;
        }
 
-       if (!cli_rename(cli1->tree, fname, fname1)) {
+       if (NT_STATUS_IS_ERR(cli_rename(cli1->tree, fname, fname1))) {
                printf("First rename failed (this is correct) - %s\n", cli_errstr(cli1->tree));
        } else {
                printf("First rename succeeded - this should have failed !\n");
                correct = False;
        }
 
-       if (!cli_close(cli1->tree, fnum1)) {
+       if (NT_STATUS_IS_ERR(cli_close(cli1->tree, fnum1))) {
                printf("close - 1 failed (%s)\n", cli_errstr(cli1->tree));
                return False;
        }
@@ -2733,14 +2729,14 @@ static BOOL run_rename(int dummy)
                return False;
        }
 
-       if (!cli_rename(cli1->tree, fname, fname1)) {
+       if (NT_STATUS_IS_ERR(cli_rename(cli1->tree, fname, fname1))) {
                printf("Second rename failed - this should have succeeded - %s\n", cli_errstr(cli1->tree));
                correct = False;
        } else {
                printf("Second rename succeeded\n");
        }
 
-       if (!cli_close(cli1->tree, fnum1)) {
+       if (NT_STATUS_IS_ERR(cli_close(cli1->tree, fnum1))) {
                printf("close - 2 failed (%s)\n", cli_errstr(cli1->tree));
                return False;
        }
@@ -2780,14 +2776,14 @@ static BOOL run_rename(int dummy)
   }
 #endif
 
-       if (!cli_rename(cli1->tree, fname, fname1)) {
+       if (NT_STATUS_IS_ERR(cli_rename(cli1->tree, fname, fname1))) {
                printf("Third rename failed - this should have succeeded - %s\n", cli_errstr(cli1->tree));
                correct = False;
        } else {
                printf("Third rename succeeded\n");
        }
 
-       if (!cli_close(cli1->tree, fnum1)) {
+       if (NT_STATUS_IS_ERR(cli_close(cli1->tree, fnum1))) {
                printf("close - 3 failed (%s)\n", cli_errstr(cli1->tree));
                return False;
        }
@@ -2861,12 +2857,12 @@ static BOOL run_pipe_number(int dummy)
                return False;
        }
 
-       if (!cli_close(cli1->tree, fnum1)) {
+       if (NT_STATUS_IS_ERR(cli_close(cli1->tree, fnum1))) {
                printf("close2 failed (%s)\n", cli_errstr(cli1->tree));
                return False;
        }
        
-       if (!cli_setatr(cli1->tree, fname, FILE_ATTRIBUTE_READONLY, 0)) {
+       if (NT_STATUS_IS_ERR(cli_setatr(cli1->tree, fname, FILE_ATTRIBUTE_READONLY, 0))) {
                printf("cli_setatr failed (%s)\n", cli_errstr(cli1->tree));
                CHECK_MAX_FAILURES(error_test1);
                return False;
@@ -2909,7 +2905,7 @@ error_test1:
                printf("correct error code ERRDOS/ERRbadshare returned\n");
        }
        
-       if (!cli_close(cli1->tree, fnum1)) {
+       if (NT_STATUS_IS_ERR(cli_close(cli1->tree, fnum1))) {
                printf("close2 failed (%s)\n", cli_errstr(cli1->tree));
                return False;
        }
@@ -2935,13 +2931,13 @@ error_test1:
                correct = False;
        }
 
-       if (!cli_close(cli1->tree, fnum1)) {
+       if (NT_STATUS_IS_ERR(cli_close(cli1->tree, fnum1))) {
                printf("(3) close1 failed (%s)\n", cli_errstr(cli1->tree));
                return False;
        }
        
        /* Ensure size == 20. */
-       if (!cli_getatr(cli1->tree, fname, NULL, &fsize, NULL)) {
+       if (NT_STATUS_IS_ERR(cli_getatr(cli1->tree, fname, NULL, &fsize, NULL))) {
                printf("(3) getatr failed (%s)\n", cli_errstr(cli1->tree));
                CHECK_MAX_FAILURES(error_test3);
                return False;
@@ -2962,13 +2958,13 @@ error_test1:
                return False;
        }
        
-       if (!cli_close(cli1->tree, fnum1)) {
+       if (NT_STATUS_IS_ERR(cli_close(cli1->tree, fnum1))) {
                printf("close2 failed (%s)\n", cli_errstr(cli1->tree));
                return False;
        }
 
        /* Ensure size == 0. */
-       if (!cli_getatr(cli1->tree, fname, NULL, &fsize, NULL)) {
+       if (NT_STATUS_IS_ERR(cli_getatr(cli1->tree, fname, NULL, &fsize, NULL))) {
                printf("(3) getatr failed (%s)\n", cli_errstr(cli1->tree));
                CHECK_MAX_FAILURES(error_test3);
                return False;
@@ -2992,10 +2988,10 @@ error_test3:
                return False;
        }
        printf("ctemp gave path %s\n", tmp_path);
-       if (!cli_close(cli1->tree, fnum1)) {
+       if (NT_STATUS_IS_ERR(cli_close(cli1->tree, fnum1))) {
                printf("close of temp failed (%s)\n", cli_errstr(cli1->tree));
        }
-       if (!cli_unlink(cli1->tree, tmp_path)) {
+       if (NT_STATUS_IS_ERR(cli_unlink(cli1->tree, tmp_path))) {
                printf("unlink of temp failed (%s)\n", cli_errstr(cli1->tree));
        }
 error_test4:   
@@ -3027,11 +3023,11 @@ error_test4:
                return False;
        }
 
-       if (!cli_close(cli1->tree, fnum1)) {
+       if (NT_STATUS_IS_ERR(cli_close(cli1->tree, fnum1))) {
                printf("test 1 close 1 of %s failed (%s)\n", fname, cli_errstr(cli1->tree));
                return False;
        }
-       if (!cli_close(cli2->tree, fnum2)) {
+       if (NT_STATUS_IS_ERR(cli_close(cli2->tree, fnum2))) {
                printf("test 1 close 2 of %s failed (%s)\n", fname, cli_errstr(cli2->tree));
                return False;
        }
@@ -3060,11 +3056,11 @@ error_test10:
                return False;
        }
 
-       if (!cli_close(cli1->tree, fnum1)) {
+       if (NT_STATUS_IS_ERR(cli_close(cli1->tree, fnum1))) {
                printf("test 1 close 1 of %s failed (%s)\n", fname, cli_errstr(cli1->tree));
                return False;
        }
-       if (!cli_close(cli2->tree, fnum2)) {
+       if (NT_STATUS_IS_ERR(cli_close(cli2->tree, fnum2))) {
                printf("test 1 close 2 of %s failed (%s)\n", fname, cli_errstr(cli1->tree));
                return False;
        }
@@ -3093,11 +3089,11 @@ error_test20:
                return False;
        }
 
-       if (!cli_close(cli1->tree, fnum1)) {
+       if (NT_STATUS_IS_ERR(cli_close(cli1->tree, fnum1))) {
                printf("test 3 close 1 of %s failed (%s)\n", fname, cli_errstr(cli1->tree));
                return False;
        }
-       if (!cli_close(cli2->tree, fnum2)) {
+       if (NT_STATUS_IS_ERR(cli_close(cli2->tree, fnum2))) {
                printf("test 3 close 2 of %s failed (%s)\n", fname, cli_errstr(cli2->tree));
                return False;
        }
@@ -3128,7 +3124,7 @@ error_test30:
 
        printf("test 4 open 2 of %s gave %s (correct error should be %s)\n", fname, cli_errstr(cli2->tree), "sharing violation");
 
-       if (!cli_close(cli1->tree, fnum1)) {
+       if (NT_STATUS_IS_ERR(cli_close(cli1->tree, fnum1))) {
                printf("test 4 close 1 of %s failed (%s)\n", fname, cli_errstr(cli1->tree));
                return False;
        }
@@ -3157,12 +3153,12 @@ error_test40:
                return False;
        }
 
-       if (!cli_close(cli1->tree, fnum1)) {
+       if (NT_STATUS_IS_ERR(cli_close(cli1->tree, fnum1))) {
                printf("test 5 close 1 of %s failed (%s)\n", fname, cli_errstr(cli1->tree));
                return False;
        }
 
-       if (!cli_close(cli2->tree, fnum2)) {
+       if (NT_STATUS_IS_ERR(cli_close(cli2->tree, fnum2))) {
                printf("test 5 close 2 of %s failed (%s)\n", fname, cli_errstr(cli2->tree));
                return False;
        }
@@ -3191,12 +3187,12 @@ error_test50:
                return False;
        }
 
-       if (!cli_close(cli1->tree, fnum1)) {
+       if (NT_STATUS_IS_ERR(cli_close(cli1->tree, fnum1))) {
                printf("test 6 close 1 of %s failed (%s)\n", fname, cli_errstr(cli1->tree));
                return False;
        }
 
-       if (!cli_close(cli2->tree, fnum2)) {
+       if (NT_STATUS_IS_ERR(cli_close(cli2->tree, fnum2))) {
                printf("test 6 close 2 of %s failed (%s)\n", fname, cli_errstr(cli2->tree));
                return False;
        }
@@ -3227,7 +3223,7 @@ error_test60:
 
        printf("test 7 open 2 of %s gave %s (correct error should be %s)\n", fname, cli_errstr(cli2->tree), "sharing violation");
 
-       if (!cli_close(cli1->tree, fnum1)) {
+       if (NT_STATUS_IS_ERR(cli_close(cli1->tree, fnum1))) {
                printf("test 7 close 1 of %s failed (%s)\n", fname, cli_errstr(cli1->tree));
                return False;
        }
@@ -3330,7 +3326,7 @@ static BOOL run_openattrtest(int dummy)
                        return False;
                }
 
-               if (!cli_close(cli1->tree, fnum1)) {
+               if (NT_STATUS_IS_ERR(cli_close(cli1->tree, fnum1))) {
                        printf("close %d (1) of %s failed (%s)\n", i, fname, cli_errstr(cli1->tree));
                        return False;
                }
@@ -3367,12 +3363,12 @@ static BOOL run_openattrtest(int dummy)
                                continue;
                        }
 
-                       if (!cli_close(cli1->tree, fnum1)) {
+                       if (NT_STATUS_IS_ERR(cli_close(cli1->tree, fnum1))) {
                                printf("close %d (2) of %s failed (%s)\n", j, fname, cli_errstr(cli1->tree));
                                return False;
                        }
 
-                       if (!cli_getatr(cli1->tree, fname, &attr, NULL, NULL)) {
+                       if (NT_STATUS_IS_ERR(cli_getatr(cli1->tree, fname, &attr, NULL, NULL))) {
                                printf("getatr(2) failed (%s)\n", cli_errstr(cli1->tree));
                                return False;
                        }
@@ -3485,10 +3481,10 @@ static void del_fn(file_info *finfo, const char *mask, void *state)
                return;
 
        if (finfo->mode & FILE_ATTRIBUTE_DIRECTORY) {
-               if (!cli_rmdir(pcli->tree, fname))
+               if (NT_STATUS_IS_ERR(cli_rmdir(pcli->tree, fname)))
                        printf("del_fn: failed to rmdir %s, error=%s\n", fname, cli_errstr(pcli->tree) );
        } else {
-               if (!cli_unlink(pcli->tree, fname))
+               if (NT_STATUS_IS_ERR(cli_unlink(pcli->tree, fname)))
                        printf("del_fn: failed to unlink %s, error=%s\n", fname, cli_errstr(pcli->tree) );
        }
        free(fname);
@@ -3572,12 +3568,12 @@ BOOL torture_chkpath_test(int dummy)
        cli_unlink(cli->tree, "\\chkpath.dir\\*");
        cli_rmdir(cli->tree, "\\chkpath.dir");
 
-       if (!cli_mkdir(cli->tree, "\\chkpath.dir")) {
+       if (NT_STATUS_IS_ERR(cli_mkdir(cli->tree, "\\chkpath.dir"))) {
                printf("mkdir1 failed : %s\n", cli_errstr(cli->tree));
                return False;
        }
 
-       if (!cli_mkdir(cli->tree, "\\chkpath.dir\\dir2")) {
+       if (NT_STATUS_IS_ERR(cli_mkdir(cli->tree, "\\chkpath.dir\\dir2"))) {
                printf("mkdir2 failed : %s\n", cli_errstr(cli->tree));
                return False;
        }
@@ -3589,17 +3585,17 @@ BOOL torture_chkpath_test(int dummy)
        }
        cli_close(cli->tree, fnum);
 
-       if (!cli_chkpath(cli->tree, "\\chkpath.dir")) {
+       if (NT_STATUS_IS_ERR(cli_chkpath(cli->tree, "\\chkpath.dir"))) {
                printf("chkpath1 failed: %s\n", cli_errstr(cli->tree));
                ret = False;
        }
 
-       if (!cli_chkpath(cli->tree, "\\chkpath.dir\\dir2")) {
+       if (NT_STATUS_IS_ERR(cli_chkpath(cli->tree, "\\chkpath.dir\\dir2"))) {
                printf("chkpath2 failed: %s\n", cli_errstr(cli->tree));
                ret = False;
        }
 
-       if (!cli_chkpath(cli->tree, "\\chkpath.dir\\foo.txt")) {
+       if (NT_STATUS_IS_ERR(cli_chkpath(cli->tree, "\\chkpath.dir\\foo.txt"))) {
                ret = check_error(__LINE__, cli, ERRDOS, ERRbadpath, 
                                  NT_STATUS_NOT_A_DIRECTORY);
        } else {
@@ -3607,7 +3603,7 @@ BOOL torture_chkpath_test(int dummy)
                ret = False;
        }
 
-       if (!cli_chkpath(cli->tree, "\\chkpath.dir\\bar.txt")) {
+       if (NT_STATUS_IS_ERR(cli_chkpath(cli->tree, "\\chkpath.dir\\bar.txt"))) {
                ret = check_error(__LINE__, cli, ERRDOS, ERRbadfile, 
                                  NT_STATUS_OBJECT_NAME_NOT_FOUND);
        } else {
@@ -3615,7 +3611,7 @@ BOOL torture_chkpath_test(int dummy)
                ret = False;
        }
 
-       if (!cli_chkpath(cli->tree, "\\chkpath.dir\\dirxx\\bar.txt")) {
+       if (NT_STATUS_IS_ERR(cli_chkpath(cli->tree, "\\chkpath.dir\\dirxx\\bar.txt"))) {
                ret = check_error(__LINE__, cli, ERRDOS, ERRbadpath, 
                                  NT_STATUS_OBJECT_PATH_NOT_FOUND);
        } else {
@@ -3653,7 +3649,7 @@ static BOOL run_dirtest1(int dummy)
                fprintf(stderr,"Failed to deltree %s, error=%s\n", "\\LISTDIR", cli_errstr(cli->tree));
                return False;
        }
-       if (!cli_mkdir(cli->tree, "\\LISTDIR")) {
+       if (NT_STATUS_IS_ERR(cli_mkdir(cli->tree, "\\LISTDIR"))) {
                fprintf(stderr,"Failed to mkdir %s, error=%s\n", "\\LISTDIR", cli_errstr(cli->tree));
                return False;
        }
@@ -3676,7 +3672,7 @@ static BOOL run_dirtest1(int dummy)
        for (i=0;i<torture_entries;i++) {
                char *fname;
                asprintf(&fname, "\\LISTDIR\\d%d", i);
-               if (!cli_mkdir(cli->tree, fname)) {
+               if (NT_STATUS_IS_ERR(cli_mkdir(cli->tree, fname))) {
                        fprintf(stderr,"Failed to open %s, error=%s\n", fname, cli_errstr(cli->tree));
                        return False;
                }
index 9d23f10121d11733dfceca74375b48388fec58e2..ec37edab8247675d543e7f31d5ecdbf7aa37643e 100644 (file)
@@ -133,7 +133,7 @@ BOOL torture_casetable(int dummy)
        memset(equiv, 0, sizeof(equiv));
 
        cli_deltree(cli->tree, "\\utable");
-       if (!cli_mkdir(cli->tree, "\\utable")) {
+       if (NT_STATUS_IS_ERR(cli_mkdir(cli->tree, "\\utable"))) {
                printf("Failed to create utable directory!\n");
                return False;
        }
@@ -163,8 +163,8 @@ BOOL torture_casetable(int dummy)
 
                size = 0;
 
-               if (!cli_qfileinfo(cli->tree, fnum, NULL, &size, 
-                                  NULL, NULL, NULL, NULL, NULL)) continue;
+               if (NT_STATUS_IS_ERR(cli_qfileinfo(cli->tree, fnum, NULL, &size, 
+                                                  NULL, NULL, NULL, NULL, NULL))) continue;
 
                if (size > 0) {
                        /* found a character equivalence! */