summaryrefslogtreecommitdiff
path: root/source/libsmb/clitrans.c
diff options
context:
space:
mode:
authorTim Potter <tpot@samba.org>2001-08-10 06:00:33 +0000
committerTim Potter <tpot@samba.org>2001-08-10 06:00:33 +0000
commit6dbdb0d813f3c7ab20b38baa1223b0b479aadec9 (patch)
treeacac8a9b4aadfc20e22bb0ab342d160d5d2856d1 /source/libsmb/clitrans.c
parent00703d306f14a5977df75cb04ee34ae8628ed40e (diff)
downloadsamba-6dbdb0d813f3c7ab20b38baa1223b0b479aadec9.tar.gz
A rewrite of the error handling in the libsmb client code. I've separated
out the error handling into a bunch of separate functions rather than all being handled in one big function. Fetch error codes from the last received packet: void cli_dos_error(struct cli_state *cli, uint8 *eclass, uint32 *num); uint32 cli_nt_error(struct cli_state *); Convert errors to UNIX errno values: int cli_errno_from_dos(uint8 eclass, uint32 num); int cli_errno_from_nt(uint32 status); int cli_errno(struct cli_state *cli); Detect different kinds of errors: BOOL cli_is_dos_error(struct cli_state *cli); BOOL cli_is_nt_error(struct cli_state *cli); BOOL cli_is_error(struct cli_state *cli); This also means we now support CAP_STATUS32 as we can decode and understand NT errors instead of just DOS errors. Yay! Ported a whole bunch of files in libsmb to use this new API instead of the just the DOS error.
Diffstat (limited to 'source/libsmb/clitrans.c')
-rw-r--r--source/libsmb/clitrans.c24
1 files changed, 15 insertions, 9 deletions
diff --git a/source/libsmb/clitrans.c b/source/libsmb/clitrans.c
index 68583c41994..ac50c7bf6d9 100644
--- a/source/libsmb/clitrans.c
+++ b/source/libsmb/clitrans.c
@@ -169,12 +169,14 @@ BOOL cli_receive_trans(struct cli_state *cli,int trans,
* be treated as such.
*/
- if (cli_error(cli, &eclass, &ecode, NULL))
+ if (cli_is_dos_error(cli))
{
- if(cli->nt_pipe_fnum == 0)
+ cli_dos_error(cli, &eclass, &ecode);
+
+ if(cli->nt_pipe_fnum == 0)
return(False);
- if(!(eclass == ERRDOS && ecode == ERRmoredata)) {
+ if(!(eclass == ERRDOS && ecode == ERRmoredata)) {
if (eclass != 0 && (ecode != (0x80000000 | STATUS_BUFFER_OVERFLOW)))
return(False);
}
@@ -228,9 +230,10 @@ BOOL cli_receive_trans(struct cli_state *cli,int trans,
CVAL(cli->inbuf,smb_com)));
return(False);
}
- if (cli_error(cli, &eclass, &ecode, NULL))
- {
- if(cli->nt_pipe_fnum == 0 || !(eclass == ERRDOS && ecode == ERRmoredata))
+ if (cli_is_dos_error(cli)) {
+ cli_dos_error(cli, &eclass, &ecode);
+ if(cli->nt_pipe_fnum == 0 ||
+ !(eclass == ERRDOS && ecode == ERRmoredata))
return(False);
}
}
@@ -375,7 +378,8 @@ BOOL cli_receive_nt_trans(struct cli_state *cli,
* to a trans call. This is not an error and should not
* be treated as such.
*/
- if (cli_error(cli, &eclass, &ecode, NULL)) {
+ if (cli_is_dos_error(cli)) {
+ cli_dos_error(cli, &eclass, &ecode);
if (cli->nt_pipe_fnum == 0 || !(eclass == ERRDOS && ecode == ERRmoredata))
return(False);
}
@@ -427,8 +431,10 @@ BOOL cli_receive_nt_trans(struct cli_state *cli,
CVAL(cli->inbuf,smb_com)));
return(False);
}
- if (cli_error(cli, &eclass, &ecode, NULL)) {
- if(cli->nt_pipe_fnum == 0 || !(eclass == ERRDOS && ecode == ERRmoredata))
+ if (cli_is_dos_error(cli)) {
+ cli_dos_error(cli, &eclass, &ecode);
+ if(cli->nt_pipe_fnum == 0 ||
+ !(eclass == ERRDOS && ecode == ERRmoredata))
return(False);
}
}