summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>2002-10-01 01:41:20 +0000
committerJeremy Allison <jra@samba.org>2002-10-01 01:41:20 +0000
commit5cec60b31b63821ebc35f0a3f02b96329a08387d (patch)
tree08cf449c1309d532ea51e569dc608572b4808832
parent6007a592b2c842c640f164d3b5132d05b5be82a7 (diff)
downloadsamba-5cec60b31b63821ebc35f0a3f02b96329a08387d.tar.gz
samba-5cec60b31b63821ebc35f0a3f02b96329a08387d.tar.bz2
samba-5cec60b31b63821ebc35f0a3f02b96329a08387d.zip
Added error string for server timeout on client call.
Jeremy. (This used to be commit 28d2eb934318818a3b0527e391987ea139dbf4a3)
-rw-r--r--source3/include/client.h1
-rw-r--r--source3/libsmb/clientgen.c2
-rw-r--r--source3/libsmb/clierror.c8
3 files changed, 11 insertions, 0 deletions
diff --git a/source3/include/client.h b/source3/include/client.h
index 1e8d1c3d29..7a8889edc5 100644
--- a/source3/include/client.h
+++ b/source3/include/client.h
@@ -70,6 +70,7 @@ typedef struct smb_sign_info {
struct cli_state {
int port;
int fd;
+ int smb_read_error; /* Copy of last read error. */
uint16 cnum;
uint16 pid;
uint16 mid;
diff --git a/source3/libsmb/clientgen.c b/source3/libsmb/clientgen.c
index 793dd19644..156de42836 100644
--- a/source3/libsmb/clientgen.c
+++ b/source3/libsmb/clientgen.c
@@ -69,6 +69,7 @@ static BOOL client_receive_smb(int fd,char *buffer, unsigned int timeout)
BOOL cli_receive_smb(struct cli_state *cli)
{
+ extern int smb_read_error;
BOOL ret;
/* fd == -1 causes segfaults -- Tom (tom@ninja.nl) */
@@ -100,6 +101,7 @@ BOOL cli_receive_smb(struct cli_state *cli)
if (!ret) {
close(cli->fd);
cli->fd = -1;
+ cli->smb_read_error = smb_read_error;
}
return ret;
diff --git a/source3/libsmb/clierror.c b/source3/libsmb/clierror.c
index e1507c6048..fb88b66786 100644
--- a/source3/libsmb/clierror.c
+++ b/source3/libsmb/clierror.c
@@ -85,6 +85,14 @@ char *cli_errstr(struct cli_state *cli)
return cli_error_message;
}
+ /* Was it server timeout ? */
+ if (cli->fd == -1 && cli->timeout > 0 && cli->smb_read_error == READ_TIMEOUT) {
+ slprintf(cli_error_message, sizeof(cli_error_message) - 1,
+ "Call timed out: server did not respond after %d milliseconds",
+ cli->timeout);
+ return cli_error_message;
+ }
+
/* Case #1: RAP error */
if (cli->rap_error) {
for (i = 0; rap_errmap[i].message != NULL; i++) {