summaryrefslogtreecommitdiff
path: root/source4/libcli
diff options
context:
space:
mode:
authorTim Potter <tpot@samba.org>2004-02-10 11:33:35 +0000
committerTim Potter <tpot@samba.org>2004-02-10 11:33:35 +0000
commit9a6388179b9c4e13238ed91aebaca9b15e02408f (patch)
tree227d5e57dd0948abac7564a0d07f8fab8e6ae659 /source4/libcli
parente159cc7e05a46fcc652873b382b848f5d524d8b6 (diff)
downloadsamba-9a6388179b9c4e13238ed91aebaca9b15e02408f.tar.gz
samba-9a6388179b9c4e13238ed91aebaca9b15e02408f.tar.bz2
samba-9a6388179b9c4e13238ed91aebaca9b15e02408f.zip
Convert libcli routines to return NTSTATUS instead of BOOL. Again, the
only users are smbclient and smbtorture. (This used to be commit 54cb508c78e5c1faa3ade46b46b165983c880d10)
Diffstat (limited to 'source4/libcli')
-rw-r--r--source4/libcli/cliconnect.c39
-rw-r--r--source4/libcli/clideltree.c10
-rw-r--r--source4/libcli/clifile.c120
-rw-r--r--source4/libcli/clitrans2.c56
4 files changed, 113 insertions, 112 deletions
diff --git a/source4/libcli/cliconnect.c b/source4/libcli/cliconnect.c
index 4fdffa6287..e2d9665792 100644
--- a/source4/libcli/cliconnect.c
+++ b/source4/libcli/cliconnect.c
@@ -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);
}
/****************************************************************************
diff --git a/source4/libcli/clideltree.c b/source4/libcli/clideltree.c
index d28950f136..2bbfd9bd22 100644
--- a/source4/libcli/clideltree.c
+++ b/source4/libcli/clideltree.c
@@ -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;
diff --git a/source4/libcli/clifile.c b/source4/libcli/clifile.c
index 6606455e49..5432834522 100644
--- a/source4/libcli/clifile.c
+++ b/source4/libcli/clifile.c
@@ -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;
}
-
diff --git a/source4/libcli/clitrans2.c b/source4/libcli/clitrans2.c
index c8f7db5a9d..777150a257 100644
--- a/source4/libcli/clitrans2.c
+++ b/source4/libcli/clitrans2.c
@@ -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;
}