[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
RE: Problems exchanging data with remote server
[Thread Prev] | [Thread Next]
- Subject: RE: Problems exchanging data with remote server
- From: "Herwin Kleinjan" <herwin.kleinjan@xxxxxxxxxxx>
- Reply-to: libssh@xxxxxxxxxx
- Date: Thu, 4 Aug 2011 11:35:08 +0200
- To: <libssh@xxxxxxxxxx>
- Cc: <development@xxxxxxxxxxx>
Well, by now I have rerun my tests on the customers system using libssh v0.5.0 with the patch provided by Andreas but unfortunately, the results are exactly the same (except for the packet_size being increased from 32000 to 32768). However, when re-reading the tutorials that Andreas pointed out, I spotted something that might apply here: Chapter 3 - Interactive and non-interactive sessions A "shell" is a command interpreter. It is said to be "interactive" if there is a human user typing the commands, one after the other. The contrary, a non-interactive shell, is similar to the execution of commands in the background: there is no attached terminal. If you plan using an interactive shell, you need to create a pseud-terminal on the remote side. A remote terminal is usually referred to as a "pty", for "pseudo-teletype". The remote processes won't see the difference with a real text-oriented terminal. If needed, you request the pty with the function ssh_channel_request_pty(). Then you define its dimensions (number of rows and columns) with ssh_channel_change_pty_size(). Be your session interactive or not, the next step is to request a shell with ssh_channel_request_shell(). Chapter 4 - Passing a remote command Previous chapter has shown how to open a full shell session, with an attached terminal or not. If you only need to execute a command on the remote end, you don't need all that complexity. The method described here is suited for executing only one remote command. If you need to issue several commands in a row, you should consider using a non-interactive remote shell, as explained in previous chapter. What I noticed in particular were the last lines in the excerpts from both chapter 3 and 4, it seems that making use of a (non-interactive) shell and calling ssh_channel_request_shell() is mandatory when one wants to execute multiple commands to the SSH server. Right now, we only call ssh_channel_new() and ssh_channel_open_session(), but not ssh_channel_request_shell()... Will calling ssh_channel_request_shell() before sending the first command using ssh_channel_write() make a difference? Best regards, Herwin -----Original Message----- From: Herwin Kleinjan [mailto:herwin.kleinjan@xxxxxxxxxxx] Sent: dinsdag 2 augustus 2011 16:41 To: libssh@xxxxxxxxxx Subject: RE: Problems exchanging data with remote server Thanks for this patch. I've applied the patch but one chunk failed: root@cbsdevl3://usr/developers/root/libssh-0.5.0#patch -p1 < patch1.txt patching file src/channels.c Hunk #2 succeeded at 885 (offset -8 lines). Hunk #4 succeeded at 2819 (offset -132 lines). Hunk #5 FAILED at 2886. 1 out of 5 hunks FAILED -- saving rejects to file src/channels.c.rej root@cbsdevl3://usr/developers/root/libssh-0.5.0#cat src/channels.c.rej *************** *** 2866,2872 **** goto error; } - rc = channel_open(channel, "x11", 64000, 32000, payload); error: ssh_buffer_free(payload); --- 2886,2896 ---- goto error; } + rc = channel_open(channel, + "x11", + CHANNEL_INITIAL_WINDOW, + CHANNEL_MAX_PACKET, + payload); error: ssh_buffer_free(payload); As the function ssh_channel_open_x11() does not appear in the libssh v0.5.0 code that I have here locally I take it that this chunk failing isn't a problem. I've asked our customer to install the updated libssh.so.4.2.0 library that I now have created. I (or a colleague of mine as I will be going on a holiday in 2 days) will let you now the result once we have tested this patch. Best regards, Herwin -----Original Message----- From: Andreas Schneider [mailto:asn@xxxxxxxxxxxxxx] Sent: dinsdag 2 augustus 2011 15:51 To: libssh@xxxxxxxxxx Subject: Re: Problems exchanging data with remote server On Tuesday 02 August 2011 15:25:31 you wrote: > Hi Andreas, > > Thanks for your time and answers. Attached you will find a full debug log of > the problem, as requested. If you need additional logging or data, please > let me know. > > I agree with you that even if the packet size of 32000 might not be as per > specifications, it most likely won't be the cause of problem I'm facing > here. Is this something that should be corrected on the server side? > Because I do think it may eventually lead to problems as some of the data > packets that we receive from the server could easily exceed 64k bytes. Please test: http://cpaste.org/1228/ I've looked at the output of openssh. They use 0 as the first window and let it grow. > Right now we are just using ssh_channel_write() (of course after we have > logged in and called ssh_channel_new() and ssh_channel_open_session()). > Knowing that I am connecting to a 'plain' SSH server that I can connect to > using the OS ssh command as well, I was thinking that I could try that > approach with our client program too. Hence my question if using the > ssh_channel_request_exec() function as a way of issuing commands to the > server (instead of the ssh_channel_write() function) might yield different > results. Normall you need a non-interactive shell: http://api.libssh.org/master/libssh_tutor_shell.html or use the exec command: http://api.libssh.org/master/libssh_tutor_command.html Cheers, -- andreas -- Andreas Schneider GPG-ID: F33E3FC6 www.cryptomilk.org asn@xxxxxxxxxxxxxx
Re: Problems exchanging data with remote server | Andreas Schneider <asn@xxxxxxxxxxxxxx> |
Re: Problems exchanging data with remote server | Andreas Schneider <asn@xxxxxxxxxxxxxx> |
RE: Problems exchanging data with remote server | "Herwin Kleinjan" <herwin.kleinjan@xxxxxxxxxxx> |