summaryrefslogtreecommitdiff
path: root/source3/libsmb
diff options
context:
space:
mode:
authorStefan Metzmacher <metze@samba.org>2011-07-08 09:45:05 +0200
committerStefan Metzmacher <metze@samba.org>2011-07-08 14:09:08 +0200
commitf0e6e5c37d5921450d030acb98c794f0cf7224a6 (patch)
treeb83056a2a118fd6dc815f61bee23d31bae0646b5 /source3/libsmb
parent2b8e1480840db7ef8128352b1808a5ee91a03ca1 (diff)
downloadsamba-f0e6e5c37d5921450d030acb98c794f0cf7224a6.tar.gz
samba-f0e6e5c37d5921450d030acb98c794f0cf7224a6.tar.bz2
samba-f0e6e5c37d5921450d030acb98c794f0cf7224a6.zip
s3:libsmb: remove unused enum smb_read_errors infrastructure
metze
Diffstat (limited to 'source3/libsmb')
-rw-r--r--source3/libsmb/clientgen.c8
-rw-r--r--source3/libsmb/clierror.c80
2 files changed, 9 insertions, 79 deletions
diff --git a/source3/libsmb/clientgen.c b/source3/libsmb/clientgen.c
index 91e7fd4b7f..41f5cb5939 100644
--- a/source3/libsmb/clientgen.c
+++ b/source3/libsmb/clientgen.c
@@ -204,7 +204,6 @@ struct cli_state *cli_initialise_ex(int signing_state)
cli->inbuf = (char *)SMB_MALLOC(cli->bufsize+SAFETY_MARGIN);
cli->oplock_handler = cli_oplock_ack;
cli->case_sensitive = false;
- cli->smb_rw_error = SMB_READ_OK;
cli->use_spnego = lp_client_use_spnego();
@@ -303,12 +302,8 @@ static void _cli_shutdown(struct cli_state *cli)
* can remain active on the peer end, until some (long) timeout period
* 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 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 != SMB_DO_NOT_DO_TDIS ) ) {
+ if (cli->cnum != (uint16)-1) {
cli_tdis(cli);
}
@@ -321,7 +316,6 @@ static void _cli_shutdown(struct cli_state *cli)
close(cli->fd);
}
cli->fd = -1;
- cli->smb_rw_error = SMB_READ_OK;
/*
* Need to free pending first, they remove themselves
diff --git a/source3/libsmb/clierror.c b/source3/libsmb/clierror.c
index 32de7ecd44..4b6f044881 100644
--- a/source3/libsmb/clierror.c
+++ b/source3/libsmb/clierror.c
@@ -31,33 +31,6 @@ static const char *cli_smb_errstr(struct cli_state *cli)
return smb_dos_errstr(cli->inbuf);
}
-/****************************************************************************
- Convert a socket error into an NTSTATUS.
-****************************************************************************/
-
-static NTSTATUS cli_smb_rw_error_to_ntstatus(struct cli_state *cli)
-{
- switch(cli->smb_rw_error) {
- case SMB_READ_TIMEOUT:
- return NT_STATUS_IO_TIMEOUT;
- 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 SMB_READ_ERROR:
- return NT_STATUS_INVALID_NETWORK_RESPONSE;
- case SMB_WRITE_ERROR:
- return NT_STATUS_UNEXPECTED_NETWORK_ERROR;
- case SMB_READ_BAD_SIG:
- return NT_STATUS_INVALID_PARAMETER;
- case SMB_NO_MEMORY:
- return NT_STATUS_NO_MEMORY;
- default:
- break;
- }
- return NT_STATUS_UNSUCCESSFUL;
-}
-
/***************************************************************************
Return an error message - either an NT error, SMB error or a RAP error.
Note some of the NT errors are actually warnings or "informational" errors
@@ -76,42 +49,6 @@ const char *cli_errstr(struct cli_state *cli)
goto done;
}
- /* Was it server socket error ? */
- if (cli->fd == -1 && cli->smb_rw_error) {
- switch(cli->smb_rw_error) {
- 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 SMB_READ_EOF:
- slprintf(cli_error_message, sizeof(cli_error_message) - 1,
- "Call returned zero bytes (EOF)" );
- break;
- case SMB_READ_ERROR:
- slprintf(cli_error_message, sizeof(cli_error_message) - 1,
- "Read error: %s", strerror(errno) );
- break;
- case SMB_WRITE_ERROR:
- slprintf(cli_error_message, sizeof(cli_error_message) - 1,
- "Write error: %s", strerror(errno) );
- break;
- case SMB_READ_BAD_SIG:
- slprintf(cli_error_message, sizeof(cli_error_message) - 1,
- "Server packet had invalid SMB signature!");
- break;
- case SMB_NO_MEMORY:
- slprintf(cli_error_message, sizeof(cli_error_message) - 1,
- "Out of memory");
- break;
- default:
- slprintf(cli_error_message, sizeof(cli_error_message) - 1,
- "Unknown error code %d\n", cli->smb_rw_error );
- break;
- }
- goto done;
- }
-
/* Case #1: RAP error */
if (cli->rap_error) {
strlcpy(cli_error_message, win_errstr(W_ERROR(cli->rap_error)),
@@ -148,8 +85,8 @@ NTSTATUS cli_nt_error(struct cli_state *cli)
int flgs2 = SVAL(cli->inbuf,smb_flg2);
/* Deal with socket errors first. */
- if (cli->fd == -1 && cli->smb_rw_error) {
- return cli_smb_rw_error_to_ntstatus(cli);
+ if (cli->fd == -1) {
+ return NT_STATUS_CONNECTION_DISCONNECTED;
}
if (!(flgs2 & FLAGS2_32_BIT_ERROR_CODES)) {
@@ -175,10 +112,9 @@ void cli_dos_error(struct cli_state *cli, uint8 *eclass, uint32 *ecode)
return;
}
- /* Deal with socket errors first. */
- if (cli->fd == -1 && cli->smb_rw_error) {
- NTSTATUS status = cli_smb_rw_error_to_ntstatus(cli);
- ntstatus_to_dos( status, eclass, ecode);
+ if (cli->fd == -1) {
+ *eclass = ERRDOS;
+ *ecode = ERRnotconnected;
return;
}
@@ -236,7 +172,7 @@ bool cli_is_error(struct cli_state *cli)
uint32 flgs2 = SVAL(cli->inbuf,smb_flg2), rcls = 0;
/* A socket error is always an error. */
- if (cli->fd == -1 && cli->smb_rw_error != 0) {
+ if (cli->fd == -1) {
return True;
}
@@ -259,7 +195,7 @@ bool cli_is_nt_error(struct cli_state *cli)
uint32 flgs2 = SVAL(cli->inbuf,smb_flg2);
/* A socket error is always an NT error. */
- if (cli->fd == -1 && cli->smb_rw_error != 0) {
+ if (cli->fd == -1) {
return True;
}
@@ -273,7 +209,7 @@ bool cli_is_dos_error(struct cli_state *cli)
uint32 flgs2 = SVAL(cli->inbuf,smb_flg2);
/* A socket error is always a DOS error. */
- if (cli->fd == -1 && cli->smb_rw_error != 0) {
+ if (cli->fd == -1) {
return True;
}