From 7dde512a9ca662d245b90ad87f28d5a981de637f Mon Sep 17 00:00:00 2001 From: Gert Driesen Date: Sun, 27 Aug 2017 18:48:51 +0200 Subject: [PATCH 1/7] 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. --- .../Renci.SshNet.NET35.csproj | 17 +- .../Common/ExtensionsTest_ShellQuote.cs | 9 + src/Renci.SshNet/IRemotePathTransformation.cs | 19 +++ src/Renci.SshNet/IServiceFactory.cs | 10 ++ .../RemotePathNoneTransformation.cs | 20 +++ .../RemotePathQuoteTransformation.cs | 161 ++++++++++++++++++ src/Renci.SshNet/RemotePathTransformation.cs | 83 +++++++++ src/Renci.SshNet/Renci.SshNet.csproj | 4 + src/Renci.SshNet/ScpClient.NET.cs | 8 +- src/Renci.SshNet/ScpClient.cs | 29 +++- src/Renci.SshNet/ServiceFactory.cs | 13 ++ 11 files changed, 366 insertions(+), 7 deletions(-) create mode 100644 src/Renci.SshNet/IRemotePathTransformation.cs create mode 100644 src/Renci.SshNet/RemotePathNoneTransformation.cs create mode 100644 src/Renci.SshNet/RemotePathQuoteTransformation.cs create mode 100644 src/Renci.SshNet/RemotePathTransformation.cs diff --git a/src/Renci.SshNet.NET35/Renci.SshNet.NET35.csproj b/src/Renci.SshNet.NET35/Renci.SshNet.NET35.csproj index ed44fb520..cd6a472ce 100644 --- a/src/Renci.SshNet.NET35/Renci.SshNet.NET35.csproj +++ b/src/Renci.SshNet.NET35/Renci.SshNet.NET35.csproj @@ -308,6 +308,9 @@ IForwardedPort.cs + + IRemotePathTransformation.cs + IServiceFactory.cs @@ -578,6 +581,18 @@ ProxyTypes.cs + + RemotePathEscapeTransformation.cs + + + RemotePathNoneTransformation.cs + + + RemotePathQuoteTransformation.cs + + + RemotePathTransformation.cs + ScpClient.cs @@ -956,7 +971,7 @@ - +