Commit Graph

497 Commits

Author SHA1 Message Date
Gert Driesen 45f99561b4 Channel:
* Improve robustness of channels by not letting an exception - that occurs while processing events signaled by session - up to session where this would cause the message loop to interrupt, and hence the SSH client would be disconnected.
  Instead, exceptions that are thrown during processing of session events are now signaled using a new Exception event.
* Renamed RequestSuccessed event to RequestSucceeded, fixing a typo.

ChannelDirectTcpip:
* Interrupt blocking receive when forwarded port is closing allowing for a clean close of the channel.
* Send SSH_MSG_CHANNEL_EOF to server when client quits sending data.

ChannelForwardedTcpip:
* Interrupt blocking receive when forwarded port is closing or when an error occurs in the session allowing for a clean close of the channel.

ForwardedPortDynamic:
* When stopping the port, signal all channels that the port is closing and wait for the channels to close.
* Modify Start() and Stop() to throw ObjectDisposedException when instance is disposed.
* Modify Dispose() to also interrupt blocking receive and wait for the channels to close.
* Fixed IPv6 support for SOCKS5.
* Signal exceptions in channels using the Exception event on the forwarded port.

ForwardedPortLocal:
* When stopping the port, signal all channels that the port is closing and wait for the channels to close.
* Modify Start() and Stop() to throw ObjectDisposedException when instance is disposed.
* Modify Dispose() to also interrupt blocking receive and wait for the channels to close.
* Signal exceptions in channels using the Exception event on the forwarded port.

ForwardedPortRemote:
* When stopping the port, cancel the tcpip-forward, interrupt pending channels and for the channels to close.
* Modify Start() and Stop() to throw ObjectDisposedException when instance is disposed.
* Modify Dispose() to also cancel the tcpip-forward, interrupt pending channels and for the channels to close.
* Signal exceptions in channels using the Exception event on the forwarded port.

Overall:
* Add huge set of unit tests for channels and forwarded ports.
2014-11-07 19:07:14 +00:00
Gert Driesen a0bc7f61a5 Document fix for issue #1558. 2014-10-26 19:10:28 +00:00
Gert Driesen 00ed218425 Added internal IForwardPort interface to allow mocking of forwarded ports.
Added internal IChannelDirectTcpip and IChannelForwardedTcpip interfaces.
Extended ISession and IConnection interface to allow for unit tests of ChannelDirectTcpip.

Modified ChannelDirectTcpip to interrupt blocking receive when the ForwardedPort is closed.
Shutdown send of socket when EOF is received.
Close the socket when unhandled exception occurs in session message loop, and when server terminates connection using SSH_MSG_DISCONNECT message.
Fixes issue #1558.

When stopping ForwardedLocalPort, block until all channels have been closed or until Connection.Timeout has elapsed.
2014-10-26 19:06:58 +00:00
Gert Driesen ba309fc716 Modify accessiblity of Authenticate to internal, and modify IsAuthenticated depending on the outcome of the authentication. 2014-10-26 07:51:41 +00:00
Gert Driesen 3bfd1fbef1 Include signing key in source download.
Fixes issue #2455.
2014-10-19 15:09:49 +00:00
Gert Driesen 542b2f80ba Added SftpClientTest.Connect.cs to test project for .NET 3.5.
Do not use TPL to allow tests to work on .NET 3.5.
2014-10-19 14:40:46 +00:00
Gert Driesen 6423b7e0a0 Make internal methods available to castle proxies. 2014-10-19 14:38:41 +00:00
Gert Driesen 446354ed6b Document fix for issue #1845. 2014-10-19 14:25:15 +00:00
Gert Driesen 23a178f7aa Document exceptions for ConnectionInfo constructors.
Improve exception messages for argument checks.
Only perform null argument check for hosts. Fixes issue #1845.
2014-10-19 14:17:56 +00:00
Gert Driesen acaae44836 Fix exception documentation for BaseClient.Connect() and Session.Connect().
Added SftpPathNotFoundException to doc for SftpClient.Get(String) and SftpClient.GetAttributes(String).
Do not throw exception in Session.Disconnect() and Session.Dispose() when socket is not connected.
Fixes issue #2148.
2014-10-19 11:14:50 +00:00
Gert Driesen 8678d087d9 Modify ShellStream.ReadLine() to take into account multi-byte character.
Fixes issue #2190.
Modify ShellStream.Write(string) to write nothing when text is null.
Added unit tests.
2014-10-18 17:40:58 +00:00
Gert Driesen 60c46ce3fd Improve doc. 2014-10-18 11:54:42 +00:00
Gert Driesen 764296f9ed Fix some R# warnings, and modify ReadLine to use use ordinal comparison for IndexOf. 2014-10-18 11:33:26 +00:00
Gert Driesen 38f6ea32e5 Fix unsubscribe from channel events. 2014-10-13 18:48:16 +00:00
Gert Driesen a161d1b28e Unsubscribe from events before we dispose the channel, as we do not want to get these events signaled while disposing. 2014-10-12 19:05:51 +00:00
Gert Driesen 7909033f47 Remove unnecessary assembly references. 2014-10-12 18:44:12 +00:00
Gert Driesen af7a3b89f5 Fixed typo in xml doc. 2014-10-12 18:29:28 +00:00
Gert Driesen b40adc2f40 For now, remove SocketRead overload that takes timeout as on .NET do not support this yet.
Document fix for issue #1935 and #2223.
2014-10-12 08:19:03 +00:00
Gert Driesen e76c06251d Fix lots of issues in Silverlight socket methods.
Fix SocketReadLine (in both .NET and Silverlight) to return null when remote server has shut down the socket.
Skip any lines in response from SSH server before the protocol identification string.
Fixes issue #2223.
2014-10-12 07:56:28 +00:00
Gert Driesen 7a9ba8da32 Signal Connected event when a client established a connection to the listener. 2014-10-12 07:44:55 +00:00
Gert Driesen ff3bf965c6 Avoid code duplication.
Use Session.SilverlightShared from Silverlight (v4) project.
2014-10-12 07:38:40 +00:00
Gert Driesen c3350803bf Fix R# warnings. 2014-10-12 07:36:01 +00:00
Gert Driesen 4c1d8d8a95 Added new interfaces to Silverlight and WP project files. 2014-10-11 11:29:42 +00:00
Gert Driesen e79b567365 Dispose channel on EndExecute. Fixes issue #2295.
Add encoding argument to SshCommand ctor.
2014-10-11 11:20:26 +00:00
Gert Driesen 965a0ba4c7 Introduce IChannel and IChannelSession interface to allow for unit testing. 2014-10-11 10:40:08 +00:00
Gert Driesen 67a0242dc0 Document fix for issue #2399. 2014-10-11 10:20:48 +00:00
Gert Driesen c270662690 Added ClientAuthentication and newly introduced interfaces to remaining projects. 2014-10-06 18:29:18 +00:00
Gert Driesen 2427090ecb Added ISession, IAuthenticationMethod and IConnectionInfo interfaces to allow mocking.
Extracted authentication logic into ClientAuthentication class to allow improve testabiity.
When a given authentication method has already been authenticated against, then skip the method if there are still alternative authentication methods.
Fixes issue #2399.
Added test for several authentication scenarios.

