summaryrefslogtreecommitdiff
path: root/source3
diff options
context:
space:
mode:
Diffstat (limited to 'source3')
-rw-r--r--source3/libsmb/cliconnect.c12
-rw-r--r--source3/libsmb/clierror.c2
-rw-r--r--source3/libsmb/clifile.c34
-rw-r--r--source3/libsmb/clilist.c4
-rw-r--r--source3/libsmb/clireadwrite.c4
-rw-r--r--source3/libsmb/clitrans.c4
-rw-r--r--source3/libsmb/smberr.c59
7 files changed, 55 insertions, 64 deletions
diff --git a/source3/libsmb/cliconnect.c b/source3/libsmb/cliconnect.c
index 8230edbd63..14faf6e8fe 100644
--- a/source3/libsmb/cliconnect.c
+++ b/source3/libsmb/cliconnect.c
@@ -188,7 +188,7 @@ BOOL cli_session_setup(struct cli_state *cli,
show_msg(cli->inbuf);
- if (CVAL(cli->inbuf,smb_rcls) != 0) {
+ if (cli_is_error(cli)) {
return False;
}
@@ -228,7 +228,7 @@ BOOL cli_ulogoff(struct cli_state *cli)
if (!cli_receive_smb(cli))
return False;
- return CVAL(cli->inbuf,smb_rcls) == 0;
+ return !cli_is_error(cli);
}
/****************************************************************************
@@ -292,13 +292,11 @@ BOOL cli_send_tconX(struct cli_state *cli,
cli_setup_bcc(cli, p);
- SCVAL(cli->inbuf,smb_rcls, 1);
-
cli_send_smb(cli);
if (!cli_receive_smb(cli))
return False;
- if (CVAL(cli->inbuf,smb_rcls) != 0) {
+ if (cli_is_error(cli)) {
return False;
}
@@ -339,7 +337,7 @@ BOOL cli_tdis(struct cli_state *cli)
if (!cli_receive_smb(cli))
return False;
- return CVAL(cli->inbuf,smb_rcls) == 0;
+ return !cli_is_error(cli);
}
@@ -412,7 +410,7 @@ BOOL cli_negprot(struct cli_state *cli)
show_msg(cli->inbuf);
- if (CVAL(cli->inbuf,smb_rcls) != 0 ||
+ if (cli_is_error(cli) ||
((int)SVAL(cli->inbuf,smb_vwv0) >= numprots)) {
return(False);
}
diff --git a/source3/libsmb/clierror.c b/source3/libsmb/clierror.c
index 22c5dbaf77..5bc3992944 100644
--- a/source3/libsmb/clierror.c
+++ b/source3/libsmb/clierror.c
@@ -58,7 +58,7 @@ static struct
****************************************************************************/
static char *cli_smb_errstr(struct cli_state *cli)
{
- return smb_errstr(cli->inbuf);
+ return smb_dos_errstr(cli->inbuf);
}
/***************************************************************************
diff --git a/source3/libsmb/clifile.c b/source3/libsmb/clifile.c
index c325d882c9..c6cf73bcf3 100644
--- a/source3/libsmb/clifile.c
+++ b/source3/libsmb/clifile.c
@@ -56,7 +56,7 @@ BOOL cli_rename(struct cli_state *cli, char *fname_src, char *fname_dst)
return False;
}
- if (CVAL(cli->inbuf,smb_rcls) != 0) {
+ if (cli_is_error(cli)) {
return False;
}
@@ -91,7 +91,7 @@ BOOL cli_unlink(struct cli_state *cli, char *fname)
return False;
}
- if (CVAL(cli->inbuf,smb_rcls) != 0) {
+ if (cli_is_error(cli)) {
return False;
}
@@ -125,7 +125,7 @@ BOOL cli_mkdir(struct cli_state *cli, char *dname)
return False;
}
- if (CVAL(cli->inbuf,smb_rcls) != 0) {
+ if (cli_is_error(cli)) {
return False;
}
@@ -159,7 +159,7 @@ BOOL cli_rmdir(struct cli_state *cli, char *dname)
return False;
}
- if (CVAL(cli->inbuf,smb_rcls) != 0) {
+ if (cli_is_error(cli)) {
return False;
}
@@ -257,7 +257,7 @@ int cli_nt_create_full(struct cli_state *cli, char *fname, uint32 DesiredAccess,
return -1;
}
- if (CVAL(cli->inbuf,smb_rcls) != 0) {
+ if (cli_is_error(cli)) {
return -1;
}
@@ -345,7 +345,7 @@ int cli_open(struct cli_state *cli, char *fname, int flags, int share_mode)
return -1;
}
- if (CVAL(cli->inbuf,smb_rcls) != 0) {
+ if (cli_is_error(cli)) {
return -1;
}
@@ -377,11 +377,7 @@ BOOL cli_close(struct cli_state *cli, int fnum)
return False;
}
- if (CVAL(cli->inbuf,smb_rcls) != 0) {
- return False;
- }
-
- return True;
+ return !cli_is_error(cli);
}
@@ -430,7 +426,7 @@ BOOL cli_lock(struct cli_state *cli, int fnum,
cli->timeout = saved_timeout;
- if (CVAL(cli->inbuf,smb_rcls) != 0) {
+ if (cli_is_error(cli)) {
return False;
}
@@ -471,7 +467,7 @@ BOOL cli_unlock(struct cli_state *cli, int fnum, uint32 offset, uint32 len)
return False;
}
- if (CVAL(cli->inbuf,smb_rcls) != 0) {
+ if (cli_is_error(cli)) {
return False;
}
@@ -530,7 +526,7 @@ BOOL cli_lock64(struct cli_state *cli, int fnum,
cli->timeout = saved_timeout;
- if (CVAL(cli->inbuf,smb_rcls) != 0) {
+ if (cli_is_error(cli)) {
return False;
}
@@ -575,7 +571,7 @@ BOOL cli_unlock64(struct cli_state *cli, int fnum, SMB_BIG_UINT offset, SMB_BIG_
return False;
}
- if (CVAL(cli->inbuf,smb_rcls) != 0) {
+ if (cli_is_error(cli)) {
return False;
}
@@ -609,7 +605,7 @@ BOOL cli_getattrE(struct cli_state *cli, int fd,
return False;
}
- if (CVAL(cli->inbuf,smb_rcls) != 0) {
+ if (cli_is_error(cli)) {
return False;
}
@@ -665,7 +661,7 @@ BOOL cli_getatr(struct cli_state *cli, char *fname,
return False;
}
- if (CVAL(cli->inbuf,smb_rcls) != 0) {
+ if (cli_is_error(cli)) {
return False;
}
@@ -717,7 +713,7 @@ BOOL cli_setatr(struct cli_state *cli, char *fname, uint16 attr, time_t t)
return False;
}
- if (CVAL(cli->inbuf,smb_rcls) != 0) {
+ if (cli_is_error(cli)) {
return False;
}
@@ -813,7 +809,7 @@ int cli_ctemp(struct cli_state *cli, char *path, char **tmp_path)
return -1;
}
- if (CVAL(cli->inbuf,smb_rcls) != 0) {
+ if (cli_is_error(cli)) {
return -1;
}
diff --git a/source3/libsmb/clilist.c b/source3/libsmb/clilist.c
index 562e1710d3..a99bc91bfb 100644
--- a/source3/libsmb/clilist.c
+++ b/source3/libsmb/clilist.c
@@ -408,7 +408,7 @@ int cli_list_old(struct cli_state *cli,const char *Mask,uint16 attribute,
num_received += received;
- if (CVAL(cli->inbuf,smb_rcls) != 0) break;
+ if (cli_is_error(cli)) break;
}
if (!first) {
@@ -436,7 +436,7 @@ int cli_list_old(struct cli_state *cli,const char *Mask,uint16 attribute,
cli_setup_bcc(cli, p);
cli_send_smb(cli);
if (!cli_receive_smb(cli)) {
- DEBUG(0,("Error closing search: %s\n",smb_errstr(cli->inbuf)));
+ DEBUG(0,("Error closing search: %s\n",cli_errstr(cli)));
}
}
diff --git a/source3/libsmb/clireadwrite.c b/source3/libsmb/clireadwrite.c
index abbb8cd110..f141a208bf 100644
--- a/source3/libsmb/clireadwrite.c
+++ b/source3/libsmb/clireadwrite.c
@@ -297,7 +297,7 @@ ssize_t cli_write(struct cli_state *cli,
received++;
- if (CVAL(cli->inbuf,smb_rcls) != 0)
+ if (cli_is_error(cli))
break;
bwritten += SVAL(cli->inbuf, smb_vwv2);
@@ -349,7 +349,7 @@ ssize_t cli_smbwrite(struct cli_state *cli,
if (!cli_receive_smb(cli))
return -1;
- if (CVAL(cli->inbuf,smb_rcls) != 0)
+ if (cli_is_error(cli))
return -1;
size = SVAL(cli->inbuf,smb_vwv0);
diff --git a/source3/libsmb/clitrans.c b/source3/libsmb/clitrans.c
index bcf1bf5f74..8da1cc665f 100644
--- a/source3/libsmb/clitrans.c
+++ b/source3/libsmb/clitrans.c
@@ -89,7 +89,7 @@ BOOL cli_send_trans(struct cli_state *cli, int trans,
if (this_ldata < ldata || this_lparam < lparam) {
/* receive interim response */
if (!cli_receive_smb(cli) ||
- CVAL(cli->inbuf,smb_rcls) != 0) {
+ cli_is_error(cli)) {
return(False);
}
@@ -307,7 +307,7 @@ BOOL cli_send_nt_trans(struct cli_state *cli,
if (this_ldata < ldata || this_lparam < lparam) {
/* receive interim response */
if (!cli_receive_smb(cli) ||
- CVAL(cli->inbuf,smb_rcls) != 0) {
+ cli_is_error(cli)) {
return(False);
}
diff --git a/source3/libsmb/smberr.c b/source3/libsmb/smberr.c
index 00966aed43..c881b54203 100644
--- a/source3/libsmb/smberr.c
+++ b/source3/libsmb/smberr.c
@@ -148,39 +148,36 @@ struct
/****************************************************************************
return a SMB error string from a SMB buffer
****************************************************************************/
-char *smb_errstr(char *inbuf)
+char *smb_dos_errstr(char *inbuf)
{
- static pstring ret;
- int class = CVAL(inbuf,smb_rcls);
- int num = SVAL(inbuf,smb_err);
- int i,j;
-
- for (i=0;err_classes[i].class;i++)
- if (err_classes[i].code == class)
- {
- if (err_classes[i].err_msgs)
- {
- err_code_struct *err = err_classes[i].err_msgs;
- for (j=0;err[j].name;j++)
- if (num == err[j].code)
- {
- if (DEBUGLEVEL > 0)
- slprintf(ret, sizeof(ret) - 1, "%s - %s (%s)",
- err_classes[i].class,
- err[j].name,err[j].message);
- else
- slprintf(ret, sizeof(ret) - 1, "%s - %s",
- err_classes[i].class,err[j].name);
- return ret;
+ static pstring ret;
+ int class = CVAL(inbuf,smb_rcls);
+ int num = SVAL(inbuf,smb_err);
+ int i,j;
+
+ for (i=0;err_classes[i].class;i++)
+ if (err_classes[i].code == class) {
+ if (err_classes[i].err_msgs) {
+ err_code_struct *err = err_classes[i].err_msgs;
+ for (j=0;err[j].name;j++)
+ if (num == err[j].code) {
+ if (DEBUGLEVEL > 0)
+ slprintf(ret, sizeof(ret) - 1, "%s - %s (%s)",
+ err_classes[i].class,
+ err[j].name,err[j].message);
+ else
+ slprintf(ret, sizeof(ret) - 1, "%s - %s",
+ err_classes[i].class,err[j].name);
+ return ret;
+ }
+ }
+
+ slprintf(ret, sizeof(ret) - 1, "%s - %d",err_classes[i].class,num);
+ return ret;
}
- }
-
- slprintf(ret, sizeof(ret) - 1, "%s - %d",err_classes[i].class,num);
- return ret;
- }
-
- slprintf(ret, sizeof(ret) - 1, "Error: Unknown error (%d,%d)",class,num);
- return(ret);
+
+ slprintf(ret, sizeof(ret) - 1, "Error: Unknown error (%d,%d)",class,num);
+ return(ret);
}