Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/duplicati/duplicati.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTyler Gill <tyler.gill@byu.net>2017-09-19 08:23:45 +0300
committerTyler Gill <tyler.gill@byu.net>2017-09-19 08:55:08 +0300
commit83a1dcfb64104b51e09f17dcf9237a184f7086aa (patch)
treedbe324fbfeb569b7444edef0c031dc40e9abe85d /Duplicati/Library/Backend/SSHv2/SSHv2Backend.cs
parent3e0aa28c29b2532d679a5d2f946e31bab5e9bde4 (diff)
Replace all instances of InvariantCultureIgnoreCase with OrdinalIgnoreCase in string comparisons.
InvariantCulture is useful when comparing / sorting human language strings in a culturely correct way. It handles things like accented letters in a way that makes sense to humans (e.g., 'a' should be sorted next to 'รก', rather than after 'z'). Ordinal looks just at the raw code points of the characters. As such, it is recommended for use in cases when comparing system strings (file paths, command line parameters, config settings, etc.). Since it doesn't need to use the culture specific sorting rules, this method can often be faster. For more information, see https://stackoverflow.com/questions/492799/difference-between-invariantculture-and-ordinal-string-comparison (and other related questions)
Diffstat (limited to 'Duplicati/Library/Backend/SSHv2/SSHv2Backend.cs')
-rw-r--r--Duplicati/Library/Backend/SSHv2/SSHv2Backend.cs46
1 files changed, 23 insertions, 23 deletions
diff --git a/Duplicati/Library/Backend/SSHv2/SSHv2Backend.cs b/Duplicati/Library/Backend/SSHv2/SSHv2Backend.cs
index e6c0db9e7..d32958872 100644
--- a/Duplicati/Library/Backend/SSHv2/SSHv2Backend.cs
+++ b/Duplicati/Library/Backend/SSHv2/SSHv2Backend.cs
@@ -34,10 +34,10 @@ namespace Duplicati.Library.Backend
public const string SSH_FINGERPRINT_OPTION = "ssh-fingerprint";
public const string SSH_FINGERPRINT_ACCEPT_ANY_OPTION = "ssh-accept-any-fingerprints";
public const string KEYFILE_URI = "sshkey://";
- public const string SSH_TIMEOUT_OPTION = "ssh-operation-timeout";
- public const string SSH_KEEPALIVE_OPTION = "ssh-keepalive";
-
- Dictionary<string, string> m_options;
+ public const string SSH_TIMEOUT_OPTION = "ssh-operation-timeout";
+ public const string SSH_KEEPALIVE_OPTION = "ssh-keepalive";
+
+ Dictionary<string, string> m_options;
private string m_server;
private string m_path;
@@ -45,10 +45,10 @@ namespace Duplicati.Library.Backend
private string m_password;
private string m_fingerprint;
private bool m_fingerprintallowall;
- private TimeSpan m_operationtimeout;
- private TimeSpan m_keepaliveinterval;
-
- private int m_port = 22;
+ private TimeSpan m_operationtimeout;
+ private TimeSpan m_keepaliveinterval;
+
+ private int m_port = 22;
private SftpClient m_con;
@@ -93,14 +93,14 @@ namespace Duplicati.Library.Backend
options.TryGetValue(SSH_TIMEOUT_OPTION, out timeoutstr);
if (!string.IsNullOrWhiteSpace(timeoutstr))
- m_operationtimeout = Library.Utility.Timeparser.ParseTimeSpan(timeoutstr);
-
- options.TryGetValue(SSH_KEEPALIVE_OPTION, out timeoutstr);
-
- if (!string.IsNullOrWhiteSpace(timeoutstr))
- m_keepaliveinterval = Library.Utility.Timeparser.ParseTimeSpan(timeoutstr);
-
- }
+ m_operationtimeout = Library.Utility.Timeparser.ParseTimeSpan(timeoutstr);
+
+ options.TryGetValue(SSH_KEEPALIVE_OPTION, out timeoutstr);
+
+ if (!string.IsNullOrWhiteSpace(timeoutstr))
+ m_keepaliveinterval = Library.Utility.Timeparser.ParseTimeSpan(timeoutstr);
+
+ }
#region IBackend Members
@@ -166,10 +166,10 @@ namespace Duplicati.Library.Backend
new CommandLineArgument(SSH_FINGERPRINT_OPTION, CommandLineArgument.ArgumentType.String, Strings.SSHv2Backend.DescriptionFingerprintShort, Strings.SSHv2Backend.DescriptionFingerprintLong),
new CommandLineArgument(SSH_FINGERPRINT_ACCEPT_ANY_OPTION, CommandLineArgument.ArgumentType.Boolean, Strings.SSHv2Backend.DescriptionAnyFingerprintShort, Strings.SSHv2Backend.DescriptionAnyFingerprintLong),
new CommandLineArgument(SSH_KEYFILE_OPTION, CommandLineArgument.ArgumentType.Path, Strings.SSHv2Backend.DescriptionSshkeyfileShort, Strings.SSHv2Backend.DescriptionSshkeyfileLong),
- new CommandLineArgument(SSH_KEYFILE_INLINE, CommandLineArgument.ArgumentType.Password, Strings.SSHv2Backend.DescriptionSshkeyShort, Strings.SSHv2Backend.DescriptionSshkeyLong(KEYFILE_URI)),
- new CommandLineArgument(SSH_TIMEOUT_OPTION, CommandLineArgument.ArgumentType.Timespan, Strings.SSHv2Backend.DescriptionSshtimeoutShort, Strings.SSHv2Backend.DescriptionSshtimeoutLong, "0"),
+ new CommandLineArgument(SSH_KEYFILE_INLINE, CommandLineArgument.ArgumentType.Password, Strings.SSHv2Backend.DescriptionSshkeyShort, Strings.SSHv2Backend.DescriptionSshkeyLong(KEYFILE_URI)),
+ new CommandLineArgument(SSH_TIMEOUT_OPTION, CommandLineArgument.ArgumentType.Timespan, Strings.SSHv2Backend.DescriptionSshtimeoutShort, Strings.SSHv2Backend.DescriptionSshtimeoutLong, "0"),
new CommandLineArgument(SSH_KEEPALIVE_OPTION, CommandLineArgument.ArgumentType.Timespan, Strings.SSHv2Backend.DescriptionSshkeepaliveShort, Strings.SSHv2Backend.DescriptionSshkeepaliveLong, "0"),
- });
+ });
}
}
@@ -281,9 +281,9 @@ namespace Duplicati.Library.Backend
};
if (m_operationtimeout.Ticks != 0)
- con.OperationTimeout = m_operationtimeout;
- if (m_keepaliveinterval.Ticks != 0)
- con.KeepAliveInterval = m_keepaliveinterval;
+ con.OperationTimeout = m_operationtimeout;
+ if (m_keepaliveinterval.Ticks != 0)
+ con.KeepAliveInterval = m_keepaliveinterval;
con.Connect();
@@ -331,7 +331,7 @@ namespace Duplicati.Library.Backend
public static Renci.SshNet.PrivateKeyFile ValidateKeyFile(string filename, string password)
{
- if (filename.StartsWith(KEYFILE_URI, StringComparison.InvariantCultureIgnoreCase))
+ if (filename.StartsWith(KEYFILE_URI, StringComparison.OrdinalIgnoreCase))
{
using (var ms = new System.IO.MemoryStream())
using (var sr = new System.IO.StreamWriter(ms))