Part 2 to come where new interfaces will be added to other projects.
2014-10-06 18:24:20 +00:00
Gert Driesen 889184a11a Added ChannelDirectTcpip.SilverlightShared.cs to SL projecT. 2014-10-06 17:43:09 +00:00
Gert Driesen 2d06002ef7 Add WaitOnHandle overload that takes the time to wait for any of the handles to become signaled. 2014-10-06 17:15:25 +00:00
Gert Driesen acaab92df9 Add draft of ChannelDirectTcpip for Silverlight. 2014-10-06 17:01:24 +00:00
Gert Driesen d2e394430f Use SilverlightShared version of classes from Silverlight.
Remove unused imports.
2014-10-06 16:04:23 +00:00
Gert Driesen dc011ae0de Minor correction to docs.
Improved exception messages.
Avoid race condition when raising events.
2014-05-15 19:14:51 +00:00
Gert Driesen 9e52280d38 Document fix for issues #1942 and #1944. 2014-05-08 19:07:21 +00:00
Gert Driesen c7787a5783 Fix some minor warnings, and code formatting. 2014-05-07 19:40:56 +00:00
Gert Driesen e1c620bfd2 Avoid initializing HostKeyEventArgs when there are no event handlers registered. 2014-05-07 19:11:04 +00:00
Gert Driesen ac180a580a Use lambda expression. 2014-05-07 19:09:56 +00:00
Gert Driesen 8c4e3119ef Support an acceptable group of up to 8192 bits for SHA-1 and SHA-256 Diffie-Hellman Group and Key Exchange (issue #1973 and #1777), and refactor corresponding classes to avoid code duplication. 2014-05-07 18:21:30 +00:00
Gert Driesen 57496a4f3f Remove nullOnError argument for RequestFStat and RequestLStat as it was never used. 2014-05-04 19:27:37 +00:00
Gert Driesen a50a5ec8ec Document SftpPathNotFoundException for Delete overloads.
Fixed a few minor typo's.
2014-05-04 19:26:16 +00:00
Gert Driesen d769506f31 Use SSH_FXP_LSTAT to determine whether a given file or directory exists.
Fixes issues #1952, #1696 and #1574.
2014-05-04 19:05:35 +00:00
Gert Driesen 43836a5b50 Added support for ssh.com private keys.
Fixes issue #1987.
2014-05-02 09:41:41 +00:00
Gert Driesen 78f13742b3 Fixed typo in remarks. 2014-05-02 08:35:34 +00:00
Gert Driesen 2192dc0241 Improved accuracy of IsConnected on .NET. 2014-04-18 18:56:53 +00:00
Gert Driesen 4021d3ce4f Also create source zip file as part of build. 2014-04-18 18:05:20 +00:00
Gert Driesen a22b002dd8 Fix some warnings. 2014-04-18 17:56:33 +00:00
Gert Driesen 172cf7b09c Renamed ChannelAsyncResult.cs to CommandAsyncResult.cs to match name of class.
Removed command argument from CommandAsyncResult as its never used.
2014-04-18 17:55:15 +00:00
Gert Driesen 1858623c96 Remove commented code. 2014-04-17 17:48:56 +00:00
Gert Driesen fa5e42d0ca Removed a few conditions from IsSocketConnected that have been moved to IsConnected. Fixed a few warnings. 2014-04-15 16:29:33 +00:00
Gert Driesen d3f750aa79 Unsubscribe from events before disposing WaitHandles.
This reduces the likelyhood of invoking Set() on a disposed WaitHandle.
Incomplete fix for issues #1944 and #1942 as eventhandlers could still be invoked after unsubscription.
2014-04-10 19:00:40 +00:00