Hi,
I think I have found an issue with libssh2_channel_write_ex. It seems
like it can return LIBSSH2_ERROR_EAGAIN when it actually successfully
wrote bytes to the socket. I suspect this happens when the send() call
returns a value greater than 0 but less than the buffer length.
I modified the ssh2_exec.c example to reproduce the problem. The
attached example will execute 'cat' and then in a poll loop write 1.5 MB
(using a bufsize of 32K) to stdin and read the reply from stdout. If the
number bytes read is different from the number of bytes written, it will
call exit(1). The problem is not deterministically reproducible, but the
following command line
while :; do ./ssh2_echo 127.0.0.1 user password || break; done
terminates after a few seconds on my machine.
I have tested this against the latest git code. After having looked at
the code, I suspect the issue exists in 1.2.7 too but is harder to
trigger.
Regards,
Tommy
_______________________________________________
libssh2-devel http://cool.haxx.se/cgi-bin/mailman/listinfo/libssh2-devel