summaryrefslogtreecommitdiff
path: root/source3
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>2002-10-01 02:11:26 +0000
committerJeremy Allison <jra@samba.org>2002-10-01 02:11:26 +0000
commit3e2a384e765c0702fb34d2f2447bf653dabde185 (patch)
tree8992d1dbc01d019dc3a7e6e6931a66ebcc469a1f /source3
parent549f70f8eeb9ea416b8b54436597dd4fcc893918 (diff)
downloadsamba-3e2a384e765c0702fb34d2f2447bf653dabde185.tar.gz
samba-3e2a384e765c0702fb34d2f2447bf653dabde185.tar.bz2
samba-3e2a384e765c0702fb34d2f2447bf653dabde185.zip
Tidy up client error processing.
Jeremy. (This used to be commit 983e6d137eaada5cea1235e0cf051bc314b6f9d8)
Diffstat (limited to 'source3')
-rw-r--r--source3/libsmb/clientgen.c31
1 files changed, 15 insertions, 16 deletions
diff --git a/source3/libsmb/clientgen.c b/source3/libsmb/clientgen.c
index 156de42836..4a102097ce 100644
--- a/source3/libsmb/clientgen.c
+++ b/source3/libsmb/clientgen.c
@@ -22,9 +22,10 @@
#include "includes.h"
-/*
- * Change the port number used to call on
- */
+/****************************************************************************
+ Change the port number used to call on.
+****************************************************************************/
+
int cli_set_port(struct cli_state *cli, int port)
{
cli->port = port;
@@ -96,13 +97,13 @@ BOOL cli_receive_smb(struct cli_state *cli)
}
}
- /* If the server is not responding, note that now */
+ /* If the server is not responding, note that now */
- if (!ret) {
- close(cli->fd);
- cli->fd = -1;
+ if (!ret) {
cli->smb_read_error = smb_read_error;
- }
+ close(cli->fd);
+ cli->fd = -1;
+ }
return ret;
}
@@ -130,7 +131,8 @@ BOOL cli_send_smb(struct cli_state *cli)
if (ret <= 0) {
close(cli->fd);
cli->fd = -1;
- DEBUG(0,("Error writing %d bytes to client. %d\n", (int)len,(int)ret));
+ DEBUG(0,("Error writing %d bytes to client. %d (%s)\n",
+ (int)len,(int)ret, strerror(errno) ));
return False;
}
nwritten += ret;
@@ -232,16 +234,14 @@ struct cli_state *cli_initialise(struct cli_state *cli)
cli->outbuf = (char *)malloc(cli->bufsize);
cli->inbuf = (char *)malloc(cli->bufsize);
cli->oplock_handler = cli_oplock_ack;
- if (lp_use_spnego()) {
+ if (lp_use_spnego())
cli->use_spnego = True;
- }
/* Set the CLI_FORCE_DOSERR environment variable to test
client routines using DOS errors instead of STATUS32
ones. This intended only as a temporary hack. */
- if (getenv("CLI_FORCE_DOSERR")) {
+ if (getenv("CLI_FORCE_DOSERR"))
cli->force_dos_errors = True;
- }
/* A way to attempt to force SMB signing */
if (getenv("CLI_FORCE_SMB_SIGNING"))
@@ -295,6 +295,7 @@ void cli_close_connection(struct cli_state *cli)
if (cli->fd != -1)
close(cli->fd);
cli->fd = -1;
+ cli->smb_read_error = 0;
}
/****************************************************************************
@@ -306,9 +307,8 @@ void cli_shutdown(struct cli_state *cli)
BOOL allocated = cli->allocated;
cli_close_connection(cli);
ZERO_STRUCTP(cli);
- if (allocated) {
+ if (allocated)
free(cli);
- }
}
/****************************************************************************
@@ -348,4 +348,3 @@ BOOL cli_send_keepalive(struct cli_state *cli)
}
return True;
}
-