mirror of
https://github.com/sshnet/SSH.NET.git
synced 2026-09-10 01:05:42 +00:00
Enable nullable in ConnectionInfo (#1728)
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
using System;
|
||||
#nullable enable
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Net;
|
||||
@@ -79,7 +80,7 @@ namespace Renci.SshNet
|
||||
/// <summary>
|
||||
/// Gets supported compression algorithms for this connection.
|
||||
/// </summary>
|
||||
public IOrderedDictionary<string, Func<Compressor>> CompressionAlgorithms { get; }
|
||||
public IOrderedDictionary<string, Func<Compressor>?> CompressionAlgorithms { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the supported channel requests for this connection.
|
||||
@@ -129,7 +130,7 @@ namespace Renci.SshNet
|
||||
/// <summary>
|
||||
/// Gets proxy connection host.
|
||||
/// </summary>
|
||||
public string ProxyHost { get; }
|
||||
public string? ProxyHost { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets proxy connection port.
|
||||
@@ -139,12 +140,12 @@ namespace Renci.SshNet
|
||||
/// <summary>
|
||||
/// Gets proxy connection username.
|
||||
/// </summary>
|
||||
public string ProxyUsername { get; }
|
||||
public string? ProxyUsername { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets proxy connection password.
|
||||
/// </summary>
|
||||
public string ProxyPassword { get; }
|
||||
public string? ProxyPassword { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets connection timeout.
|
||||
@@ -219,57 +220,63 @@ namespace Renci.SshNet
|
||||
/// <summary>
|
||||
/// Occurs when authentication banner is sent by the server.
|
||||
/// </summary>
|
||||
public event EventHandler<AuthenticationBannerEventArgs> AuthenticationBanner;
|
||||
public event EventHandler<AuthenticationBannerEventArgs>? AuthenticationBanner;
|
||||
|
||||
/// <summary>
|
||||
/// Gets the current key exchange algorithm.
|
||||
/// </summary>
|
||||
public string CurrentKeyExchangeAlgorithm { get; internal set; }
|
||||
public string? CurrentKeyExchangeAlgorithm { get; internal set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the current server encryption.
|
||||
/// </summary>
|
||||
public string CurrentServerEncryption { get; internal set; }
|
||||
public string? CurrentServerEncryption { get; internal set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the current client encryption.
|
||||
/// </summary>
|
||||
public string CurrentClientEncryption { get; internal set; }
|
||||
public string? CurrentClientEncryption { get; internal set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the current server hash algorithm.
|
||||
/// </summary>
|
||||
public string CurrentServerHmacAlgorithm { get; internal set; }
|
||||
public string? CurrentServerHmacAlgorithm { get; internal set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the current client hash algorithm.
|
||||
/// </summary>
|
||||
public string CurrentClientHmacAlgorithm { get; internal set; }
|
||||
public string? CurrentClientHmacAlgorithm { get; internal set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the current host key algorithm.
|
||||
/// </summary>
|
||||
public string CurrentHostKeyAlgorithm { get; internal set; }
|
||||
public string? CurrentHostKeyAlgorithm { get; internal set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the current server compression algorithm.
|
||||
/// </summary>
|
||||
public string CurrentServerCompressionAlgorithm { get; internal set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the server version.
|
||||
/// </summary>
|
||||
public string ServerVersion { get; internal set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the client version.
|
||||
/// </summary>
|
||||
public string ClientVersion { get; internal set; }
|
||||
public string? CurrentServerCompressionAlgorithm { get; internal set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the current client compression algorithm.
|
||||
/// </summary>
|
||||
public string CurrentClientCompressionAlgorithm { get; internal set; }
|
||||
public string? CurrentClientCompressionAlgorithm { get; internal set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the server version.
|
||||
/// </summary>
|
||||
public string? ServerVersion { get; internal set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the client version.
|
||||
/// </summary>
|
||||
public string ClientVersion
|
||||
{
|
||||
get
|
||||
{
|
||||
return Session.ClientVersionString;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="ConnectionInfo"/> class.
|
||||
@@ -323,7 +330,7 @@ namespace Renci.SshNet
|
||||
/// <exception cref="ArgumentOutOfRangeException"><paramref name="proxyType"/> is not <see cref="ProxyTypes.None"/> and <paramref name="proxyPort" /> is not within <see cref="IPEndPoint.MinPort" /> and <see cref="IPEndPoint.MaxPort" />.</exception>
|
||||
/// <exception cref="ArgumentNullException"><paramref name="authenticationMethods"/> is <see langword="null"/>.</exception>
|
||||
/// <exception cref="ArgumentException">No <paramref name="authenticationMethods"/> specified.</exception>
|
||||
public ConnectionInfo(string host, int port, string username, ProxyTypes proxyType, string proxyHost, int proxyPort, string proxyUsername, string proxyPassword, params AuthenticationMethod[] authenticationMethods)
|
||||
public ConnectionInfo(string host, int port, string username, ProxyTypes proxyType, string? proxyHost, int proxyPort, string? proxyUsername, string? proxyPassword, params AuthenticationMethod[] authenticationMethods)
|
||||
{
|
||||
ArgumentNullException.ThrowIfNull(host);
|
||||
port.ValidatePort();
|
||||
@@ -413,7 +420,7 @@ namespace Renci.SshNet
|
||||
#pragma warning restore SA1107 // Code should not contain multiple statements on one line
|
||||
HostKeyAlgorithms = hostAlgs;
|
||||
|
||||
CompressionAlgorithms = new OrderedDictionary<string, Func<Compressor>>
|
||||
CompressionAlgorithms = new OrderedDictionary<string, Func<Compressor>?>
|
||||
{
|
||||
{ "none", null },
|
||||
{ "zlib@openssh.com", () => new ZlibOpenSsh() },
|
||||
@@ -472,7 +479,7 @@ namespace Renci.SshNet
|
||||
/// </summary>
|
||||
/// <param name="sender">The session in which the banner message was received.</param>
|
||||
/// <param name="e">The banner message.</param>
|
||||
void IConnectionInfoInternal.UserAuthenticationBannerReceived(object sender, MessageEventArgs<BannerMessage> e)
|
||||
void IConnectionInfoInternal.UserAuthenticationBannerReceived(object? sender, MessageEventArgs<BannerMessage> e)
|
||||
{
|
||||
AuthenticationBanner?.Invoke(this, new AuthenticationBannerEventArgs(Username, e.Message.Message, e.Message.Language));
|
||||
}
|
||||
@@ -507,6 +514,6 @@ namespace Renci.SshNet
|
||||
/// <value>
|
||||
/// The logger factory for this connection. If <see langword="null"/> then <see cref="SshNetLoggingConfiguration.LoggerFactory"/> is used.
|
||||
/// </value>
|
||||
public ILoggerFactory LoggerFactory { get; set; }
|
||||
public ILoggerFactory? LoggerFactory { get; set; }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using System;
|
||||
#nullable enable
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
@@ -20,7 +21,7 @@ namespace Renci.SshNet
|
||||
/// <value>
|
||||
/// The logger factory for this connection. If <see langword="null"/> then <see cref="SshNetLoggingConfiguration.LoggerFactory"/> is used.
|
||||
/// </value>
|
||||
public ILoggerFactory LoggerFactory { get; }
|
||||
public ILoggerFactory? LoggerFactory { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the timeout to used when waiting for a server to acknowledge closing a channel.
|
||||
@@ -77,7 +78,7 @@ namespace Renci.SshNet
|
||||
/// <summary>
|
||||
/// Gets proxy connection host.
|
||||
/// </summary>
|
||||
string ProxyHost { get; }
|
||||
string? ProxyHost { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets proxy connection port.
|
||||
@@ -87,12 +88,12 @@ namespace Renci.SshNet
|
||||
/// <summary>
|
||||
/// Gets proxy connection username.
|
||||
/// </summary>
|
||||
string ProxyUsername { get; }
|
||||
string? ProxyUsername { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets proxy connection password.
|
||||
/// </summary>
|
||||
string ProxyPassword { get; }
|
||||
string? ProxyPassword { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the number of retry attempts when session channel creation failed.
|
||||
@@ -113,6 +114,6 @@ namespace Renci.SshNet
|
||||
/// <summary>
|
||||
/// Occurs when authentication banner is sent by the server.
|
||||
/// </summary>
|
||||
event EventHandler<AuthenticationBannerEventArgs> AuthenticationBanner;
|
||||
event EventHandler<AuthenticationBannerEventArgs>? AuthenticationBanner;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using System.Collections.Generic;
|
||||
#nullable enable
|
||||
using System.Collections.Generic;
|
||||
|
||||
using Renci.SshNet.Messages.Authentication;
|
||||
|
||||
@@ -14,7 +15,7 @@ namespace Renci.SshNet
|
||||
/// </summary>
|
||||
/// <param name="sender">The session in which the banner message was received.</param>
|
||||
/// <param name="e">The banner message.</param>
|
||||
void UserAuthenticationBannerReceived(object sender, MessageEventArgs<BannerMessage> e);
|
||||
void UserAuthenticationBannerReceived(object? sender, MessageEventArgs<BannerMessage> e);
|
||||
|
||||
/// <summary>
|
||||
/// Gets the supported authentication methods for this connection.
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using System;
|
||||
#nullable enable
|
||||
using System;
|
||||
|
||||
using Renci.SshNet.Common;
|
||||
|
||||
@@ -14,7 +15,7 @@ namespace Renci.SshNet
|
||||
/// <summary>
|
||||
/// Occurs when server prompts for more authentication information.
|
||||
/// </summary>
|
||||
public event EventHandler<AuthenticationPromptEventArgs> AuthenticationPrompt;
|
||||
public event EventHandler<AuthenticationPromptEventArgs>? AuthenticationPrompt;
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="KeyboardInteractiveConnectionInfo"/> class.
|
||||
@@ -46,7 +47,7 @@ namespace Renci.SshNet
|
||||
/// <param name="proxyType">Type of the proxy.</param>
|
||||
/// <param name="proxyHost">The proxy host.</param>
|
||||
/// <param name="proxyPort">The proxy port.</param>
|
||||
public KeyboardInteractiveConnectionInfo(string host, int port, string username, ProxyTypes proxyType, string proxyHost, int proxyPort)
|
||||
public KeyboardInteractiveConnectionInfo(string host, int port, string username, ProxyTypes proxyType, string? proxyHost, int proxyPort)
|
||||
: this(host, port, username, proxyType, proxyHost, proxyPort, string.Empty, string.Empty)
|
||||
{
|
||||
}
|
||||
@@ -61,7 +62,7 @@ namespace Renci.SshNet
|
||||
/// <param name="proxyHost">The proxy host.</param>
|
||||
/// <param name="proxyPort">The proxy port.</param>
|
||||
/// <param name="proxyUsername">The proxy username.</param>
|
||||
public KeyboardInteractiveConnectionInfo(string host, int port, string username, ProxyTypes proxyType, string proxyHost, int proxyPort, string proxyUsername)
|
||||
public KeyboardInteractiveConnectionInfo(string host, int port, string username, ProxyTypes proxyType, string? proxyHost, int proxyPort, string? proxyUsername)
|
||||
: this(host, port, username, proxyType, proxyHost, proxyPort, proxyUsername, string.Empty)
|
||||
{
|
||||
}
|
||||
@@ -74,7 +75,7 @@ namespace Renci.SshNet
|
||||
/// <param name="proxyType">Type of the proxy.</param>
|
||||
/// <param name="proxyHost">The proxy host.</param>
|
||||
/// <param name="proxyPort">The proxy port.</param>
|
||||
public KeyboardInteractiveConnectionInfo(string host, string username, ProxyTypes proxyType, string proxyHost, int proxyPort)
|
||||
public KeyboardInteractiveConnectionInfo(string host, string username, ProxyTypes proxyType, string? proxyHost, int proxyPort)
|
||||
: this(host, DefaultPort, username, proxyType, proxyHost, proxyPort, string.Empty, string.Empty)
|
||||
{
|
||||
}
|
||||
@@ -88,7 +89,7 @@ namespace Renci.SshNet
|
||||
/// <param name="proxyHost">The proxy host.</param>
|
||||
/// <param name="proxyPort">The proxy port.</param>
|
||||
/// <param name="proxyUsername">The proxy username.</param>
|
||||
public KeyboardInteractiveConnectionInfo(string host, string username, ProxyTypes proxyType, string proxyHost, int proxyPort, string proxyUsername)
|
||||
public KeyboardInteractiveConnectionInfo(string host, string username, ProxyTypes proxyType, string? proxyHost, int proxyPort, string? proxyUsername)
|
||||
: this(host, DefaultPort, username, proxyType, proxyHost, proxyPort, proxyUsername, string.Empty)
|
||||
{
|
||||
}
|
||||
@@ -103,7 +104,7 @@ namespace Renci.SshNet
|
||||
/// <param name="proxyPort">The proxy port.</param>
|
||||
/// <param name="proxyUsername">The proxy username.</param>
|
||||
/// <param name="proxyPassword">The proxy password.</param>
|
||||
public KeyboardInteractiveConnectionInfo(string host, string username, ProxyTypes proxyType, string proxyHost, int proxyPort, string proxyUsername, string proxyPassword)
|
||||
public KeyboardInteractiveConnectionInfo(string host, string username, ProxyTypes proxyType, string? proxyHost, int proxyPort, string? proxyUsername, string? proxyPassword)
|
||||
: this(host, DefaultPort, username, proxyType, proxyHost, proxyPort, proxyUsername, proxyPassword)
|
||||
{
|
||||
}
|
||||
@@ -119,7 +120,7 @@ namespace Renci.SshNet
|
||||
/// <param name="proxyPort">The proxy port.</param>
|
||||
/// <param name="proxyUsername">The proxy username.</param>
|
||||
/// <param name="proxyPassword">The proxy password.</param>
|
||||
public KeyboardInteractiveConnectionInfo(string host, int port, string username, ProxyTypes proxyType, string proxyHost, int proxyPort, string proxyUsername, string proxyPassword)
|
||||
public KeyboardInteractiveConnectionInfo(string host, int port, string username, ProxyTypes proxyType, string? proxyHost, int proxyPort, string? proxyUsername, string? proxyPassword)
|
||||
: base(host, port, username, proxyType, proxyHost, proxyPort, proxyUsername, proxyPassword, new KeyboardInteractiveAuthenticationMethod(username))
|
||||
{
|
||||
foreach (var authenticationMethod in AuthenticationMethods)
|
||||
@@ -131,7 +132,7 @@ namespace Renci.SshNet
|
||||
}
|
||||
}
|
||||
|
||||
private void AuthenticationMethod_AuthenticationPrompt(object sender, AuthenticationPromptEventArgs e)
|
||||
private void AuthenticationMethod_AuthenticationPrompt(object? sender, AuthenticationPromptEventArgs e)
|
||||
{
|
||||
#pragma warning disable MA0091 // Sender should be 'this' for instance events
|
||||
AuthenticationPrompt?.Invoke(sender, e);
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using System;
|
||||
#nullable enable
|
||||
using System;
|
||||
using System.Net;
|
||||
using System.Text;
|
||||
|
||||
@@ -16,7 +17,7 @@ namespace Renci.SshNet
|
||||
/// <summary>
|
||||
/// Occurs when user's password has expired and needs to be changed.
|
||||
/// </summary>
|
||||
public event EventHandler<AuthenticationPasswordChangeEventArgs> PasswordExpired;
|
||||
public event EventHandler<AuthenticationPasswordChangeEventArgs>? PasswordExpired;
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="PasswordConnectionInfo" /> class.
|
||||
@@ -56,7 +57,7 @@ namespace Renci.SshNet
|
||||
/// <param name="proxyType">Type of the proxy.</param>
|
||||
/// <param name="proxyHost">The proxy host.</param>
|
||||
/// <param name="proxyPort">The proxy port.</param>
|
||||
public PasswordConnectionInfo(string host, int port, string username, string password, ProxyTypes proxyType, string proxyHost, int proxyPort)
|
||||
public PasswordConnectionInfo(string host, int port, string username, string password, ProxyTypes proxyType, string? proxyHost, int proxyPort)
|
||||
: this(host, port, username, Encoding.UTF8.GetBytes(password), proxyType, proxyHost, proxyPort, string.Empty, string.Empty)
|
||||
{
|
||||
}
|
||||
@@ -72,7 +73,7 @@ namespace Renci.SshNet
|
||||
/// <param name="proxyHost">The proxy host.</param>
|
||||
/// <param name="proxyPort">The proxy port.</param>
|
||||
/// <param name="proxyUsername">The proxy username.</param>
|
||||
public PasswordConnectionInfo(string host, int port, string username, string password, ProxyTypes proxyType, string proxyHost, int proxyPort, string proxyUsername)
|
||||
public PasswordConnectionInfo(string host, int port, string username, string password, ProxyTypes proxyType, string? proxyHost, int proxyPort, string? proxyUsername)
|
||||
: this(host, port, username, Encoding.UTF8.GetBytes(password), proxyType, proxyHost, proxyPort, proxyUsername, string.Empty)
|
||||
{
|
||||
}
|
||||
@@ -86,7 +87,7 @@ namespace Renci.SshNet
|
||||
/// <param name="proxyType">Type of the proxy.</param>
|
||||
/// <param name="proxyHost">The proxy host.</param>
|
||||
/// <param name="proxyPort">The proxy port.</param>
|
||||
public PasswordConnectionInfo(string host, string username, string password, ProxyTypes proxyType, string proxyHost, int proxyPort)
|
||||
public PasswordConnectionInfo(string host, string username, string password, ProxyTypes proxyType, string? proxyHost, int proxyPort)
|
||||
: this(host, DefaultPort, username, Encoding.UTF8.GetBytes(password), proxyType, proxyHost, proxyPort, string.Empty, string.Empty)
|
||||
{
|
||||
}
|
||||
@@ -101,7 +102,7 @@ namespace Renci.SshNet
|
||||
/// <param name="proxyHost">The proxy host.</param>
|
||||
/// <param name="proxyPort">The proxy port.</param>
|
||||
/// <param name="proxyUsername">The proxy username.</param>
|
||||
public PasswordConnectionInfo(string host, string username, string password, ProxyTypes proxyType, string proxyHost, int proxyPort, string proxyUsername)
|
||||
public PasswordConnectionInfo(string host, string username, string password, ProxyTypes proxyType, string? proxyHost, int proxyPort, string? proxyUsername)
|
||||
: this(host, DefaultPort, username, Encoding.UTF8.GetBytes(password), proxyType, proxyHost, proxyPort, proxyUsername, string.Empty)
|
||||
{
|
||||
}
|
||||
@@ -117,7 +118,7 @@ namespace Renci.SshNet
|
||||
/// <param name="proxyPort">The proxy port.</param>
|
||||
/// <param name="proxyUsername">The proxy username.</param>
|
||||
/// <param name="proxyPassword">The proxy password.</param>
|
||||
public PasswordConnectionInfo(string host, string username, string password, ProxyTypes proxyType, string proxyHost, int proxyPort, string proxyUsername, string proxyPassword)
|
||||
public PasswordConnectionInfo(string host, string username, string password, ProxyTypes proxyType, string? proxyHost, int proxyPort, string? proxyUsername, string? proxyPassword)
|
||||
: this(host, DefaultPort, username, Encoding.UTF8.GetBytes(password), proxyType, proxyHost, proxyPort, proxyUsername, proxyPassword)
|
||||
{
|
||||
}
|
||||
@@ -158,7 +159,7 @@ namespace Renci.SshNet
|
||||
/// <param name="proxyType">Type of the proxy.</param>
|
||||
/// <param name="proxyHost">The proxy host.</param>
|
||||
/// <param name="proxyPort">The proxy port.</param>
|
||||
public PasswordConnectionInfo(string host, int port, string username, byte[] password, ProxyTypes proxyType, string proxyHost, int proxyPort)
|
||||
public PasswordConnectionInfo(string host, int port, string username, byte[] password, ProxyTypes proxyType, string? proxyHost, int proxyPort)
|
||||
: this(host, port, username, password, proxyType, proxyHost, proxyPort, string.Empty, string.Empty)
|
||||
{
|
||||
}
|
||||
@@ -174,7 +175,7 @@ namespace Renci.SshNet
|
||||
/// <param name="proxyHost">The proxy host.</param>
|
||||
/// <param name="proxyPort">The proxy port.</param>
|
||||
/// <param name="proxyUsername">The proxy username.</param>
|
||||
public PasswordConnectionInfo(string host, int port, string username, byte[] password, ProxyTypes proxyType, string proxyHost, int proxyPort, string proxyUsername)
|
||||
public PasswordConnectionInfo(string host, int port, string username, byte[] password, ProxyTypes proxyType, string? proxyHost, int proxyPort, string? proxyUsername)
|
||||
: this(host, port, username, password, proxyType, proxyHost, proxyPort, proxyUsername, string.Empty)
|
||||
{
|
||||
}
|
||||
@@ -188,7 +189,7 @@ namespace Renci.SshNet
|
||||
/// <param name="proxyType">Type of the proxy.</param>
|
||||
/// <param name="proxyHost">The proxy host.</param>
|
||||
/// <param name="proxyPort">The proxy port.</param>
|
||||
public PasswordConnectionInfo(string host, string username, byte[] password, ProxyTypes proxyType, string proxyHost, int proxyPort)
|
||||
public PasswordConnectionInfo(string host, string username, byte[] password, ProxyTypes proxyType, string? proxyHost, int proxyPort)
|
||||
: this(host, DefaultPort, username, password, proxyType, proxyHost, proxyPort, string.Empty, string.Empty)
|
||||
{
|
||||
}
|
||||
@@ -203,7 +204,7 @@ namespace Renci.SshNet
|
||||
/// <param name="proxyHost">The proxy host.</param>
|
||||
/// <param name="proxyPort">The proxy port.</param>
|
||||
/// <param name="proxyUsername">The proxy username.</param>
|
||||
public PasswordConnectionInfo(string host, string username, byte[] password, ProxyTypes proxyType, string proxyHost, int proxyPort, string proxyUsername)
|
||||
public PasswordConnectionInfo(string host, string username, byte[] password, ProxyTypes proxyType, string? proxyHost, int proxyPort, string? proxyUsername)
|
||||
: this(host, DefaultPort, username, password, proxyType, proxyHost, proxyPort, proxyUsername, string.Empty)
|
||||
{
|
||||
}
|
||||
@@ -219,7 +220,7 @@ namespace Renci.SshNet
|
||||
/// <param name="proxyPort">The proxy port.</param>
|
||||
/// <param name="proxyUsername">The proxy username.</param>
|
||||
/// <param name="proxyPassword">The proxy password.</param>
|
||||
public PasswordConnectionInfo(string host, string username, byte[] password, ProxyTypes proxyType, string proxyHost, int proxyPort, string proxyUsername, string proxyPassword)
|
||||
public PasswordConnectionInfo(string host, string username, byte[] password, ProxyTypes proxyType, string? proxyHost, int proxyPort, string? proxyUsername, string? proxyPassword)
|
||||
: this(host, DefaultPort, username, password, proxyType, proxyHost, proxyPort, proxyUsername, proxyPassword)
|
||||
{
|
||||
}
|
||||
@@ -236,7 +237,7 @@ namespace Renci.SshNet
|
||||
/// <param name="proxyPort">The proxy port.</param>
|
||||
/// <param name="proxyUsername">The proxy username.</param>
|
||||
/// <param name="proxyPassword">The proxy password.</param>
|
||||
public PasswordConnectionInfo(string host, int port, string username, byte[] password, ProxyTypes proxyType, string proxyHost, int proxyPort, string proxyUsername, string proxyPassword)
|
||||
public PasswordConnectionInfo(string host, int port, string username, byte[] password, ProxyTypes proxyType, string? proxyHost, int proxyPort, string? proxyUsername, string? proxyPassword)
|
||||
: base(host, port, username, proxyType, proxyHost, proxyPort, proxyUsername, proxyPassword, new PasswordAuthenticationMethod(username, password))
|
||||
{
|
||||
foreach (var authenticationMethod in AuthenticationMethods)
|
||||
@@ -248,7 +249,7 @@ namespace Renci.SshNet
|
||||
}
|
||||
}
|
||||
|
||||
private void AuthenticationMethod_PasswordExpired(object sender, AuthenticationPasswordChangeEventArgs e)
|
||||
private void AuthenticationMethod_PasswordExpired(object? sender, AuthenticationPasswordChangeEventArgs e)
|
||||
{
|
||||
#pragma warning disable MA0091 // Sender should be 'this' for instance events
|
||||
PasswordExpired?.Invoke(sender, e);
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using System;
|
||||
#nullable enable
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.ObjectModel;
|
||||
|
||||
@@ -49,7 +50,7 @@ namespace Renci.SshNet
|
||||
/// <param name="proxyHost">The proxy host.</param>
|
||||
/// <param name="proxyPort">The proxy port.</param>
|
||||
/// <param name="keyFiles">The key files.</param>
|
||||
public PrivateKeyConnectionInfo(string host, int port, string username, ProxyTypes proxyType, string proxyHost, int proxyPort, params IPrivateKeySource[] keyFiles)
|
||||
public PrivateKeyConnectionInfo(string host, int port, string username, ProxyTypes proxyType, string? proxyHost, int proxyPort, params IPrivateKeySource[] keyFiles)
|
||||
: this(host, port, username, proxyType, proxyHost, proxyPort, string.Empty, string.Empty, keyFiles)
|
||||
{
|
||||
}
|
||||
@@ -65,7 +66,7 @@ namespace Renci.SshNet
|
||||
/// <param name="proxyPort">The proxy port.</param>
|
||||
/// <param name="proxyUsername">The proxy username.</param>
|
||||
/// <param name="keyFiles">The key files.</param>
|
||||
public PrivateKeyConnectionInfo(string host, int port, string username, ProxyTypes proxyType, string proxyHost, int proxyPort, string proxyUsername, params IPrivateKeySource[] keyFiles)
|
||||
public PrivateKeyConnectionInfo(string host, int port, string username, ProxyTypes proxyType, string? proxyHost, int proxyPort, string? proxyUsername, params IPrivateKeySource[] keyFiles)
|
||||
: this(host, port, username, proxyType, proxyHost, proxyPort, proxyUsername, string.Empty, keyFiles)
|
||||
{
|
||||
}
|
||||
@@ -79,7 +80,7 @@ namespace Renci.SshNet
|
||||
/// <param name="proxyHost">The proxy host.</param>
|
||||
/// <param name="proxyPort">The proxy port.</param>
|
||||
/// <param name="keyFiles">The key files.</param>
|
||||
public PrivateKeyConnectionInfo(string host, string username, ProxyTypes proxyType, string proxyHost, int proxyPort, params IPrivateKeySource[] keyFiles)
|
||||
public PrivateKeyConnectionInfo(string host, string username, ProxyTypes proxyType, string? proxyHost, int proxyPort, params IPrivateKeySource[] keyFiles)
|
||||
: this(host, DefaultPort, username, proxyType, proxyHost, proxyPort, string.Empty, string.Empty, keyFiles)
|
||||
{
|
||||
}
|
||||
@@ -94,7 +95,7 @@ namespace Renci.SshNet
|
||||
/// <param name="proxyPort">The proxy port.</param>
|
||||
/// <param name="proxyUsername">The proxy username.</param>
|
||||
/// <param name="keyFiles">The key files.</param>
|
||||
public PrivateKeyConnectionInfo(string host, string username, ProxyTypes proxyType, string proxyHost, int proxyPort, string proxyUsername, params IPrivateKeySource[] keyFiles)
|
||||
public PrivateKeyConnectionInfo(string host, string username, ProxyTypes proxyType, string? proxyHost, int proxyPort, string? proxyUsername, params IPrivateKeySource[] keyFiles)
|
||||
: this(host, DefaultPort, username, proxyType, proxyHost, proxyPort, proxyUsername, string.Empty, keyFiles)
|
||||
{
|
||||
}
|
||||
@@ -110,7 +111,7 @@ namespace Renci.SshNet
|
||||
/// <param name="proxyUsername">The proxy username.</param>
|
||||
/// <param name="proxyPassword">The proxy password.</param>
|
||||
/// <param name="keyFiles">The key files.</param>
|
||||
public PrivateKeyConnectionInfo(string host, string username, ProxyTypes proxyType, string proxyHost, int proxyPort, string proxyUsername, string proxyPassword, params IPrivateKeySource[] keyFiles)
|
||||
public PrivateKeyConnectionInfo(string host, string username, ProxyTypes proxyType, string? proxyHost, int proxyPort, string? proxyUsername, string? proxyPassword, params IPrivateKeySource[] keyFiles)
|
||||
: this(host, DefaultPort, username, proxyType, proxyHost, proxyPort, proxyUsername, proxyPassword, keyFiles)
|
||||
{
|
||||
}
|
||||
@@ -127,7 +128,7 @@ namespace Renci.SshNet
|
||||
/// <param name="proxyUsername">The proxy username.</param>
|
||||
/// <param name="proxyPassword">The proxy password.</param>
|
||||
/// <param name="keyFiles">The key files.</param>
|
||||
public PrivateKeyConnectionInfo(string host, int port, string username, ProxyTypes proxyType, string proxyHost, int proxyPort, string proxyUsername, string proxyPassword, params IPrivateKeySource[] keyFiles)
|
||||
public PrivateKeyConnectionInfo(string host, int port, string username, ProxyTypes proxyType, string? proxyHost, int proxyPort, string? proxyUsername, string? proxyPassword, params IPrivateKeySource[] keyFiles)
|
||||
: base(host, port, username, proxyType, proxyHost, proxyPort, proxyUsername, proxyPassword, new PrivateKeyAuthenticationMethod(username, keyFiles))
|
||||
{
|
||||
KeyFiles = new Collection<IPrivateKeySource>(keyFiles);
|
||||
|
||||
@@ -32,9 +32,6 @@ namespace Renci.SshNet
|
||||
internal const byte CarriageReturn = 0x0d;
|
||||
internal const byte LineFeed = 0x0a;
|
||||
|
||||
private static readonly string ClientVersionString =
|
||||
"SSH-2.0-Renci.SshNet.SshClient." + ThisAssembly.NuGetPackageVersion.Replace('-', '_');
|
||||
|
||||
/// <summary>
|
||||
/// Specifies maximum packet size defined by the protocol.
|
||||
/// </summary>
|
||||
@@ -71,6 +68,9 @@ namespace Renci.SshNet
|
||||
/// </remarks>
|
||||
private const int LocalChannelDataPacketSize = 1024 * 64;
|
||||
|
||||
internal static readonly string ClientVersionString =
|
||||
"SSH-2.0-Renci.SshNet.SshClient." + ThisAssembly.NuGetPackageVersion.Replace('-', '_');
|
||||
|
||||
/// <summary>
|
||||
/// Holds the factory to use for creating new services.
|
||||
/// </summary>
|
||||
@@ -591,7 +591,6 @@ namespace Renci.SshNet
|
||||
|
||||
// Set connection versions
|
||||
ServerVersion = ConnectionInfo.ServerVersion = serverIdentification.ToString();
|
||||
ConnectionInfo.ClientVersion = ClientVersion;
|
||||
|
||||
_logger.LogInformation("Server version '{ServerIdentification}'.", serverIdentification);
|
||||
|
||||
@@ -717,7 +716,6 @@ namespace Renci.SshNet
|
||||
|
||||
// Set connection versions
|
||||
ServerVersion = ConnectionInfo.ServerVersion = serverIdentification.ToString();
|
||||
ConnectionInfo.ClientVersion = ClientVersion;
|
||||
|
||||
_logger.LogInformation("Server version '{ServerIdentification}'.", serverIdentification);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user