Vic Lee | 1 Sep 07:45 2011

ssh_channel_write() and SSH_AGAIN

Hi libssh team!

Recently I am having a problem when migrating to 0.5. Previously in 0.4 
when I call channel_write() libssh will block until the packet has 
actually sent out (i.e. blocking_flush). However in 0.5 I saw that the 
blocking flush has been remove and replaced by nonblocking_flush. And 
when I call ssh_channel_write() it returns SSH_AGAIN. What should I do 
in the application after I receive this rc? I can't find an API that 
could force a flush, and the next ssh_channel_select does not flush 
anything either.

Thanks!

Vic

Vic Lee | 1 Sep 09:10 2011

Re: ssh_channel_write() and SSH_AGAIN

Hi again,

I just figured out that if I call ssh_set_fd_towrite() before 
ssh_channel_write(), it works fine again. Could you tell me if I am 
using the right thing?

Vic

On 09/01/2011 01:45 PM, Vic Lee wrote:
> Hi libssh team!
>
> Recently I am having a problem when migrating to 0.5. Previously in 0.4
> when I call channel_write() libssh will block until the packet has
> actually sent out (i.e. blocking_flush). However in 0.5 I saw that the
> blocking flush has been remove and replaced by nonblocking_flush. And
> when I call ssh_channel_write() it returns SSH_AGAIN. What should I do
> in the application after I receive this rc? I can't find an API that
> could force a flush, and the next ssh_channel_select does not flush
> anything either.
>
> Thanks!
>
> Vic
>
>
>

Andreas Schneider | 1 Sep 10:02 2011

Re: ssh_channel_write() and SSH_AGAIN

On Thursday 01 September 2011 15:10:11 you wrote:
> Hi again,

Hey,

> I just figured out that if I call ssh_set_fd_towrite() before
> ssh_channel_write(), it works fine again. Could you tell me if I am
> using the right thing?

hmm, could you please open a bug report?

Add a reference to http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=631950

Thanks,

	-- andreas

--

-- 
Andreas Schneider                   GPG-ID: F33E3FC6
www.cryptomilk.org                asn@...

Vic Lee | 1 Sep 10:35 2011

Re: ssh_channel_write() and SSH_AGAIN

Hi Andreas,

Seems something is wrong with red.libssh.org, I am not able to register 
user or browse issues. The web site says "redMine 500 Internal error".

Thanks,

Vic

On 09/01/2011 04:02 PM, Andreas Schneider wrote:
> hmm, could you please open a bug report?

Andreas Schneider | 1 Sep 10:37 2011

Re: ssh_channel_write() and SSH_AGAIN

On Thursday 01 September 2011 16:35:45 you wrote:
> Hi Andreas,

Hey Vic,

> Seems something is wrong with red.libssh.org, I am not able to register
> user or browse issues. The web site says "redMine 500 Internal error".

Fixed, thanks!

	-- andreas

--

-- 
Andreas Schneider                   GPG-ID: F33E3FC6
www.cryptomilk.org                asn@...

Vic Lee | 1 Sep 10:54 2011

Re: ssh_channel_write() and SSH_AGAIN

OK I created the bug report here:

https://red.libssh.org/issues/60

On 09/01/2011 04:02 PM, Andreas Schneider wrote:
> On Thursday 01 September 2011 15:10:11 you wrote:
>> Hi again,
>
> Hey,
>
>> I just figured out that if I call ssh_set_fd_towrite() before
>> ssh_channel_write(), it works fine again. Could you tell me if I am
>> using the right thing?
>
> hmm, could you please open a bug report?
>
> Add a reference to http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=631950
>
>
> Thanks,
>
>
> 	-- andreas
>

Aris Adamantiadis | 1 Sep 20:07 2011
Picon

Re: ssh_channel_write() and SSH_AGAIN

Hi all,

I resolved a bunch (I really mean many !) on vacation, including this one.
The fix Is in my local git. Expect it for Saturday.

See you soon,

