0 votes
by (120 points)
edited

We are using the SFTP class. We can make a connection but it seems to fail when we login and throws the exception SshException "Error while sending packet". Below is part of the log file. Any ideas?

2012-03-08 15:38:21 VERBOSE Sftp(1)[9] SSH: Sending packet SSH_MSG_CHANNEL_OPEN (24 bytes). 0000 |5A-00-00-00-07-73-65-73 73-69-6F-6E-00-00-00-00| Z....session.... 0010 |00-02-00-00-00-00-40-00 | ......@. 2012-03-08 15:38:21 VERBOSE Sftp(1)[9] SSH: Received packet SSH_MSG_CHANNEL_OPEN_CONFIRMATION (17 bytes). 0000 |5B-00-00-00-00-00-00-00 00-FF-FF-FF-FF-00-00-80| [............... 0010 |00 | . 2012-03-08 15:38:21 DEBUG Sftp(1)[9] SSH: Requesting subsystem 'sftp'. 2012-03-08 15:38:21 VERBOSE Sftp(1)[9] SSH: Sending packet SSH_MSG_CHANNEL_REQUEST (27 bytes). 0000 |62-00-00-00-00-00-00-00 09-73-75-62-73-79-73-74| b........subsyst 0010 |65-6D-01-00-00-00-04-73 66-74-70 | em.....sftp 2012-03-08 15:38:21 VERBOSE Sftp(1)[9] SSH: Received packet SSH_MSG_CHANNEL_SUCCESS (5 bytes). 0000 |63-00-00-00-00 | c.... 2012-03-08 15:38:21 ERROR Sftp(1)[9] SSH: Rebex.Net.SshException: Error while sending packet. ---> Rebex.Net.SshException: Error while sending packet. ---> System.ArgumentOutOfRangeException: Non-negative number required. Parameter name: count at System.IO.MemoryStream.Write(Byte[] buffer, Int32 offset, Int32 count) at gbMKS.1dRwomZ.1O8lJW(u3MGF , Byte[] , Int32 , Int32 , Boolean ) at gbMKS.LR0XGZ.1O8lJW(u3MGF ) at Rebex.Net.SshSession.1v2EEi(1dRwomZ , Boolean ) --- End of inner exception stack trace ---

Applies to: Rebex SFTP
by (148k points)
edited

This looks like a very strange issue - after carefully analyzing our code, it seems that this can only occur if a MemoryStream's Length property returns a value less than 4 even though at least 4 bytes were written to it. I will send you a link to a build of Rebex SFTP that adds additional logging messages, hopefully making it possible to tell what is going on.

1 Answer

0 votes
by (148k points)
edited

This was caused by a bug in Rebex SFTP caused by incorrect handling of uint as int. It only manifested itself with SFTP/SSH servers which use very large SSH channel window sizes (this is quite rare). We have already fixed this in the Rebex SFTP / Rebex SSH Shell 2012 R2.

...