More information:
In 0.6.0rc1 I could use WSAAsyncSelect to determine when a client
was connecting, but in 0.6.4 I can't. I rewrote the code around the
ssh_bind_listen() to use select() instead and now things are MOSTLY
working.
I am still getting client (putty) disconnects with "Incoming packet
was garbled on decryption" during the key exchange. I wrote a NodeJS
SSH2 client to test with also, and it is throwing an exception
stating "Bad packet length".
On 4/6/2015 6:31 PM, Kevin Stewart
wrote:
I developed a Windows-based (using VS2010) server application
using the 0.6.0rc1 version of libssh and was getting memory leaks
on a per connection basis. I decided to migrate to the latest
version (0.6.4) to see if it alleviated these leaks and ran into
different issues. The first issue is in socket.c starting at line
314.
Snippet
ssh_socket_set_blocking() is failing and WSAGetLastError() is
returning 10022 (WSAEINVAL). Since sockets are initially in
blocking mode ("When a socket is created, it operates in
blocking mode by default (nonblocking mode is disabled). This is
consistent with BSD sockets." - https://msdn.microsoft.com/en-us/library/windows/desktop/ms738573(v=vs.85).aspx),
I commented out the section of code to get passed the error. Now,
during the key exchange, clients (putty), disconnects with
"Incoming packet was garbled on decryption".
Below is a log I collected.
2015-04-06 18:09:35 SYS-INF DAEMON - NEW CONNECTION FROM
192.168.1.206:16907
2015-04-06 18:09:35 ACT-INF DAEMON -
ssh_socket_pollcallback(3) - ssh_socket_pollcallback: Received
POLLOUT in connecting state
2015-04-06 18:09:35 ACT-INF DAEMON -
ssh_socket_unbuffered_write(3) - ssh_socket_unbuffered_write:
Enabling POLLOUT for socket
2015-04-06 18:09:35 ACT-INF DAEMON -
callback_receive_banner(3) - callback_receive_banner: Received
banner: SSH-2.0-PuTTY_Local:_Aug__7_2013_13:47:56
2015-04-06 18:09:35 ACT-INF DAEMON -
ssh_server_connection_callback(1) -
ssh_server_connection_callback: SSH client banner:
SSH-2.0-PuTTY_Local:_Aug__7_2013_13:47:56
2015-04-06 18:09:35 ACT-INF DAEMON -
ssh_analyze_banner(1) - ssh_analyze_banner: Analyzing banner:
SSH-2.0-PuTTY_Local:_Aug__7_2013_13:47:56
2015-04-06 18:09:35 ACT-INF DAEMON - ssh_list_kex(4) -
ssh_list_kex: kex algos: curve25519-sha256@xxxxxxxxxx,ecdh-sha2-nistp256,diffie-hellman-group14-sha1,diffie-hellman-group1-sha1
2015-04-06 18:09:35 ACT-INF DAEMON - ssh_list_kex(4) -
ssh_list_kex: server host key algo: ssh-dss,ssh-rsa
2015-04-06 18:09:35 ACT-INF DAEMON - ssh_list_kex(4) -
ssh_list_kex: encryption client->server:
aes256-ctr,aes192-ctr,aes128-ctr,aes256-cbc,aes192-cbc,aes128-cbc,blowfish-cbc,3des-cbc,des-cbc-ssh1
2015-04-06 18:09:35 ACT-INF DAEMON - ssh_list_kex(4) -
ssh_list_kex: encryption server->client:
aes256-ctr,aes192-ctr,aes128-ctr,aes256-cbc,aes192-cbc,aes128-cbc,blowfish-cbc,3des-cbc,des-cbc-ssh1
2015-04-06 18:09:35 ACT-INF DAEMON - ssh_list_kex(4) -
ssh_list_kex: mac algo client->server: hmac-sha1
2015-04-06 18:09:35 ACT-INF DAEMON - ssh_list_kex(4) -
ssh_list_kex: mac algo server->client: hmac-sha1
2015-04-06 18:09:35 ACT-INF DAEMON - ssh_list_kex(4) -
ssh_list_kex: compression algo client->server: none,zlib,zlib@xxxxxxxxxxx
2015-04-06 18:09:35 ACT-INF DAEMON - ssh_list_kex(4) -
ssh_list_kex: compression algo server->client: none,zlib,zlib@xxxxxxxxxxx
2015-04-06 18:09:35 ACT-INF DAEMON - ssh_list_kex(4) -
ssh_list_kex: languages client->server:
2015-04-06 18:09:35 ACT-INF DAEMON - ssh_list_kex(4) -
ssh_list_kex: languages server->client:
2015-04-06 18:09:35 ACT-INF DAEMON -
ssh_socket_unbuffered_write(3) - ssh_socket_unbuffered_write:
Enabling POLLOUT for socket
2015-04-06 18:09:35 ACT-INF DAEMON - packet_send2(3) -
packet_send2: packet: wrote
[len=460,padding=10,comp=449,payload=449]
2015-04-06 18:09:35 ACT-INF DAEMON -
ssh_socket_exception_callback(1) -
ssh_socket_exception_callback: Socket exception callback: 2
(10053)
2015-04-06 18:09:35 ACT-INF DAEMON -
ssh_socket_exception_callback(1) -
ssh_socket_exception_callback: Socket error: Unknown error
2015-04-06 18:09:35 ACT-INF DAEMON -
ssh_handle_key_exchange(3) - ssh_handle_key_exchange:
ssh_handle_key_exchange: current state : 9
2015-04-06 18:09:35 ACT-INF 192.168.1.206:16907 - ERROR
(-1) ON KEY EXCHANGE: Socket error: Unknown error
Attached is the putty log file.
--
|
Kevin Stewart
VP of Engineering
Vaonet, Inc.
|
--
|
Kevin Stewart
VP of Engineering
Vaonet, Inc.
|
|