mirror of
https://github.com/samba-team/samba.git
synced 2025-10-31 12:23:52 +03:00
Convert libcli routines to return NTSTATUS instead of BOOL. Again, the
only users are smbclient and smbtorture.
This commit is contained in:
@@ -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;
|
||||
|
||||
@@ -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 */
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
@@ -23,25 +23,24 @@
|
||||
/****************************************************************************
|
||||
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;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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 ||
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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));
|
||||
}
|
||||
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -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! */
|
||||
|
||||
Reference in New Issue
Block a user