[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: ssh-client example broken


Am 16.08.2018 um 18:51 schrieb Andreas Schneider:
> On Thursday, 16 August 2018 18:11:46 CEST Tilo Eckert wrote:
>> Hi,
>>
>> today I compiled the examples shipped with libssh (current master) for
>> the first time and tried to use the "ssh-client" example, but it seems
>> to be broken.
>>
>> When I connect to an OpenSSH server in interactive shell mode (i.e.
>> ssh-client user@host), the client successfully connects and
>> authenticates, but it does not print any output. Keyboard input does not
>> work either. Once connected, the client does not react to Ctrl+C, so
>> that I have to kill -9 it. When I pass a command as last parameter to
>> run in batch mode, it does not print anything either, does not
>> terminate, but reacts to Ctrl+C.
>>
>> The problem lies in the select_loop() function. I suppose its intention
>> is to connect local stdin, stdout and stderr with its remote
>> counterparts? The ssh_event_dopoll() function is repeatedly called every
>> 60 seconds when it times out or when I press a key, but it seems to do
>> nothing.
>>
>> With an older version from last year, at least the motd from the server
>> gets printed after connecting in interactive mode, but then it gets
>> stuck as well. No shell prompt, no input possible, no Ctrl+C. So it
>> seems to be broken for a while.
> 
> 
> WORKSFORME:
> 
> ./examples/ssh-client asn@krikkit
> Activate the web console with: systemctl enable --now cockpit.socket
> 
> Last login: Thu Aug 16 18:50:07 2018 from 2001:a62:160e:
> 4a01:a935:c919:b383:fa79
> 
> Welcome to krikkit. Load: 0.15 0.09 0.08 3/823 24405
> 
> asn@krikkit:~> ls workspace/projects/libssh
> AUTHORS            CTestConfig.cmake      README              cmake           
> doc                                  libssh-config.cmake.in  src
> BSD                ChangeLog              README.CodingStyle  config.h.cmake  
> examples                             libssh.pc.cmake         tags
> CMakeLists.txt     ConfigureChecks.cmake  README.mbedtls      cscope.in.out   
> include                              obj                     tests
> COPYING            DefineOptions.cmake    README.md           cscope.out      
> libssh-build-tree-settings.cmake.in  obj-gcrypt
> CPackConfig.cmake  INSTALL                SubmittingPatches   cscope.po.out   
> libssh-config-version.cmake.in       obj-mbedcrypto
> asn@krikkit:~> logout
> 
> 
> 
> I dunno what is wrong on your side ...
> 

I do.

I modified timeout handling in ssh_handle_packets_termination() in my
local copy two years ago because I ran into code paths where, even
though a timeout was configured, ssh_handle_packets_termination() would
block with an infinite timeout, resulting in stalled connections. My
code change fixed that issue, but obviously created another one. I guess
I did not submit my solution as a patch because I knew it wasn't proper
code. Time for re-evaluation... :P

Regards
Tilo

Follow-Ups:
Re: ssh-client example brokenAndreas Schneider <asn@xxxxxxxxxxxxxx>
References:
ssh-client example brokenTilo Eckert <tilo.eckert@xxxxxxx>
Re: ssh-client example brokenAndreas Schneider <asn@xxxxxxxxxxxxxx>
Archive administrator: postmaster@lists.cynapses.org