Aris

Envoyé de mon téléphone.

Le 1 sept. 2011 à 11:54, Vic Lee <llyzs@...> a écrit :

> OK I created the bug report here:
> 
> https://red.libssh.org/issues/60
> 
> On 09/01/2011 04:02 PM, Andreas Schneider wrote:
>> On Thursday 01 September 2011 15:10:11 you wrote:
>>> Hi again,
>> 
>> Hey,
>> 
>>> I just figured out that if I call ssh_set_fd_towrite() before
>>> ssh_channel_write(), it works fine again. Could you tell me if I am
>>> using the right thing?
>> 
>> hmm, could you please open a bug report?
>> 
>> Add a reference to http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=631950
(Continue reading)

Andreas Schneider | 6 Sep 00:15 2011

Logging in libssh

Hey Aris,

in libssh 0.6 I would like to get rid of enter_function() and leave_function() 
and introduce a new logging function. The logging function should be private. 
Here is the idea how to do it.

#ifndef __LINESTR__                                                                                                                                                   
#define __LINESTR__ SSH_STRINGIFY(__LINE__)                                                                                                                          
#endif                                                                                                                                                                

#ifndef __location__                                                                                                                                                  
#define __location__ __FILE__ ":" __LINESTR__                                                                                                                         
#endif

void _ssh_log(ssh_session session, int verbosity, const char *format, ...) 
PRINTF_ATTRIBUTE(3, 4);
#define SSH_LOG(session, verbosity, ...) \
	_ssh_log(session, verbosity, __location__, __VA_ARGS__)

void _ssh_log(ssh_session session, int verbosity, const char *location, const 
char *format, ...)
{
	/* my code here */
}

instead of __location__ we could log __FUNCTION__

I think timestamps would be also good. We already introduced hires timers.

	-- andreas
(Continue reading)

Dairon Dominguez Vega | 6 Sep 17:40 2011
Picon

About copy many files.

Thanks after all:

Have anybody an exaple of coping many files including subdirectories throw the red.

Thanks.

***************** 
** 养 虎 伤 身 ** 
***************** 

Jeroen Pot | 8 Sep 11:09 2011
Picon

Failing to connect to an openSSH server

Hi All,

 

When I try to connect to an openSSH server I get the following error:

Error : Received SSH_MSG_DISCONNECT: 33554432:bad client public DH value (Full logging attached)

 

It seems that the server forces a disconnect.

The sshd reports:

invalid public DH value (1/1024)

Disconnecting: bad client public DH value

 

Question is: What causes this  disconnect and how can I fix this?

When I connect using the openSSH ssh client I have no problems.

Any help with this problem is very  much appreciated.

 

Regards,

 

 

Jeroen Pot

Senior Software Engineer

 

o n e 2 m a n y

Leeuwenbrug 115

7411 TH Deventer

The Netherlands

 

T: +31 (0)88 00 349 00

F: +31 (0)88 00 349 01

 

www.one2many.eu

 

 

