From 047d6138a290f025d049495f604b9d3163b88ecf Mon Sep 17 00:00:00 2001 From: Stefan Metzmacher Date: Tue, 31 Jan 2012 08:41:07 +0100 Subject: [PATCH 1/2] Revert "Fix bug #8139 - smbclient fails if server does not support Echo request." This reverts commit 1fdc96ecaff8ca12e9aa0082527468ad4242a8a9. This is wrong in master as the error codes are different compared to 3.5.x. The correct way to handle this is to call cli_state_is_connected(). metze --- source3/client/client.c | 6 +----- 1 files changed, 1 insertions(+), 5 deletions(-) diff --git a/source3/client/client.c b/source3/client/client.c index 9b36ff7..4b7df92 100644 --- a/source3/client/client.c +++ b/source3/client/client.c @@ -5032,15 +5032,11 @@ static void readline_callback(void) /* Ping the server to keep the connection alive using SMBecho. */ memset(garbage, 0xf0, sizeof(garbage)); status = cli_echo(cli, 1, data_blob_const(garbage, sizeof(garbage))); - if (NT_STATUS_EQUAL(status, NT_STATUS_PIPE_BROKEN) || - NT_STATUS_EQUAL(status, NT_STATUS_END_OF_FILE) || - NT_STATUS_EQUAL(status, NT_STATUS_IO_TIMEOUT)) { + if (!NT_STATUS_IS_OK(status)) { DEBUG(0, ("SMBecho failed (%s). Maybe server has closed " "the connection\n", nt_errstr(status))); finished = true; smb_readline_done(); - /* Ignore all other errors - sometimes servers simply - don't implement SMBecho (Apple for example). */ } } -- 1.7.4.1 From 3b47aa50923d8d956dc678223a9d1203b7b0ec91 Mon Sep 17 00:00:00 2001 From: Stefan Metzmacher Date: Tue, 31 Jan 2012 08:47:38 +0100 Subject: [PATCH 2/2] s3:client: ignore SMBecho errors (the server may not support it) (bug #8139) metze --- source3/client/client.c | 10 +++++++--- 1 files changed, 7 insertions(+), 3 deletions(-) diff --git a/source3/client/client.c b/source3/client/client.c index 4b7df92..89fd1d4 100644 --- a/source3/client/client.c +++ b/source3/client/client.c @@ -5032,9 +5032,13 @@ static void readline_callback(void) /* Ping the server to keep the connection alive using SMBecho. */ memset(garbage, 0xf0, sizeof(garbage)); status = cli_echo(cli, 1, data_blob_const(garbage, sizeof(garbage))); - if (!NT_STATUS_IS_OK(status)) { - DEBUG(0, ("SMBecho failed (%s). Maybe server has closed " - "the connection\n", nt_errstr(status))); + if (NT_STATUS_IS_OK(status)) { + return; + } + + if (!cli_state_is_connected(cli)) { + DEBUG(0,("SMBecho failed (%s). The connection is " + "disconnected now\n", nt_errstr(status))); finished = true; smb_readline_done(); } -- 1.7.4.1