Ticket #108 (closed defect)
libssh2_channel_write with blocks >=16k cause corrupted MAC
|Reported by:||anonymous||Owned by:||bagder|
When I use libssh2_channel_write(), e. g. the example scp_write.c, with a block size of more than 10k some data is transmitted, but then suddenly after around
64k libssh2_channel_write() report the return code -1 and the error message says "Unable to send data". I traced it back to the call of send() which report EPIPE. On the remote side I see in the sshd-log:
sshd: Disconnecting: Corrupted MAC on input.
Thus is looks like the remote ssh-server cannot process the data send via libssh2 and close the connection.
This problem only occur when I use a block size of >10k (libssh2 v1.1), but the limit may depend. If I add some debug output it looks like other block sizes may work or not work, too. This problem looks like a race-condition.
Note: with libssh2 v0.18 this problem did not occur! I detected the problem when I switchedn from libssh2 v0.18 to v1.1 and an application with uses libssh2. After installation of the new libssh2 library the application could not send any data anymore. With libssh v0.18 the application still work well.