[func] entering function ssh_connect line 628 in /usr/developers/root/libssh-0.5.0/src/client.c
[1] libssh 0.5.0 (c) 2003-2010 Aris Adamantiadis (aris@...)
Distributed under the LGPL, please refer to COPYING file for information about your rights, using
threading threads_pthread
[func]  entering function ssh_socket_connect line 720 in /usr/developers/root/libssh-0.5.0/src/socket.c
[func]   entering function ssh_connect_host_nonblocking line 334 in /usr/developers/root/libssh-0.5.0/src/connect.c
[3] host 10.227.180.35 matches an IP address
[func]   leaving function ssh_connect_host_nonblocking line 395 in /usr/developers/root/libssh-0.5.0/src/connect.c
[2] Nonblocking connection socket: 14
[func]  leaving function ssh_socket_connect line 737 in /usr/developers/root/libssh-0.5.0/src/socket.c
[2] Socket connecting, now waiting for the callbacks to work
[func]  entering function ssh_handle_packets line 430 in /usr/developers/root/libssh-0.5.0/src/session.c
[3] Received POLLOUT in connecting state
[func]   entering function socket_callback_connected line 57 in /usr/developers/root/libssh-0.5.0/src/client.c
[1] Socket connection callback: 1 (0)
[func]    entering function ssh_client_connection_callback line 491 in /usr/developers/root/libssh-0.5.0/src/client.c
[func]    leaving function ssh_client_connection_callback line 584 in /usr/developers/root/libssh-0.5.0/src/client.c
[func]   leaving function socket_callback_connected line 72 in /usr/developers/root/libssh-0.5.0/src/client.c
[func]  leaving function ssh_handle_packets line 445 in /usr/developers/root/libssh-0.5.0/src/session.c
[func]  entering function ssh_handle_packets line 430 in /usr/developers/root/libssh-0.5.0/src/session.c
[func]  leaving function ssh_handle_packets line 445 in /usr/developers/root/libssh-0.5.0/src/session.c
[func]  entering function ssh_handle_packets line 430 in /usr/developers/root/libssh-0.5.0/src/session.c
[func]   entering function callback_receive_banner line 92 in /usr/developers/root/libssh-0.5.0/src/client.c
[3] Received banner: SSH-2.0-OpenSSH_4.3
[func]    entering function ssh_client_connection_callback line 491 in /usr/developers/root/libssh-0.5.0/src/client.c
[1] SSH server banner: SSH-2.0-OpenSSH_4.3
[1] Analyzing banner: SSH-2.0-OpenSSH_4.3
[1] We are talking to an OpenSSH client version: 4.3 (40300)
[func]     entering function ssh_send_banner line 144 in /usr/developers/root/libssh-0.5.0/src/client.c
[func]      entering function ssh_socket_write line 584 in /usr/developers/root/libssh-0.5.0/src/socket.c
[func]       entering function ssh_socket_nonblocking_flush line 606 in /usr/developers/root/libssh-0.5.0/src/socket.c
[3] Enabling POLLOUT for socket
[func]       leaving function ssh_socket_nonblocking_flush line 652 in /usr/developers/root/libssh-0.5.0/src/socket.c
[func]      leaving function ssh_socket_write line 592 in /usr/developers/root/libssh-0.5.0/src/socket.c
[func]     leaving function ssh_send_banner line 175 in /usr/developers/root/libssh-0.5.0/src/client.c
[func]    leaving function ssh_client_connection_callback line 584 in /usr/developers/root/libssh-0.5.0/src/client.c
[func]   leaving function callback_receive_banner line 115 in /usr/developers/root/libssh-0.5.0/src/client.c
[func]  leaving function ssh_handle_packets line 445 in /usr/developers/root/libssh-0.5.0/src/session.c
[func]  entering function ssh_handle_packets line 430 in /usr/developers/root/libssh-0.5.0/src/session.c
[func]  leaving function ssh_handle_packets line 445 in /usr/developers/root/libssh-0.5.0/src/session.c
[func]  entering function ssh_handle_packets line 430 in /usr/developers/root/libssh-0.5.0/src/session.c
[func]   entering function ssh_packet_socket_callback line 138 in /usr/developers/root/libssh-0.5.0/src/packet.c
[3] Packet size decrypted: 700 (0x2bc)
[3] Read a 700 bytes packet
[3] 7 bytes padding, 699 bytes left in buffer
[3] After padding, 692 bytes left in buffer
[func]    entering function ssh_packet_parse_type line 404 in /usr/developers/root/libssh-0.5.0/src/packet.c
[3] Final size 692
[3] Type 20
[func]    leaving function ssh_packet_parse_type line 424 in /usr/developers/root/libssh-0.5.0/src/packet.c
[func]    entering function ssh_packet_process line 340 in /usr/developers/root/libssh-0.5.0/src/packet.c
[3] Dispatching handler for packet type 20
[func]     entering function ssh_packet_kexinit line 256 in /usr/developers/root/libssh-0.5.0/src/kex.c
[func]     leaving function ssh_packet_kexinit line 329 in /usr/developers/root/libssh-0.5.0/src/kex.c
[func]     entering function ssh_client_connection_callback line 491 in /usr/developers/root/libssh-0.5.0/src/client.c
[func]      kex algos: diffie-hellman-group-exchange-sha1,diffie-hellman-group14-sha1,diffie-hellman-group1-sha1
[func]      server host key algo: ssh-rsa,ssh-dss
[func]      encryption client->server: aes128-cbc,3des-cbc,blowfish-cbc,cast128-cbc,arcfour128,arcfour256,arcfour,aes192-cbc,aes256-cbc,rijndael-cbc@...,aes128-ctr,aes192-ctr,aes256-ctr
[func]      encryption server->client: aes128-cbc,3des-cbc,blowfish-cbc,cast128-cbc,arcfour128,arcfour256,arcfour,aes192-cbc,aes256-cbc,rijndael-cbc@...,aes128-ctr,aes192-ctr,aes256-ctr
[func]      mac algo client->server: hmac-md5,hmac-sha1,hmac-ripemd160,hmac-ripemd160@...,hmac-sha1-96,hmac-md5-96
[func]      mac algo server->client: hmac-md5,hmac-sha1,hmac-ripemd160,hmac-ripemd160@...,hmac-sha1-96,hmac-md5-96
[func]      compression algo client->server: none,zlib@...
[func]      compression algo server->client: none,zlib@...
[func]      languages client->server: 
[func]      languages server->client: 
[func]      entering function set_kex line 369 in /usr/developers/root/libssh-0.5.0/src/kex.c
[func]      leaving function set_kex line 397 in /usr/developers/root/libssh-0.5.0/src/kex.c
[func]      entering function ssh_send_kex line 407 in /usr/developers/root/libssh-0.5.0/src/kex.c
[func]       kex algos: diffie-hellman-group1-sha1
[func]       server host key algo: ssh-rsa
[func]       encryption client->server: aes256-ctr
[func]       encryption server->client: aes256-ctr
[func]       mac algo client->server: hmac-sha1
[func]       mac algo server->client: hmac-sha1
[func]       compression algo client->server: none
[func]       compression algo server->client: none
[func]       languages client->server: 
[func]       languages server->client: 
[func]       entering function packet_send2 line 454 in /usr/developers/root/libssh-0.5.0/src/packet.c
[3] Writing on the wire a packet having 141 bytes before
[3] 141 bytes after comp + 6 padding bytes = 148 bytes packet
[func]        entering function ssh_packet_write line 435 in /usr/developers/root/libssh-0.5.0/src/packet.c
[func]         entering function ssh_socket_write line 584 in /usr/developers/root/libssh-0.5.0/src/socket.c
[func]          entering function ssh_socket_nonblocking_flush line 606 in /usr/developers/root/libssh-0.5.0/src/socket.c
[3] Enabling POLLOUT for socket
[func]          leaving function ssh_socket_nonblocking_flush line 652 in /usr/developers/root/libssh-0.5.0/src/socket.c
[func]         leaving function ssh_socket_write line 592 in /usr/developers/root/libssh-0.5.0/src/socket.c
[func]        leaving function ssh_packet_write line 440 in /usr/developers/root/libssh-0.5.0/src/packet.c
[func]       leaving function packet_send2 line 515 in /usr/developers/root/libssh-0.5.0/src/packet.c
[func]      leaving function ssh_send_kex line 449 in /usr/developers/root/libssh-0.5.0/src/kex.c
[func]      entering function dh_handshake line 326 in /usr/developers/root/libssh-0.5.0/src/client.c
[func]       entering function packet_send2 line 454 in /usr/developers/root/libssh-0.5.0/src/packet.c
[3] Writing on the wire a packet having 6 bytes before
[3] 6 bytes after comp + 5 padding bytes = 12 bytes packet
[func]        entering function ssh_packet_write line 435 in /usr/developers/root/libssh-0.5.0/src/packet.c
[func]         entering function ssh_socket_write line 584 in /usr/developers/root/libssh-0.5.0/src/socket.c
[func]          entering function ssh_socket_nonblocking_flush line 606 in /usr/developers/root/libssh-0.5.0/src/socket.c
[func]          leaving function ssh_socket_nonblocking_flush line 623 in /usr/developers/root/libssh-0.5.0/src/socket.c
[func]         leaving function ssh_socket_write line 592 in /usr/developers/root/libssh-0.5.0/src/socket.c
[func]        leaving function ssh_packet_write line 440 in /usr/developers/root/libssh-0.5.0/src/packet.c
[func]       leaving function packet_send2 line 515 in /usr/developers/root/libssh-0.5.0/src/packet.c
[func]      leaving function dh_handshake line 375 in /usr/developers/root/libssh-0.5.0/src/client.c
[func]     leaving function ssh_client_connection_callback line 584 in /usr/developers/root/libssh-0.5.0/src/client.c
[func]    leaving function ssh_packet_process line 367 in /usr/developers/root/libssh-0.5.0/src/packet.c
[func]   leaving function ssh_packet_socket_callback line 280 in /usr/developers/root/libssh-0.5.0/src/packet.c
[func]  leaving function ssh_handle_packets line 445 in /usr/developers/root/libssh-0.5.0/src/session.c
[func]  entering function ssh_handle_packets line 430 in /usr/developers/root/libssh-0.5.0/src/session.c
[func]   entering function ssh_socket_nonblocking_flush line 606 in /usr/developers/root/libssh-0.5.0/src/socket.c
[3] Enabling POLLOUT for socket
[func]   leaving function ssh_socket_nonblocking_flush line 652 in /usr/developers/root/libssh-0.5.0/src/socket.c
[func]  leaving function ssh_handle_packets line 445 in /usr/developers/root/libssh-0.5.0/src/session.c
[func]  entering function ssh_handle_packets line 430 in /usr/developers/root/libssh-0.5.0/src/session.c
[func]  leaving function ssh_handle_packets line 445 in /usr/developers/root/libssh-0.5.0/src/session.c
[func]  entering function ssh_handle_packets line 430 in /usr/developers/root/libssh-0.5.0/src/session.c
[func]   entering function ssh_packet_socket_callback line 138 in /usr/developers/root/libssh-0.5.0/src/packet.c
[3] Packet size decrypted: 44 (0x2c)
[3] Read a 44 bytes packet
[3] 4 bytes padding, 43 bytes left in buffer
[3] After padding, 39 bytes left in buffer
[func]    entering function ssh_packet_parse_type line 404 in /usr/developers/root/libssh-0.5.0/src/packet.c
[3] Final size 39
[3] Type 1
[func]    leaving function ssh_packet_parse_type line 424 in /usr/developers/root/libssh-0.5.0/src/packet.c
[func]    entering function ssh_packet_process line 340 in /usr/developers/root/libssh-0.5.0/src/packet.c
[3] Dispatching handler for packet type 1
[3] Received SSH_MSG_DISCONNECT 33554432:bad client public DH value
[1] Error : Received SSH_MSG_DISCONNECT: 33554432:bad client public DH value
[func]    leaving function ssh_packet_process line 367 in /usr/developers/root/libssh-0.5.0/src/packet.c
[func]   leaving function ssh_packet_socket_callback line 280 in /usr/developers/root/libssh-0.5.0/src/packet.c
[func]  leaving function ssh_handle_packets line 445 in /usr/developers/root/libssh-0.5.0/src/session.c
[3] ssh_connect: Actual state : 9
[func] leaving function ssh_connect line 705 in /usr/developers/root/libssh-0.5.0/src/client.c
[func] entering function ssh_free line 160 in /usr/developers/root/libssh-0.5.0/src/session.c

Gmane