diff options
author | Jeremy Allison <jra@samba.org> | 2008-10-03 14:58:41 -0700 |
---|---|---|
committer | Jeremy Allison <jra@samba.org> | 2008-10-03 14:58:41 -0700 |
commit | a9390d3047b7b7aba6f73c20e3dff292f7600a9f (patch) | |
tree | 4fb4a4a52e45e0b4907fd79e16de9e5b90d202c8 /source3/client | |
parent | f6c883b4b00f4cd751cd312a27bddffb3be9c059 (diff) | |
download | samba-a9390d3047b7b7aba6f73c20e3dff292f7600a9f.tar.gz samba-a9390d3047b7b7aba6f73c20e3dff292f7600a9f.tar.bz2 samba-a9390d3047b7b7aba6f73c20e3dff292f7600a9f.zip |
Correctly fix smbclient to terminate on eof from server.
Jeremy.
Diffstat (limited to 'source3/client')
-rw-r--r-- | source3/client/client.c | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/source3/client/client.c b/source3/client/client.c index 7af7d30108..4d6bf8f198 100644 --- a/source3/client/client.c +++ b/source3/client/client.c @@ -4345,6 +4345,8 @@ cleanup: } } +static bool finished; + /**************************************************************************** Make sure we swallow keepalives during idle time. ****************************************************************************/ @@ -4391,6 +4393,8 @@ static void readline_callback(void) DEBUG(0, ("Read from server failed, maybe it closed " "the connection\n")); + finished = true; + smb_readline_done(); if (NT_STATUS_EQUAL(status, NT_STATUS_END_OF_FILE)) { set_smb_read_error(&cli->smb_rw_error, SMB_READ_EOF); @@ -4419,7 +4423,12 @@ static void readline_callback(void) { unsigned char garbage[16]; memset(garbage, 0xf0, sizeof(garbage)); - cli_echo(cli, 1, data_blob_const(garbage, sizeof(garbage))); + if (!cli_echo(cli, 1, data_blob_const(garbage, sizeof(garbage)))) { + DEBUG(0, ("SMBecho failed. Maybe server has closed " + "the connection\n")); + finished = true; + smb_readline_done(); + } } } @@ -4431,7 +4440,7 @@ static int process_stdin(void) { int rc = 0; - while (1) { + while (!finished) { TALLOC_CTX *frame = talloc_stackframe(); char *tok = NULL; char *the_prompt = NULL; |