Commit Graph

1147 Commits

Author SHA1 Message Date
Gert Driesen e434f97be5 Renamed Quote transformation and corresponding class to ShellQuote.
Added DoubleQuote transformation.
Modified default remote path transformation for ScpClient to DoubleQuote.
2017-09-04 18:45:23 +02:00
Gert Driesen 7dde512a9c Add a RemotePathTransformation property to ScpClient that can be used to control if and how a remote path should be transformed before passed on to the scp command.
This allows for a custom transformation (escaping/quoting) - that implements IRemotePathTransformation - to be plugged into ScpClient.

Out of the box, we only provide two implementations that are exposed through the RemotePathTransformation (enum-like) class: Quote and None.

Fixes issue #256.
2017-08-27 18:48:51 +02:00
Gert Driesen 5128b16778 Merge branch 'develop' of https://github.com/sshnet/SSH.NET into develop 2017-08-27 16:20:19 +02:00
Gert Driesen 0e2d0dc25d Sync project file. 2017-08-27 16:19:59 +02:00
Gert Driesen 127e3f6591 Throw an SshException when SCP request is rejected by the remote host. 2017-08-27 16:18:47 +02:00
Gert Driesen 9df22e349f Move UploadTime to ScpClient.NET.cs, and sync legacy project files. 2017-08-27 16:18:47 +02:00
Gert Driesen 266dbaefe6 Pass full remote file path to scp command when uploading or downloading a file, and use zero-length pass in C directive. Combined, this ensure the SCP server will reject a remote file path that points to a directory.
Fixes issue #286.
2017-08-27 16:18:47 +02:00
Gert Driesen 0f6bc56b4a Throw an SshException when SCP request is rejected by the remote host. 2017-08-27 16:15:49 +02:00
Gert Driesen 4a031e08ce Merge pull request #288 from sshnet/issue286
ScpClient: Upload of file should fail if remote path exists as directory
2017-08-27 14:18:21 +02:00
Gert Driesen 84f3a28018 Move UploadTime to ScpClient.NET.cs, and sync legacy project files. 2017-08-27 09:29:37 +02:00
Gert Driesen b70e21801e Pass full remote file path to scp command when uploading or downloading a file, and use zero-length pass in C directive. Combined, this ensure the SCP server will reject a remote file path that points to a directory.
Fixes issue #286.
2017-08-27 08:59:26 +02:00
Gert Driesen 2d840aab35 Update tests after quoting fixes. 2017-08-22 19:50:15 +02:00
Gert Driesen 6184a0e826 ScpClient: Implement proper quoting of paths.
Fixes issue #256.
2017-08-22 19:14:44 +02:00
Gert Driesen 522ed129b2 Fix SL and WP compile. 2017-08-22 18:32:57 +02:00
Gert Driesen bd801990d5 Only use methods available in .NET 3.5 (and higher). 2017-08-22 18:31:58 +02:00
Gert Driesen 0a1a031fc1 Add support for non-ascii characters to ScpClient.
Fixes issue #281.
2017-08-22 18:19:29 +02:00
Gert Driesen 87a45a8f52 Move past beta2. 2017-08-16 20:52:17 +02:00
Gert Driesen b34e1c05a4 Do not set DEBUG and TRACE for Release config. 2017-08-16 18:58:24 +02:00
Gert Driesen 8f777f1fc7 SftpClient: Document that the following overloads create the specified file if it does not already exist:
AppendAllLines
AppendAllText
AppendText
2017-08-16 10:36:07 +02:00
Gert Driesen 1b21b6dd14 To improve compatibility of SftpClient with System.IO.File, the following methods now use UTF-8 encoding without a Byte-Order Mark (BOM):
void AppendAllLines(string path, IEnumerable<string> contents)
void AppendAllText(string path, string contents)
StreamWriter AppendText(string path)
StreamWriter CreateText(string path)
void WriteAllLines(string path, IEnumerable<string> contents)
void WriteAllLines(string path, string[] contents)
void WriteAllText(string path, string contents)
2017-08-16 10:31:10 +02:00
Gert Driesen 79c9a4baea SftpFileStream: Position in stream should be left untouched when clearing read buffer. 2017-08-16 08:56:33 +02:00
Gert Driesen 68c1e59920 Merge pull request #272 from sshnet/sftpclient-setlength
SftpFileStream: Improve SetLength(long) compatibility with FileStream
2017-08-14 20:54:38 +02:00
Gert Driesen 30054463e1 Sync project file. 2017-08-14 20:35:21 +02:00
Gert Driesen 9444f21461 Added more tests for SftpFileStream.SetLength(long). 2017-08-14 20:23:01 +02:00
Gert Driesen 7bc67f3aca Harden tests. 2017-08-13 21:36:55 +02:00
Gert Driesen 48205c7f6d Improve SetLength compatibility with FileStream:
* Flush any buffers before epand or shrink the stream.
* If the specified value is less than the current length of the stream, the current position is moved to the last byte of the stream.
2017-08-13 15:05:44 +02:00
Gert Driesen f38c7ce3af SftpFileStream: In Append mode, create the remote file if it does not already exist.
SftpFileStream: In Append mode, create the remote file if it does not
already exist.
Fixes issue #266.
2017-08-13 13:41:33 +02:00
Gert Driesen c2552e4e4b SftpFileStream:
Only allow Append mode when combined with write-only access.
Fixes issue #267.
2017-08-13 13:41:33 +02:00
Gert Driesen ea36b240aa Reduce allocations. 2017-08-13 13:41:33 +02:00
Gert Driesen b4841baa10 Do not create a List. 2017-08-13 13:41:33 +02:00
Gert Driesen e30319a848 Sync project files. 2017-08-06 22:06:02 +02:00
Gert Driesen 36f94c26cc Move StatVfsResponse to tests. 2017-08-06 21:54:59 +02:00
Gert Driesen b548622524 Rename (I)SftpMessageFactory to (I)SftpResponseFactory. 2017-08-06 20:11:09 +02:00
Gert Driesen e2cf28a28d Remove Encoding from SubsystemSession and NetConfSession, and move it to SftpSession (as it is only used there).
Refactor creation of SFTP response messages to a SftpResponseFactory.
Implement SaveData for a few SFTP response messages.
2017-08-06 18:33:28 +02:00
Gert Driesen 9ecfa0d38c Refactor loading of a response to an extended request (SSH_FXP_EXTENDED):
Continue reading from SshDataStream instead of creating new instance for type specific part.
2017-08-06 18:22:44 +02:00
Gert Driesen 3e1dd2d345 Added CryptoAbstraction.GenerateRandom(int length) method. 2017-08-06 17:54:47 +02:00
Gert Driesen f90131229a Fix doc. 2017-07-30 13:56:48 +02:00
Gert Driesen 216f364587 Update comments. 2017-07-30 13:55:54 +02:00
Gert Driesen 385b8a6c28 Increase initial window size for SSH channels from 2 MB to 2147483647 (2^31 - 1) bytes. 2017-07-29 15:29:47 +02:00
Gert Driesen cc04517efd Use BE methods on Pack. 2017-07-29 11:04:37 +02:00
Gert Driesen 7c05bd19ba Increase max. SSH packet size back to 68536 (64 KB + 3000). 2017-07-23 21:54:58 +02:00
Gert Driesen ea47d9db98 Fix xml doc. 2017-07-23 20:45:23 +02:00
Gert Driesen e86fd18b21 Limit size of SSH packet to 35.000 bytes.
Improve documentation of LocalChannelDataPacketSize.
2017-07-23 20:43:11 +02:00
Gert Driesen fa640e12a5 Improve documentation of LocalPacketSize. 2017-07-23 20:41:54 +02:00
Gert Driesen 46966d37cb Precise that we only support SSH-2. 2017-07-21 14:23:30 +02:00
Gert Driesen a9a38d7e94 Merge pull request #199 from sshnet/sftpfilestream
SftpFileStream: No longer track write position separately
2017-07-16 23:25:37 +02:00
Gert Driesen 55e31b1e7b Sync project file 2017-07-16 22:03:06 +02:00
Gert Driesen bfc52294da Merge remote-tracking branch 'refs/remotes/origin/develop' into sftpfilestream 2017-07-16 21:59:35 +02:00
Gert Driesen 17a9c61464 Use langversion 5 for .NET Core project. 2017-07-16 20:06:53 +02:00
Gert Driesen b680765692 Add comment to clarify that StreamReader uses a buffer size of 1024 bytes. 2017-07-16 20:06:12 +02:00