summaryrefslogtreecommitdiff
path: root/source3/libsmb
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>2007-11-03 15:12:42 -0700
committerJeremy Allison <jra@samba.org>2007-11-03 15:12:42 -0700
commit73d407968002587eadd0ff13eb413ddf07c78771 (patch)
treee1656e24e0298ee3b9097c1904618955535233e4 /source3/libsmb
parent705ba0d5b5156075d841ce120cea967f665f52d6 (diff)
downloadsamba-73d407968002587eadd0ff13eb413ddf07c78771.tar.gz
samba-73d407968002587eadd0ff13eb413ddf07c78771.tar.bz2
samba-73d407968002587eadd0ff13eb413ddf07c78771.zip
Remove the smb_read_error global variable and replace
it with accessor functions. "One global or pstring a day...." :-). Jeremy. (This used to be commit d50d14c300abc83b7015718ec48acc8b3227a273)
Diffstat (limited to 'source3/libsmb')
-rw-r--r--source3/libsmb/cliconnect.c2
-rw-r--r--source3/libsmb/clientgen.c21
-rw-r--r--source3/libsmb/clierror.c20
3 files changed, 21 insertions, 22 deletions
diff --git a/source3/libsmb/cliconnect.c b/source3/libsmb/cliconnect.c
index 448bfd7663..b86939a897 100644
--- a/source3/libsmb/cliconnect.c
+++ b/source3/libsmb/cliconnect.c
@@ -699,7 +699,7 @@ static NTSTATUS cli_session_setup_ntlmssp(struct cli_state *cli, const char *use
nt_status = cli_nt_error(cli);
if (cli_is_error(cli) && NT_STATUS_IS_OK(nt_status)) {
- if (cli->smb_rw_error == READ_BAD_SIG) {
+ if (cli->smb_rw_error == SMB_READ_BAD_SIG) {
nt_status = NT_STATUS_ACCESS_DENIED;
} else {
nt_status = NT_STATUS_UNSUCCESSFUL;
diff --git a/source3/libsmb/clientgen.c b/source3/libsmb/clientgen.c
index 19210dd069..0a8ff4e552 100644
--- a/source3/libsmb/clientgen.c
+++ b/source3/libsmb/clientgen.c
@@ -20,8 +20,6 @@
#include "includes.h"
-extern int smb_read_error;
-
/****************************************************************************
Change the timeout (in milliseconds).
****************************************************************************/
@@ -112,7 +110,7 @@ bool cli_receive_smb(struct cli_state *cli)
/* If the server is not responding, note that now */
if (len < 0) {
DEBUG(0, ("Receiving SMB: Server stopped responding\n"));
- cli->smb_rw_error = smb_read_error;
+ cli->smb_rw_error = get_smb_read_error();
close(cli->fd);
cli->fd = -1;
return False;
@@ -135,12 +133,12 @@ bool cli_receive_smb(struct cli_state *cli)
* Reflected signature on login error.
* Set bad sig but don't close fd.
*/
- cli->smb_rw_error = READ_BAD_SIG;
+ cli->smb_rw_error = SMB_READ_BAD_SIG;
return True;
}
DEBUG(0, ("SMB Signature verification failed on incoming packet!\n"));
- cli->smb_rw_error = READ_BAD_SIG;
+ cli->smb_rw_error = SMB_READ_BAD_SIG;
close(cli->fd);
cli->fd = -1;
return False;
@@ -242,7 +240,8 @@ bool cli_receive_smb_readX_header(struct cli_state *cli)
read_err:
- cli->smb_rw_error = smb_read_error = READ_ERROR;
+ set_smb_read_error(SMB_READ_ERROR);
+ cli->smb_rw_error = SMB_READ_ERROR;
close(cli->fd);
cli->fd = -1;
return False;
@@ -286,7 +285,7 @@ bool cli_send_smb(struct cli_state *cli)
if (ret <= 0) {
close(cli->fd);
cli->fd = -1;
- cli->smb_rw_error = WRITE_ERROR;
+ cli->smb_rw_error = SMB_WRITE_ERROR;
DEBUG(0,("Error writing %d bytes to client. %d (%s)\n",
(int)len,(int)ret, strerror(errno) ));
return False;
@@ -328,7 +327,7 @@ bool cli_send_smb_direct_writeX(struct cli_state *cli,
if (ret <= 0) {
close(cli->fd);
cli->fd = -1;
- cli->smb_rw_error = WRITE_ERROR;
+ cli->smb_rw_error = SMB_WRITE_ERROR;
DEBUG(0,("Error writing %d bytes to client. %d (%s)\n",
(int)len,(int)ret, strerror(errno) ));
return false;
@@ -343,7 +342,7 @@ bool cli_send_smb_direct_writeX(struct cli_state *cli,
if (ret <= 0) {
close(cli->fd);
cli->fd = -1;
- cli->smb_rw_error = WRITE_ERROR;
+ cli->smb_rw_error = SMB_WRITE_ERROR;
DEBUG(0,("Error writing %d extradata "
"bytes to client. %d (%s)\n",
(int)extradata,(int)ret, strerror(errno) ));
@@ -590,11 +589,11 @@ void cli_shutdown(struct cli_state *cli)
* later. This tree disconnect forces the peer to clean up, since the
* connection will be going away.
*
- * Also, do not do tree disconnect when cli->smb_rw_error is DO_NOT_DO_TDIS
+ * Also, do not do tree disconnect when cli->smb_rw_error is SMB_DO_NOT_DO_TDIS
* the only user for this so far is smbmount which passes opened connection
* down to kernel's smbfs module.
*/
- if ( (cli->cnum != (uint16)-1) && (cli->smb_rw_error != DO_NOT_DO_TDIS ) ) {
+ if ( (cli->cnum != (uint16)-1) && (cli->smb_rw_error != SMB_DO_NOT_DO_TDIS ) ) {
cli_tdis(cli);
}
diff --git a/source3/libsmb/clierror.c b/source3/libsmb/clierror.c
index 4ab1c237dc..1c35bcf146 100644
--- a/source3/libsmb/clierror.c
+++ b/source3/libsmb/clierror.c
@@ -72,17 +72,17 @@ static const char *cli_smb_errstr(struct cli_state *cli)
static NTSTATUS cli_smb_rw_error_to_ntstatus(struct cli_state *cli)
{
switch(cli->smb_rw_error) {
- case READ_TIMEOUT:
+ case SMB_READ_TIMEOUT:
return NT_STATUS_IO_TIMEOUT;
- case READ_EOF:
+ case SMB_READ_EOF:
return NT_STATUS_END_OF_FILE;
/* What we shoud really do for read/write errors is convert from errno. */
/* FIXME. JRA. */
- case READ_ERROR:
+ case SMB_READ_ERROR:
return NT_STATUS_INVALID_NETWORK_RESPONSE;
- case WRITE_ERROR:
+ case SMB_WRITE_ERROR:
return NT_STATUS_UNEXPECTED_NETWORK_ERROR;
- case READ_BAD_SIG:
+ case SMB_READ_BAD_SIG:
return NT_STATUS_INVALID_PARAMETER;
default:
break;
@@ -111,24 +111,24 @@ const char *cli_errstr(struct cli_state *cli)
/* Was it server socket error ? */
if (cli->fd == -1 && cli->smb_rw_error) {
switch(cli->smb_rw_error) {
- case READ_TIMEOUT:
+ case SMB_READ_TIMEOUT:
slprintf(cli_error_message, sizeof(cli_error_message) - 1,
"Call timed out: server did not respond after %d milliseconds",
cli->timeout);
break;
- case READ_EOF:
+ case SMB_READ_EOF:
slprintf(cli_error_message, sizeof(cli_error_message) - 1,
"Call returned zero bytes (EOF)" );
break;
- case READ_ERROR:
+ case SMB_READ_ERROR:
slprintf(cli_error_message, sizeof(cli_error_message) - 1,
"Read error: %s", strerror(errno) );
break;
- case WRITE_ERROR:
+ case SMB_WRITE_ERROR:
slprintf(cli_error_message, sizeof(cli_error_message) - 1,
"Write error: %s", strerror(errno) );
break;
- case READ_BAD_SIG:
+ case SMB_READ_BAD_SIG:
slprintf(cli_error_message, sizeof(cli_error_message) - 1,
"Server packet had invalid SMB signature!");
break;