mirror of
https://github.com/sshnet/SSH.NET.git
synced 2026-09-10 01:05:42 +00:00
Remove some dead internal code (#1824)
* Drop some dead internal code * remove some more unused events and their callbacks * more --------- Co-authored-by: Robert Hague <rh@johnstreetcapital.com>
This commit is contained in:
@@ -88,40 +88,6 @@ namespace Renci.SshNet.Abstractions
|
||||
args.Dispose();
|
||||
}
|
||||
|
||||
public static void ClearReadBuffer(Socket socket)
|
||||
{
|
||||
var timeout = TimeSpan.FromMilliseconds(500);
|
||||
var buffer = new byte[256];
|
||||
int bytesReceived;
|
||||
|
||||
do
|
||||
{
|
||||
bytesReceived = ReadPartial(socket, buffer, 0, buffer.Length, timeout);
|
||||
}
|
||||
while (bytesReceived > 0);
|
||||
}
|
||||
|
||||
public static int ReadPartial(Socket socket, byte[] buffer, int offset, int size, TimeSpan timeout)
|
||||
{
|
||||
socket.ReceiveTimeout = timeout.AsTimeout();
|
||||
|
||||
try
|
||||
{
|
||||
return socket.Receive(buffer, offset, size, SocketFlags.None);
|
||||
}
|
||||
catch (SocketException ex)
|
||||
{
|
||||
if (ex.SocketErrorCode == SocketError.TimedOut)
|
||||
{
|
||||
throw new SshOperationTimeoutException(string.Format(CultureInfo.InvariantCulture,
|
||||
"Socket read operation has timed out after {0:F0} milliseconds.",
|
||||
timeout.TotalMilliseconds));
|
||||
}
|
||||
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
public static void ReadContinuous(Socket socket, byte[] buffer, int offset, int size, Action<byte[], int, int> processReceivedBytesAction)
|
||||
{
|
||||
// do not time-out receive
|
||||
|
||||
@@ -225,8 +225,6 @@ namespace Renci.SshNet.Channels
|
||||
|
||||
protected override void OnOpenFailure(uint reasonCode, string description, string language)
|
||||
{
|
||||
base.OnOpenFailure(reasonCode, description, language);
|
||||
|
||||
_ = _channelOpen.Set();
|
||||
}
|
||||
|
||||
|
||||
@@ -21,16 +21,6 @@ namespace Renci.SshNet.Channels
|
||||
session.ChannelOpenFailureReceived += OnChannelOpenFailure;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Occurs when <see cref="ChannelOpenConfirmationMessage"/> is received.
|
||||
/// </summary>
|
||||
public event EventHandler<ChannelOpenConfirmedEventArgs> OpenConfirmed;
|
||||
|
||||
/// <summary>
|
||||
/// Occurs when <see cref="ChannelOpenFailureMessage"/> is received.
|
||||
/// </summary>
|
||||
public event EventHandler<ChannelOpenFailedEventArgs> OpenFailed;
|
||||
|
||||
/// <summary>
|
||||
/// Called when channel is opened by the server.
|
||||
/// </summary>
|
||||
@@ -43,8 +33,6 @@ namespace Renci.SshNet.Channels
|
||||
|
||||
// Channel is consider to be open when confirmation message was received
|
||||
IsOpen = true;
|
||||
|
||||
OpenConfirmed?.Invoke(this, new ChannelOpenConfirmedEventArgs(remoteChannelNumber, initialWindowSize, maximumPacketSize));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -65,10 +53,7 @@ namespace Renci.SshNet.Channels
|
||||
/// <param name="reasonCode">The reason code.</param>
|
||||
/// <param name="description">The description.</param>
|
||||
/// <param name="language">The language.</param>
|
||||
protected virtual void OnOpenFailure(uint reasonCode, string description, string language)
|
||||
{
|
||||
OpenFailed?.Invoke(this, new ChannelOpenFailedEventArgs(LocalChannelNumber, reasonCode, description, language));
|
||||
}
|
||||
protected abstract void OnOpenFailure(uint reasonCode, string description, string language);
|
||||
|
||||
private void OnChannelOpenConfirmation(object sender, MessageEventArgs<ChannelOpenConfirmationMessage> e)
|
||||
{
|
||||
|
||||
@@ -1,37 +0,0 @@
|
||||
namespace Renci.SshNet.Common
|
||||
{
|
||||
/// <summary>
|
||||
/// Provides data for <see cref="Channels.ClientChannel.OpenConfirmed"/> event.
|
||||
/// </summary>
|
||||
internal sealed class ChannelOpenConfirmedEventArgs : ChannelEventArgs
|
||||
{
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="ChannelOpenConfirmedEventArgs"/> class.
|
||||
/// </summary>
|
||||
/// <param name="remoteChannelNumber">The remote channel number.</param>
|
||||
/// <param name="initialWindowSize">The initial window size.</param>
|
||||
/// <param name="maximumPacketSize">The maximum packet size.</param>
|
||||
public ChannelOpenConfirmedEventArgs(uint remoteChannelNumber, uint initialWindowSize, uint maximumPacketSize)
|
||||
: base(remoteChannelNumber)
|
||||
{
|
||||
InitialWindowSize = initialWindowSize;
|
||||
MaximumPacketSize = maximumPacketSize;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the initial size of the window.
|
||||
/// </summary>
|
||||
/// <value>
|
||||
/// The initial size of the window.
|
||||
/// </value>
|
||||
public uint InitialWindowSize { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the maximum size of the packet.
|
||||
/// </summary>
|
||||
/// <value>
|
||||
/// The maximum size of the packet.
|
||||
/// </value>
|
||||
public uint MaximumPacketSize { get; }
|
||||
}
|
||||
}
|
||||
@@ -1,38 +0,0 @@
|
||||
namespace Renci.SshNet.Common
|
||||
{
|
||||
/// <summary>
|
||||
/// Provides data for <see cref="Channels.ClientChannel.OpenFailed"/> event.
|
||||
/// </summary>
|
||||
internal sealed class ChannelOpenFailedEventArgs : ChannelEventArgs
|
||||
{
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="ChannelOpenFailedEventArgs"/> class.
|
||||
/// </summary>
|
||||
/// <param name="channelNumber">Channel number.</param>
|
||||
/// <param name="reasonCode">Failure reason code.</param>
|
||||
/// <param name="description">Failure description.</param>
|
||||
/// <param name="language">Failure language.</param>
|
||||
public ChannelOpenFailedEventArgs(uint channelNumber, uint reasonCode, string description, string language)
|
||||
: base(channelNumber)
|
||||
{
|
||||
ReasonCode = reasonCode;
|
||||
Description = description;
|
||||
Language = language;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets failure reason code.
|
||||
/// </summary>
|
||||
public uint ReasonCode { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets failure description.
|
||||
/// </summary>
|
||||
public string Description { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets failure language.
|
||||
/// </summary>
|
||||
public string Language { get; }
|
||||
}
|
||||
}
|
||||
@@ -1,104 +0,0 @@
|
||||
namespace Renci.SshNet.Messages.Authentication
|
||||
{
|
||||
/// <summary>
|
||||
/// Represents "hostbased" SSH_MSG_USERAUTH_REQUEST message.
|
||||
/// </summary>
|
||||
internal sealed class RequestMessageHost : RequestMessage
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets the public key algorithm for host key as ASCII encoded byte array.
|
||||
/// </summary>
|
||||
public byte[] PublicKeyAlgorithm { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the public host key and certificates for client host.
|
||||
/// </summary>
|
||||
/// <value>
|
||||
/// The public host key.
|
||||
/// </value>
|
||||
public byte[] PublicHostKey { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the name of the client host as ASCII encoded byte array.
|
||||
/// </summary>
|
||||
/// <value>
|
||||
/// The name of the client host.
|
||||
/// </value>
|
||||
public byte[] ClientHostName { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the client username on the client host as UTF-8 encoded byte array.
|
||||
/// </summary>
|
||||
/// <value>
|
||||
/// The client username.
|
||||
/// </value>
|
||||
public byte[] ClientUsername { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the signature.
|
||||
/// </summary>
|
||||
/// <value>
|
||||
/// The signature.
|
||||
/// </value>
|
||||
public byte[] Signature { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the size of the message in bytes.
|
||||
/// </summary>
|
||||
/// <value>
|
||||
/// The size of the messages in bytes.
|
||||
/// </value>
|
||||
protected override int BufferCapacity
|
||||
{
|
||||
get
|
||||
{
|
||||
var capacity = base.BufferCapacity;
|
||||
capacity += 4; // PublicKeyAlgorithm length
|
||||
capacity += PublicKeyAlgorithm.Length; // PublicKeyAlgorithm
|
||||
capacity += 4; // PublicHostKey length
|
||||
capacity += PublicHostKey.Length; // PublicHostKey
|
||||
capacity += 4; // ClientHostName length
|
||||
capacity += ClientHostName.Length; // ClientHostName
|
||||
capacity += 4; // ClientUsername length
|
||||
capacity += ClientUsername.Length; // ClientUsername
|
||||
capacity += 4; // Signature length
|
||||
capacity += Signature.Length; // Signature
|
||||
return capacity;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="RequestMessageHost"/> class.
|
||||
/// </summary>
|
||||
/// <param name="serviceName">Name of the service.</param>
|
||||
/// <param name="username">Authentication username.</param>
|
||||
/// <param name="publicKeyAlgorithm">The public key algorithm.</param>
|
||||
/// <param name="publicHostKey">The public host key.</param>
|
||||
/// <param name="clientHostName">Name of the client host.</param>
|
||||
/// <param name="clientUsername">The client username.</param>
|
||||
/// <param name="signature">The signature.</param>
|
||||
public RequestMessageHost(ServiceName serviceName, string username, string publicKeyAlgorithm, byte[] publicHostKey, string clientHostName, string clientUsername, byte[] signature)
|
||||
: base(serviceName, username, "hostbased")
|
||||
{
|
||||
PublicKeyAlgorithm = Ascii.GetBytes(publicKeyAlgorithm);
|
||||
PublicHostKey = publicHostKey;
|
||||
ClientHostName = Ascii.GetBytes(clientHostName);
|
||||
ClientUsername = Utf8.GetBytes(clientUsername);
|
||||
Signature = signature;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Called when type specific data need to be saved.
|
||||
/// </summary>
|
||||
protected override void SaveData()
|
||||
{
|
||||
base.SaveData();
|
||||
|
||||
WriteBinaryString(PublicKeyAlgorithm);
|
||||
WriteBinaryString(PublicHostKey);
|
||||
WriteBinaryString(ClientHostName);
|
||||
WriteBinaryString(ClientUsername);
|
||||
WriteBinaryString(Signature);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -92,7 +92,6 @@
|
||||
|
||||
internal override void Process(Session session)
|
||||
{
|
||||
session.OnDebugReceived(this);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -85,7 +85,6 @@ namespace Renci.SshNet.Messages.Transport
|
||||
|
||||
internal override void Process(Session session)
|
||||
{
|
||||
session.OnIgnoreReceived(this);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -53,7 +53,7 @@ namespace Renci.SshNet.Messages.Transport
|
||||
|
||||
internal override void Process(Session session)
|
||||
{
|
||||
session.OnServiceAcceptReceived(this);
|
||||
session.OnServiceAcceptReceived();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -84,7 +84,6 @@ namespace Renci.SshNet.Messages.Transport
|
||||
|
||||
internal override void Process(Session session)
|
||||
{
|
||||
session.OnServiceRequestReceived(this);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -42,7 +42,6 @@ namespace Renci.SshNet.Messages.Transport
|
||||
|
||||
internal override void Process(Session session)
|
||||
{
|
||||
session.OnUnimplementedReceived(this);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -417,31 +417,6 @@ namespace Renci.SshNet
|
||||
/// </summary>
|
||||
internal event EventHandler<MessageEventArgs<DisconnectMessage>> DisconnectReceived;
|
||||
|
||||
/// <summary>
|
||||
/// Occurs when <see cref="IgnoreMessage"/> message received
|
||||
/// </summary>
|
||||
internal event EventHandler<MessageEventArgs<IgnoreMessage>> IgnoreReceived;
|
||||
|
||||
/// <summary>
|
||||
/// Occurs when <see cref="UnimplementedMessage"/> message received
|
||||
/// </summary>
|
||||
internal event EventHandler<MessageEventArgs<UnimplementedMessage>> UnimplementedReceived;
|
||||
|
||||
/// <summary>
|
||||
/// Occurs when <see cref="DebugMessage"/> message received
|
||||
/// </summary>
|
||||
internal event EventHandler<MessageEventArgs<DebugMessage>> DebugReceived;
|
||||
|
||||
/// <summary>
|
||||
/// Occurs when <see cref="ServiceRequestMessage"/> message received
|
||||
/// </summary>
|
||||
internal event EventHandler<MessageEventArgs<ServiceRequestMessage>> ServiceRequestReceived;
|
||||
|
||||
/// <summary>
|
||||
/// Occurs when <see cref="ServiceAcceptMessage"/> message received
|
||||
/// </summary>
|
||||
internal event EventHandler<MessageEventArgs<ServiceAcceptMessage>> ServiceAcceptReceived;
|
||||
|
||||
/// <summary>
|
||||
/// Occurs when <see cref="KeyExchangeInitMessage"/> message received
|
||||
/// </summary>
|
||||
@@ -462,16 +437,6 @@ namespace Renci.SshNet
|
||||
/// </summary>
|
||||
internal event EventHandler<MessageEventArgs<KeyExchangeHybridReplyMessage>> KeyExchangeHybridReplyMessageReceived;
|
||||
|
||||
/// <summary>
|
||||
/// Occurs when <see cref="NewKeysMessage"/> message received
|
||||
/// </summary>
|
||||
internal event EventHandler<MessageEventArgs<NewKeysMessage>> NewKeysReceived;
|
||||
|
||||
/// <summary>
|
||||
/// Occurs when <see cref="RequestMessage"/> message received
|
||||
/// </summary>
|
||||
internal event EventHandler<MessageEventArgs<RequestMessage>> UserAuthenticationRequestReceived;
|
||||
|
||||
/// <summary>
|
||||
/// Occurs when <see cref="FailureMessage"/> message received
|
||||
/// </summary>
|
||||
@@ -1478,50 +1443,11 @@ namespace Renci.SshNet
|
||||
SocketDisconnectAndDispose();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Called when <see cref="IgnoreMessage"/> received.
|
||||
/// </summary>
|
||||
/// <param name="message"><see cref="IgnoreMessage"/> message.</param>
|
||||
internal void OnIgnoreReceived(IgnoreMessage message)
|
||||
{
|
||||
IgnoreReceived?.Invoke(this, new MessageEventArgs<IgnoreMessage>(message));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Called when <see cref="UnimplementedMessage"/> message received.
|
||||
/// </summary>
|
||||
/// <param name="message"><see cref="UnimplementedMessage"/> message.</param>
|
||||
internal void OnUnimplementedReceived(UnimplementedMessage message)
|
||||
{
|
||||
UnimplementedReceived?.Invoke(this, new MessageEventArgs<UnimplementedMessage>(message));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Called when <see cref="DebugMessage"/> message received.
|
||||
/// </summary>
|
||||
/// <param name="message"><see cref="DebugMessage"/> message.</param>
|
||||
internal void OnDebugReceived(DebugMessage message)
|
||||
{
|
||||
DebugReceived?.Invoke(this, new MessageEventArgs<DebugMessage>(message));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Called when <see cref="ServiceRequestMessage"/> message received.
|
||||
/// </summary>
|
||||
/// <param name="message"><see cref="ServiceRequestMessage"/> message.</param>
|
||||
internal void OnServiceRequestReceived(ServiceRequestMessage message)
|
||||
{
|
||||
ServiceRequestReceived?.Invoke(this, new MessageEventArgs<ServiceRequestMessage>(message));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Called when <see cref="ServiceAcceptMessage"/> message received.
|
||||
/// </summary>
|
||||
/// <param name="message"><see cref="ServiceAcceptMessage"/> message.</param>
|
||||
internal void OnServiceAcceptReceived(ServiceAcceptMessage message)
|
||||
internal void OnServiceAcceptReceived()
|
||||
{
|
||||
ServiceAcceptReceived?.Invoke(this, new MessageEventArgs<ServiceAcceptMessage>(message));
|
||||
|
||||
_ = _serviceAccepted.Set();
|
||||
}
|
||||
|
||||
@@ -1661,8 +1587,6 @@ namespace Renci.SshNet
|
||||
InboundPacketSequence = 0;
|
||||
}
|
||||
|
||||
NewKeysReceived?.Invoke(this, new MessageEventArgs<NewKeysMessage>(message));
|
||||
|
||||
// Signal that key exchange completed
|
||||
_keyExchangeCompletedWaitHandle.Set();
|
||||
}
|
||||
@@ -1675,15 +1599,6 @@ namespace Renci.SshNet
|
||||
_isDisconnecting = true;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Called when <see cref="RequestMessage"/> message received.
|
||||
/// </summary>
|
||||
/// <param name="message"><see cref="RequestMessage"/> message.</param>
|
||||
internal void OnUserAuthenticationRequestReceived(RequestMessage message)
|
||||
{
|
||||
UserAuthenticationRequestReceived?.Invoke(this, new MessageEventArgs<RequestMessage>(message));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Called when <see cref="FailureMessage"/> message received.
|
||||
/// </summary>
|
||||
|
||||
@@ -1,56 +0,0 @@
|
||||
using System;
|
||||
|
||||
using Renci.SshNet.Sftp.Responses;
|
||||
|
||||
namespace Renci.SshNet.Sftp.Requests
|
||||
{
|
||||
internal sealed class FStatVfsRequest : SftpExtendedRequest
|
||||
{
|
||||
private readonly Action<SftpExtendedReplyResponse> _extendedReplyAction;
|
||||
|
||||
public byte[] Handle { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the size of the message in bytes.
|
||||
/// </summary>
|
||||
/// <value>
|
||||
/// The size of the messages in bytes.
|
||||
/// </value>
|
||||
protected override int BufferCapacity
|
||||
{
|
||||
get
|
||||
{
|
||||
var capacity = base.BufferCapacity;
|
||||
capacity += 4; // Handle length
|
||||
capacity += Handle.Length; // Handle
|
||||
return capacity;
|
||||
}
|
||||
}
|
||||
|
||||
public FStatVfsRequest(uint protocolVersion, uint requestId, byte[] handle, Action<SftpExtendedReplyResponse> extendedAction, Action<SftpStatusResponse> statusAction)
|
||||
: base(protocolVersion, requestId, statusAction, "fstatvfs@openssh.com")
|
||||
{
|
||||
Handle = handle;
|
||||
|
||||
_extendedReplyAction = extendedAction;
|
||||
}
|
||||
|
||||
protected override void SaveData()
|
||||
{
|
||||
base.SaveData();
|
||||
WriteBinaryString(Handle);
|
||||
}
|
||||
|
||||
public override void Complete(SftpResponse response)
|
||||
{
|
||||
if (response is SftpExtendedReplyResponse extendedReplyResponse)
|
||||
{
|
||||
_extendedReplyAction(extendedReplyResponse);
|
||||
}
|
||||
else
|
||||
{
|
||||
base.Complete(response);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,57 +0,0 @@
|
||||
using System;
|
||||
|
||||
using Renci.SshNet.Sftp.Responses;
|
||||
|
||||
namespace Renci.SshNet.Sftp.Requests
|
||||
{
|
||||
internal sealed class HardLinkRequest : SftpExtendedRequest
|
||||
{
|
||||
private byte[] _oldPath;
|
||||
private byte[] _newPath;
|
||||
|
||||
public string OldPath
|
||||
{
|
||||
get { return Utf8.GetString(_oldPath, 0, _oldPath.Length); }
|
||||
private set { _oldPath = Utf8.GetBytes(value); }
|
||||
}
|
||||
|
||||
public string NewPath
|
||||
{
|
||||
get { return Utf8.GetString(_newPath, 0, _newPath.Length); }
|
||||
private set { _newPath = Utf8.GetBytes(value); }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the size of the message in bytes.
|
||||
/// </summary>
|
||||
/// <value>
|
||||
/// The size of the messages in bytes.
|
||||
/// </value>
|
||||
protected override int BufferCapacity
|
||||
{
|
||||
get
|
||||
{
|
||||
var capacity = base.BufferCapacity;
|
||||
capacity += 4; // OldPath length
|
||||
capacity += _oldPath.Length; // OldPath
|
||||
capacity += 4; // NewPath length
|
||||
capacity += _newPath.Length; // NewPath
|
||||
return capacity;
|
||||
}
|
||||
}
|
||||
|
||||
public HardLinkRequest(uint protocolVersion, uint requestId, string oldPath, string newPath, Action<SftpStatusResponse> statusAction)
|
||||
: base(protocolVersion, requestId, statusAction, "hardlink@openssh.com")
|
||||
{
|
||||
OldPath = oldPath;
|
||||
NewPath = newPath;
|
||||
}
|
||||
|
||||
protected override void SaveData()
|
||||
{
|
||||
base.SaveData();
|
||||
WriteBinaryString(_oldPath);
|
||||
WriteBinaryString(_newPath);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,71 +0,0 @@
|
||||
using System;
|
||||
|
||||
using Renci.SshNet.Sftp.Responses;
|
||||
|
||||
namespace Renci.SshNet.Sftp.Requests
|
||||
{
|
||||
internal sealed class SftpBlockRequest : SftpRequest
|
||||
{
|
||||
public override SftpMessageTypes SftpMessageType
|
||||
{
|
||||
get { return SftpMessageTypes.Block; }
|
||||
}
|
||||
|
||||
public byte[] Handle { get; private set; }
|
||||
|
||||
public ulong Offset { get; private set; }
|
||||
|
||||
public ulong Length { get; private set; }
|
||||
|
||||
public uint LockMask { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the size of the message in bytes.
|
||||
/// </summary>
|
||||
/// <value>
|
||||
/// The size of the messages in bytes.
|
||||
/// </value>
|
||||
protected override int BufferCapacity
|
||||
{
|
||||
get
|
||||
{
|
||||
var capacity = base.BufferCapacity;
|
||||
capacity += 4; // Handle length
|
||||
capacity += Handle.Length; // Handle
|
||||
capacity += 8; // Offset
|
||||
capacity += 8; // Length
|
||||
capacity += 4; // LockMask
|
||||
return capacity;
|
||||
}
|
||||
}
|
||||
|
||||
public SftpBlockRequest(uint protocolVersion, uint requestId, byte[] handle, ulong offset, ulong length, uint lockMask, Action<SftpStatusResponse> statusAction)
|
||||
: base(protocolVersion, requestId, statusAction)
|
||||
{
|
||||
Handle = handle;
|
||||
Offset = offset;
|
||||
Length = length;
|
||||
LockMask = lockMask;
|
||||
}
|
||||
|
||||
protected override void LoadData()
|
||||
{
|
||||
base.LoadData();
|
||||
|
||||
Handle = ReadBinary();
|
||||
Offset = ReadUInt64();
|
||||
Length = ReadUInt64();
|
||||
LockMask = ReadUInt32();
|
||||
}
|
||||
|
||||
protected override void SaveData()
|
||||
{
|
||||
base.SaveData();
|
||||
|
||||
WriteBinaryString(Handle);
|
||||
Write(Offset);
|
||||
Write(Length);
|
||||
Write(LockMask);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,86 +0,0 @@
|
||||
using System;
|
||||
|
||||
using Renci.SshNet.Sftp.Responses;
|
||||
|
||||
namespace Renci.SshNet.Sftp.Requests
|
||||
{
|
||||
internal sealed class SftpLinkRequest : SftpRequest
|
||||
{
|
||||
private byte[] _newLinkPath;
|
||||
private byte[] _existingPath;
|
||||
|
||||
public override SftpMessageTypes SftpMessageType
|
||||
{
|
||||
get { return SftpMessageTypes.Link; }
|
||||
}
|
||||
|
||||
public string NewLinkPath
|
||||
{
|
||||
get { return Utf8.GetString(_newLinkPath, 0, _newLinkPath.Length); }
|
||||
private set { _newLinkPath = Utf8.GetBytes(value); }
|
||||
}
|
||||
|
||||
public string ExistingPath
|
||||
{
|
||||
get { return Utf8.GetString(_existingPath, 0, _existingPath.Length); }
|
||||
private set { _existingPath = Utf8.GetBytes(value); }
|
||||
}
|
||||
|
||||
public bool IsSymLink { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the size of the message in bytes.
|
||||
/// </summary>
|
||||
/// <value>
|
||||
/// The size of the messages in bytes.
|
||||
/// </value>
|
||||
protected override int BufferCapacity
|
||||
{
|
||||
get
|
||||
{
|
||||
var capacity = base.BufferCapacity;
|
||||
capacity += 4; // NewLinkPath length
|
||||
capacity += NewLinkPath.Length; // NewLinkPath
|
||||
capacity += 4; // ExistingPath length
|
||||
capacity += ExistingPath.Length; // ExistingPath
|
||||
capacity += 1; // IsSymLink
|
||||
return capacity;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="SftpLinkRequest" /> class.
|
||||
/// </summary>
|
||||
/// <param name="protocolVersion">The protocol version.</param>
|
||||
/// <param name="requestId">The request id.</param>
|
||||
/// <param name="newLinkPath">Specifies the path name of the new link to create.</param>
|
||||
/// <param name="existingPath">Specifies the path of a target object to which the newly created link will refer. In the case of a symbolic link, this path may not exist.</param>
|
||||
/// <param name="isSymLink">if set to <see langword="false"/> the link should be a hard link, or a second directory entry referring to the same file or directory object.</param>
|
||||
/// <param name="statusAction">The status action.</param>
|
||||
public SftpLinkRequest(uint protocolVersion, uint requestId, string newLinkPath, string existingPath, bool isSymLink, Action<SftpStatusResponse> statusAction)
|
||||
: base(protocolVersion, requestId, statusAction)
|
||||
{
|
||||
NewLinkPath = newLinkPath;
|
||||
ExistingPath = existingPath;
|
||||
IsSymLink = isSymLink;
|
||||
}
|
||||
|
||||
protected override void LoadData()
|
||||
{
|
||||
base.LoadData();
|
||||
|
||||
_newLinkPath = ReadBinary();
|
||||
_existingPath = ReadBinary();
|
||||
IsSymLink = ReadBoolean();
|
||||
}
|
||||
|
||||
protected override void SaveData()
|
||||
{
|
||||
base.SaveData();
|
||||
|
||||
WriteBinaryString(_newLinkPath);
|
||||
WriteBinaryString(_existingPath);
|
||||
Write(IsSymLink);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,78 +0,0 @@
|
||||
using System;
|
||||
using System.Text;
|
||||
|
||||
using Renci.SshNet.Sftp.Responses;
|
||||
|
||||
namespace Renci.SshNet.Sftp.Requests
|
||||
{
|
||||
internal sealed class SftpReadLinkRequest : SftpRequest
|
||||
{
|
||||
private readonly Action<SftpNameResponse> _nameAction;
|
||||
private byte[] _path;
|
||||
|
||||
public override SftpMessageTypes SftpMessageType
|
||||
{
|
||||
get { return SftpMessageTypes.ReadLink; }
|
||||
}
|
||||
|
||||
public string Path
|
||||
{
|
||||
get { return Encoding.GetString(_path, 0, _path.Length); }
|
||||
private set { _path = Encoding.GetBytes(value); }
|
||||
}
|
||||
|
||||
public Encoding Encoding { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the size of the message in bytes.
|
||||
/// </summary>
|
||||
/// <value>
|
||||
/// The size of the messages in bytes.
|
||||
/// </value>
|
||||
protected override int BufferCapacity
|
||||
{
|
||||
get
|
||||
{
|
||||
var capacity = base.BufferCapacity;
|
||||
capacity += 4; // Path length
|
||||
capacity += _path.Length; // Handle
|
||||
return capacity;
|
||||
}
|
||||
}
|
||||
|
||||
public SftpReadLinkRequest(uint protocolVersion, uint requestId, string path, Encoding encoding, Action<SftpNameResponse> nameAction, Action<SftpStatusResponse> statusAction)
|
||||
: base(protocolVersion, requestId, statusAction)
|
||||
{
|
||||
Encoding = encoding;
|
||||
Path = path;
|
||||
|
||||
_nameAction = nameAction;
|
||||
}
|
||||
|
||||
protected override void LoadData()
|
||||
{
|
||||
base.LoadData();
|
||||
|
||||
_path = ReadBinary();
|
||||
}
|
||||
|
||||
protected override void SaveData()
|
||||
{
|
||||
base.SaveData();
|
||||
|
||||
WriteBinaryString(_path);
|
||||
}
|
||||
|
||||
public override void Complete(SftpResponse response)
|
||||
{
|
||||
if (response is SftpNameResponse nameResponse)
|
||||
{
|
||||
_nameAction(nameResponse);
|
||||
}
|
||||
else
|
||||
{
|
||||
base.Complete(response);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,65 +0,0 @@
|
||||
using System;
|
||||
|
||||
using Renci.SshNet.Sftp.Responses;
|
||||
|
||||
namespace Renci.SshNet.Sftp.Requests
|
||||
{
|
||||
internal sealed class SftpUnblockRequest : SftpRequest
|
||||
{
|
||||
public override SftpMessageTypes SftpMessageType
|
||||
{
|
||||
get { return SftpMessageTypes.Unblock; }
|
||||
}
|
||||
|
||||
public byte[] Handle { get; private set; }
|
||||
|
||||
public ulong Offset { get; private set; }
|
||||
|
||||
public ulong Length { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the size of the message in bytes.
|
||||
/// </summary>
|
||||
/// <value>
|
||||
/// The size of the messages in bytes.
|
||||
/// </value>
|
||||
protected override int BufferCapacity
|
||||
{
|
||||
get
|
||||
{
|
||||
var capacity = base.BufferCapacity;
|
||||
capacity += 4; // Handle length
|
||||
capacity += Handle.Length; // Handle
|
||||
capacity += 8; // Offset
|
||||
capacity += 8; // Length
|
||||
return capacity;
|
||||
}
|
||||
}
|
||||
|
||||
public SftpUnblockRequest(uint protocolVersion, uint requestId, byte[] handle, ulong offset, ulong length, Action<SftpStatusResponse> statusAction)
|
||||
: base(protocolVersion, requestId, statusAction)
|
||||
{
|
||||
Handle = handle;
|
||||
Offset = offset;
|
||||
Length = length;
|
||||
}
|
||||
|
||||
protected override void LoadData()
|
||||
{
|
||||
base.LoadData();
|
||||
|
||||
Handle = ReadBinary();
|
||||
Offset = ReadUInt64();
|
||||
Length = ReadUInt64();
|
||||
}
|
||||
|
||||
protected override void SaveData()
|
||||
{
|
||||
base.SaveData();
|
||||
|
||||
WriteBinaryString(Handle);
|
||||
Write(Offset);
|
||||
Write(Length);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1310,56 +1310,6 @@ namespace Renci.SshNet.Sftp
|
||||
return WaitOnHandleAsync(tcs, OperationTimeout, cancellationToken);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Performs SSH_FXP_READLINK request.
|
||||
/// </summary>
|
||||
/// <param name="path">The path.</param>
|
||||
/// <param name="nullOnError">if set to <see langword="true"/> returns <see langword="null"/> instead of throwing an exception.</param>
|
||||
/// <returns>
|
||||
/// An array of <see cref="KeyValuePair{TKey,TValue}"/> where the <c>key</c> is the name of
|
||||
/// a file and the <c>value</c> is the <see cref="SftpFileAttributes"/> of the file.
|
||||
/// </returns>
|
||||
internal KeyValuePair<string, SftpFileAttributes>[] RequestReadLink(string path, bool nullOnError = false)
|
||||
{
|
||||
if (ProtocolVersion < 3)
|
||||
{
|
||||
throw new NotSupportedException(string.Format(CultureInfo.CurrentCulture, "SSH_FXP_READLINK operation is not supported in {0} version that server operates in.", ProtocolVersion));
|
||||
}
|
||||
|
||||
SftpException exception = null;
|
||||
|
||||
KeyValuePair<string, SftpFileAttributes>[] result = null;
|
||||
|
||||
using (var wait = new AutoResetEvent(initialState: false))
|
||||
{
|
||||
var request = new SftpReadLinkRequest(ProtocolVersion,
|
||||
NextRequestId,
|
||||
path,
|
||||
_encoding,
|
||||
response =>
|
||||
{
|
||||
result = response.Files;
|
||||
wait.SetIgnoringObjectDisposed();
|
||||
},
|
||||
response =>
|
||||
{
|
||||
exception = GetSftpException(response, path);
|
||||
wait.SetIgnoringObjectDisposed();
|
||||
});
|
||||
|
||||
SendRequest(request);
|
||||
|
||||
WaitOnHandle(wait, OperationTimeout);
|
||||
}
|
||||
|
||||
if (!nullOnError && exception is not null)
|
||||
{
|
||||
throw exception;
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
public void RequestSymLink(string linkpath, string targetpath)
|
||||
{
|
||||
@@ -1507,102 +1457,6 @@ namespace Renci.SshNet.Sftp
|
||||
return WaitOnHandleAsync(tcs, OperationTimeout, cancellationToken);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Performs fstatvfs@openssh.com extended request.
|
||||
/// </summary>
|
||||
/// <param name="handle">The file handle.</param>
|
||||
/// <param name="nullOnError">if set to <see langword="true"/> [null on error].</param>
|
||||
/// <returns>
|
||||
/// A <see cref="SftpFileSystemInformation"/> for the specified path.
|
||||
/// </returns>
|
||||
/// <exception cref="NotSupportedException">This operation is not supported for the current SFTP protocol version.</exception>
|
||||
internal SftpFileSystemInformation RequestFStatVfs(byte[] handle, bool nullOnError = false)
|
||||
{
|
||||
if (ProtocolVersion < 3)
|
||||
{
|
||||
throw new NotSupportedException(string.Format(CultureInfo.CurrentCulture, "SSH_FXP_EXTENDED operation is not supported in {0} version that server operates in.", ProtocolVersion));
|
||||
}
|
||||
|
||||
SftpException exception = null;
|
||||
|
||||
SftpFileSystemInformation information = null;
|
||||
|
||||
using (var wait = new AutoResetEvent(initialState: false))
|
||||
{
|
||||
var request = new FStatVfsRequest(ProtocolVersion,
|
||||
NextRequestId,
|
||||
handle,
|
||||
response =>
|
||||
{
|
||||
information = response.GetReply<StatVfsReplyInfo>().Information;
|
||||
wait.SetIgnoringObjectDisposed();
|
||||
},
|
||||
response =>
|
||||
{
|
||||
exception = GetSftpException(response);
|
||||
wait.SetIgnoringObjectDisposed();
|
||||
});
|
||||
|
||||
if (!_supportedExtensions.ContainsKey(request.Name))
|
||||
{
|
||||
throw new NotSupportedException(string.Format(CultureInfo.CurrentCulture, "Extension method {0} currently not supported by the server.", request.Name));
|
||||
}
|
||||
|
||||
SendRequest(request);
|
||||
|
||||
WaitOnHandle(wait, OperationTimeout);
|
||||
}
|
||||
|
||||
if (!nullOnError && exception is not null)
|
||||
{
|
||||
throw exception;
|
||||
}
|
||||
|
||||
return information;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Performs hardlink@openssh.com extended request.
|
||||
/// </summary>
|
||||
/// <param name="oldPath">The old path.</param>
|
||||
/// <param name="newPath">The new path.</param>
|
||||
internal void HardLink(string oldPath, string newPath)
|
||||
{
|
||||
if (ProtocolVersion < 3)
|
||||
{
|
||||
throw new NotSupportedException(string.Format(CultureInfo.CurrentCulture, "SSH_FXP_EXTENDED operation is not supported in {0} version that server operates in.", ProtocolVersion));
|
||||
}
|
||||
|
||||
SftpException exception = null;
|
||||
|
||||
using (var wait = new AutoResetEvent(initialState: false))
|
||||
{
|
||||
var request = new HardLinkRequest(ProtocolVersion,
|
||||
NextRequestId,
|
||||
oldPath,
|
||||
newPath,
|
||||
response =>
|
||||
{
|
||||
exception = GetSftpException(response);
|
||||
wait.SetIgnoringObjectDisposed();
|
||||
});
|
||||
|
||||
if (!_supportedExtensions.ContainsKey(request.Name))
|
||||
{
|
||||
throw new NotSupportedException(string.Format(CultureInfo.CurrentCulture, "Extension method {0} currently not supported by the server.", request.Name));
|
||||
}
|
||||
|
||||
SendRequest(request);
|
||||
|
||||
WaitOnHandle(wait, OperationTimeout);
|
||||
}
|
||||
|
||||
if (exception is not null)
|
||||
{
|
||||
throw exception;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Calculates the optimal size of the buffer to read data from the channel.
|
||||
/// </summary>
|
||||
|
||||
@@ -77,15 +77,6 @@ namespace Renci.SshNet
|
||||
_enabledMessagesByNumber = new MessageMetadata[HighestMessageNumber + 1];
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Disables and deactivate all messages.
|
||||
/// </summary>
|
||||
public void Reset()
|
||||
{
|
||||
Array.Clear(_activatedMessagesById, 0, _activatedMessagesById.Length);
|
||||
Array.Clear(_enabledMessagesByNumber, 0, _enabledMessagesByNumber.Length);
|
||||
}
|
||||
|
||||
public Message Create(byte messageNumber)
|
||||
{
|
||||
if (messageNumber > HighestMessageNumber)
|
||||
|
||||
@@ -174,8 +174,6 @@ namespace Renci.SshNet.Tests.Classes.Channels
|
||||
|
||||
protected override void OnOpenFailure(uint reasonCode, string description, string language)
|
||||
{
|
||||
base.OnOpenFailure(reasonCode, description, language);
|
||||
|
||||
if (OnOpenFailureException != null)
|
||||
{
|
||||
throw OnOpenFailureException;
|
||||
|
||||
-124
@@ -1,124 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
using Microsoft.VisualStudio.TestTools.UnitTesting;
|
||||
|
||||
using Renci.SshNet.Common;
|
||||
using Renci.SshNet.Sftp;
|
||||
using Renci.SshNet.Sftp.Requests;
|
||||
using Renci.SshNet.Sftp.Responses;
|
||||
|
||||
namespace Renci.SshNet.Tests.Classes.Sftp.Requests.ExtendedRequests
|
||||
{
|
||||
[TestClass]
|
||||
public class FStatVfsRequestTest
|
||||
{
|
||||
private uint _protocolVersion;
|
||||
private uint _requestId;
|
||||
private byte[] _handle;
|
||||
private string _name;
|
||||
private byte[] _nameBytes;
|
||||
|
||||
[TestInitialize]
|
||||
public void Init()
|
||||
{
|
||||
var random = new Random();
|
||||
_protocolVersion = (uint)random.Next(0, int.MaxValue);
|
||||
_requestId = (uint)random.Next(0, int.MaxValue);
|
||||
_handle = new byte[random.Next(1, 10)];
|
||||
random.NextBytes(_handle);
|
||||
|
||||
_name = "fstatvfs@openssh.com";
|
||||
_nameBytes = Encoding.UTF8.GetBytes(_name);
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void Constructor()
|
||||
{
|
||||
var request = new FStatVfsRequest(_protocolVersion, _requestId, _handle, null, null);
|
||||
|
||||
Assert.AreSame(_handle, request.Handle);
|
||||
Assert.AreEqual(_name, request.Name);
|
||||
Assert.AreEqual(_protocolVersion, request.ProtocolVersion);
|
||||
Assert.AreEqual(_requestId, request.RequestId);
|
||||
Assert.AreEqual(SftpMessageTypes.Extended, request.SftpMessageType);
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void Complete_SftpStatusResponse()
|
||||
{
|
||||
IList<SftpStatusResponse> statusActionInvocations = new List<SftpStatusResponse>();
|
||||
IList<SftpExtendedReplyResponse> extendedReplyActionInvocations = new List<SftpExtendedReplyResponse>();
|
||||
|
||||
Action<SftpExtendedReplyResponse> extendedAction = extendedReplyActionInvocations.Add;
|
||||
Action<SftpStatusResponse> statusAction = statusActionInvocations.Add;
|
||||
var statusResponse = new SftpStatusResponse(_protocolVersion);
|
||||
|
||||
var request = new FStatVfsRequest(_protocolVersion, _requestId, _handle, extendedAction, statusAction);
|
||||
|
||||
request.Complete(statusResponse);
|
||||
|
||||
Assert.HasCount(1, statusActionInvocations);
|
||||
Assert.AreSame(statusResponse, statusActionInvocations[0]);
|
||||
Assert.IsEmpty(extendedReplyActionInvocations);
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void Complete_SftpExtendedReplyResponse()
|
||||
{
|
||||
IList<SftpStatusResponse> statusActionInvocations = new List<SftpStatusResponse>();
|
||||
IList<SftpExtendedReplyResponse> extendedReplyActionInvocations = new List<SftpExtendedReplyResponse>();
|
||||
|
||||
Action<SftpExtendedReplyResponse> extendedAction = extendedReplyActionInvocations.Add;
|
||||
Action<SftpStatusResponse> statusAction = statusActionInvocations.Add;
|
||||
var extendedReplyResponse = new SftpExtendedReplyResponse(_protocolVersion);
|
||||
|
||||
var request = new FStatVfsRequest(_protocolVersion, _requestId, _handle, extendedAction, statusAction);
|
||||
|
||||
request.Complete(extendedReplyResponse);
|
||||
|
||||
Assert.IsEmpty(statusActionInvocations);
|
||||
Assert.HasCount(1, extendedReplyActionInvocations);
|
||||
Assert.AreSame(extendedReplyResponse, extendedReplyActionInvocations[0]);
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void GetBytes()
|
||||
{
|
||||
var request = new FStatVfsRequest(_protocolVersion, _requestId, _handle, null, null);
|
||||
|
||||
var bytes = request.GetBytes();
|
||||
|
||||
var expectedBytesLength = 0;
|
||||
expectedBytesLength += 4; // Length
|
||||
expectedBytesLength += 1; // Type
|
||||
expectedBytesLength += 4; // RequestId
|
||||
expectedBytesLength += 4; // Name length
|
||||
expectedBytesLength += _nameBytes.Length; // Name
|
||||
expectedBytesLength += 4; // Handle length
|
||||
expectedBytesLength += _handle.Length; // Handle
|
||||
|
||||
Assert.HasCount(expectedBytesLength, bytes);
|
||||
|
||||
var sshDataStream = new SshDataStream(bytes);
|
||||
|
||||
Assert.AreEqual((uint)bytes.Length - 4, sshDataStream.ReadUInt32());
|
||||
Assert.AreEqual((byte)SftpMessageTypes.Extended, sshDataStream.ReadByte());
|
||||
Assert.AreEqual(_requestId, sshDataStream.ReadUInt32());
|
||||
Assert.AreEqual((uint)_nameBytes.Length, sshDataStream.ReadUInt32());
|
||||
|
||||
var actualNameBytes = new byte[_nameBytes.Length];
|
||||
_ = sshDataStream.Read(actualNameBytes, 0, actualNameBytes.Length);
|
||||
CollectionAssert.AreEqual(_nameBytes, actualNameBytes);
|
||||
|
||||
Assert.AreEqual((uint)_handle.Length, sshDataStream.ReadUInt32());
|
||||
|
||||
var actualHandle = new byte[_handle.Length];
|
||||
_ = sshDataStream.Read(actualHandle, 0, actualHandle.Length);
|
||||
CollectionAssert.AreEqual(_handle, actualHandle);
|
||||
|
||||
Assert.IsTrue(sshDataStream.IsEndOfData);
|
||||
}
|
||||
}
|
||||
}
|
||||
-117
@@ -1,117 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Globalization;
|
||||
using System.Text;
|
||||
|
||||
using Microsoft.VisualStudio.TestTools.UnitTesting;
|
||||
|
||||
using Renci.SshNet.Common;
|
||||
using Renci.SshNet.Sftp;
|
||||
using Renci.SshNet.Sftp.Requests;
|
||||
using Renci.SshNet.Sftp.Responses;
|
||||
|
||||
namespace Renci.SshNet.Tests.Classes.Sftp.Requests.ExtendedRequests
|
||||
{
|
||||
[TestClass]
|
||||
public class HardLinkRequestTest
|
||||
{
|
||||
private uint _protocolVersion;
|
||||
private uint _requestId;
|
||||
private string _name;
|
||||
private string _oldPath;
|
||||
private byte[] _oldPathBytes;
|
||||
private string _newPath;
|
||||
private byte[] _newPathBytes;
|
||||
private byte[] _nameBytes;
|
||||
|
||||
[TestInitialize]
|
||||
public void Init()
|
||||
{
|
||||
var random = new Random();
|
||||
_protocolVersion = (uint)random.Next(0, int.MaxValue);
|
||||
_requestId = (uint)random.Next(0, int.MaxValue);
|
||||
_oldPath = random.Next().ToString(CultureInfo.InvariantCulture);
|
||||
_oldPathBytes = Encoding.UTF8.GetBytes(_oldPath);
|
||||
_newPath = random.Next().ToString(CultureInfo.InvariantCulture);
|
||||
_newPathBytes = Encoding.UTF8.GetBytes(_newPath);
|
||||
|
||||
_name = "hardlink@openssh.com";
|
||||
_nameBytes = Encoding.UTF8.GetBytes(_name);
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void Constructor()
|
||||
{
|
||||
var request = new HardLinkRequest(_protocolVersion, _requestId, _oldPath, _newPath, null);
|
||||
|
||||
Assert.AreEqual(_name, request.Name);
|
||||
Assert.AreEqual(_newPath, request.NewPath);
|
||||
Assert.AreEqual(_oldPath, request.OldPath);
|
||||
Assert.AreEqual(_protocolVersion, request.ProtocolVersion);
|
||||
Assert.AreEqual(_requestId, request.RequestId);
|
||||
Assert.AreEqual(SftpMessageTypes.Extended, request.SftpMessageType);
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void Complete_SftpStatusResponse()
|
||||
{
|
||||
IList<SftpStatusResponse> statusActionInvocations = new List<SftpStatusResponse>();
|
||||
|
||||
Action<SftpStatusResponse> statusAction = statusActionInvocations.Add;
|
||||
var statusResponse = new SftpStatusResponse(_protocolVersion);
|
||||
|
||||
var request = new HardLinkRequest(_protocolVersion, _requestId, _oldPath, _newPath, statusAction);
|
||||
|
||||
request.Complete(statusResponse);
|
||||
|
||||
Assert.HasCount(1, statusActionInvocations);
|
||||
Assert.AreSame(statusResponse, statusActionInvocations[0]);
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void GetBytes()
|
||||
{
|
||||
var request = new HardLinkRequest(_protocolVersion, _requestId, _oldPath, _newPath, null);
|
||||
|
||||
var bytes = request.GetBytes();
|
||||
|
||||
var expectedBytesLength = 0;
|
||||
expectedBytesLength += 4; // Length
|
||||
expectedBytesLength += 1; // Type
|
||||
expectedBytesLength += 4; // RequestId
|
||||
expectedBytesLength += 4; // Name length
|
||||
expectedBytesLength += _nameBytes.Length; // Name
|
||||
expectedBytesLength += 4; // OldPath length
|
||||
expectedBytesLength += _oldPathBytes.Length; // OldPath
|
||||
expectedBytesLength += 4; // NewPath length
|
||||
expectedBytesLength += _newPathBytes.Length; // NewPath
|
||||
|
||||
Assert.HasCount(expectedBytesLength, bytes);
|
||||
|
||||
var sshDataStream = new SshDataStream(bytes);
|
||||
|
||||
Assert.AreEqual((uint)bytes.Length - 4, sshDataStream.ReadUInt32());
|
||||
Assert.AreEqual((byte)SftpMessageTypes.Extended, sshDataStream.ReadByte());
|
||||
Assert.AreEqual(_requestId, sshDataStream.ReadUInt32());
|
||||
Assert.AreEqual((uint)_nameBytes.Length, sshDataStream.ReadUInt32());
|
||||
|
||||
var actualNameBytes = new byte[_nameBytes.Length];
|
||||
_ = sshDataStream.Read(actualNameBytes, 0, actualNameBytes.Length);
|
||||
CollectionAssert.AreEqual(_nameBytes, actualNameBytes);
|
||||
|
||||
Assert.AreEqual((uint)_oldPathBytes.Length, sshDataStream.ReadUInt32());
|
||||
|
||||
var actualOldPath = new byte[_oldPathBytes.Length];
|
||||
_ = sshDataStream.Read(actualOldPath, 0, actualOldPath.Length);
|
||||
CollectionAssert.AreEqual(_oldPathBytes, actualOldPath);
|
||||
|
||||
Assert.AreEqual((uint)_newPathBytes.Length, sshDataStream.ReadUInt32());
|
||||
|
||||
var actualNewPath = new byte[_newPathBytes.Length];
|
||||
_ = sshDataStream.Read(actualNewPath, 0, actualNewPath.Length);
|
||||
CollectionAssert.AreEqual(_newPathBytes, actualNewPath);
|
||||
|
||||
Assert.IsTrue(sshDataStream.IsEndOfData);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,103 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
using Microsoft.VisualStudio.TestTools.UnitTesting;
|
||||
|
||||
using Renci.SshNet.Common;
|
||||
using Renci.SshNet.Sftp;
|
||||
using Renci.SshNet.Sftp.Requests;
|
||||
using Renci.SshNet.Sftp.Responses;
|
||||
|
||||
namespace Renci.SshNet.Tests.Classes.Sftp.Requests
|
||||
{
|
||||
[TestClass]
|
||||
public class SftpBlockRequestTest
|
||||
{
|
||||
private uint _protocolVersion;
|
||||
private uint _requestId;
|
||||
private byte[] _handle;
|
||||
private ulong _offset;
|
||||
private ulong _length;
|
||||
private uint _lockMask;
|
||||
|
||||
[TestInitialize]
|
||||
public void Init()
|
||||
{
|
||||
var random = new Random();
|
||||
|
||||
_protocolVersion = (uint)random.Next(0, int.MaxValue);
|
||||
_requestId = (uint)random.Next(0, int.MaxValue);
|
||||
_handle = new byte[random.Next(1, 10)];
|
||||
random.NextBytes(_handle);
|
||||
_offset = (ulong)random.Next(0, int.MaxValue);
|
||||
_length = (ulong)random.Next(0, int.MaxValue);
|
||||
_lockMask = (uint)random.Next(0, int.MaxValue);
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void Constructor()
|
||||
{
|
||||
var request = new SftpBlockRequest(_protocolVersion, _requestId, _handle, _offset, _length, _lockMask, null);
|
||||
|
||||
Assert.AreSame(_handle, request.Handle);
|
||||
Assert.AreEqual(_length, request.Length);
|
||||
Assert.AreEqual(_lockMask, request.LockMask);
|
||||
Assert.AreEqual(_offset, request.Offset);
|
||||
Assert.AreEqual(_protocolVersion, request.ProtocolVersion);
|
||||
Assert.AreEqual(_requestId, request.RequestId);
|
||||
Assert.AreEqual(SftpMessageTypes.Block, request.SftpMessageType);
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void Complete_SftpStatusResponse()
|
||||
{
|
||||
IList<SftpStatusResponse> statusActionInvocations = new List<SftpStatusResponse>();
|
||||
|
||||
Action<SftpStatusResponse> statusAction = statusActionInvocations.Add;
|
||||
var statusResponse = new SftpStatusResponse(_protocolVersion);
|
||||
|
||||
var request = new SftpBlockRequest(_protocolVersion, _requestId, _handle, _offset, _length, _lockMask, statusAction);
|
||||
|
||||
request.Complete(statusResponse);
|
||||
|
||||
Assert.HasCount(1, statusActionInvocations);
|
||||
Assert.AreSame(statusResponse, statusActionInvocations[0]);
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void GetBytes()
|
||||
{
|
||||
var request = new SftpBlockRequest(_protocolVersion, _requestId, _handle, _offset, _length, _lockMask, null);
|
||||
|
||||
var bytes = request.GetBytes();
|
||||
|
||||
var expectedBytesLength = 0;
|
||||
expectedBytesLength += 4; // Length
|
||||
expectedBytesLength += 1; // Type
|
||||
expectedBytesLength += 4; // RequestId
|
||||
expectedBytesLength += 4; // Handle length
|
||||
expectedBytesLength += _handle.Length; // Handle
|
||||
expectedBytesLength += 8; // Offset
|
||||
expectedBytesLength += 8; // Length
|
||||
expectedBytesLength += 4; // LockMask
|
||||
|
||||
Assert.HasCount(expectedBytesLength, bytes);
|
||||
|
||||
var sshDataStream = new SshDataStream(bytes);
|
||||
|
||||
Assert.AreEqual((uint)bytes.Length - 4, sshDataStream.ReadUInt32());
|
||||
Assert.AreEqual((byte)SftpMessageTypes.Block, sshDataStream.ReadByte());
|
||||
Assert.AreEqual(_requestId, sshDataStream.ReadUInt32());
|
||||
|
||||
Assert.AreEqual((uint)_handle.Length, sshDataStream.ReadUInt32());
|
||||
var actualHandle = new byte[_handle.Length];
|
||||
_ = sshDataStream.Read(actualHandle, 0, actualHandle.Length);
|
||||
CollectionAssert.AreEqual(_handle, actualHandle);
|
||||
|
||||
Assert.AreEqual(_offset, sshDataStream.ReadUInt64());
|
||||
Assert.AreEqual(_length, sshDataStream.ReadUInt64());
|
||||
Assert.AreEqual(_lockMask, sshDataStream.ReadUInt32());
|
||||
Assert.IsTrue(sshDataStream.IsEndOfData);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,111 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Globalization;
|
||||
using System.Text;
|
||||
|
||||
using Microsoft.VisualStudio.TestTools.UnitTesting;
|
||||
|
||||
using Renci.SshNet.Common;
|
||||
using Renci.SshNet.Sftp;
|
||||
using Renci.SshNet.Sftp.Requests;
|
||||
using Renci.SshNet.Sftp.Responses;
|
||||
|
||||
namespace Renci.SshNet.Tests.Classes.Sftp.Requests
|
||||
{
|
||||
[TestClass]
|
||||
public class SftpLinkRequestTest
|
||||
{
|
||||
private uint _protocolVersion;
|
||||
private uint _requestId;
|
||||
private string _newLinkPath;
|
||||
private byte[] _newLinkPathBytes;
|
||||
private string _existingPath;
|
||||
private byte[] _existingPathBytes;
|
||||
|
||||
[TestInitialize]
|
||||
public void Init()
|
||||
{
|
||||
var random = new Random();
|
||||
|
||||
_protocolVersion = (uint)random.Next(0, int.MaxValue);
|
||||
_requestId = (uint)random.Next(0, int.MaxValue);
|
||||
_newLinkPath = random.Next().ToString(CultureInfo.InvariantCulture);
|
||||
_newLinkPathBytes = Encoding.UTF8.GetBytes(_newLinkPath);
|
||||
_existingPath = random.Next().ToString(CultureInfo.InvariantCulture);
|
||||
_existingPathBytes = Encoding.UTF8.GetBytes(_existingPath);
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void Constructor()
|
||||
{
|
||||
var request = new SftpLinkRequest(_protocolVersion, _requestId, _newLinkPath, _existingPath, true, null);
|
||||
|
||||
Assert.AreEqual(_existingPath, request.ExistingPath);
|
||||
Assert.IsTrue(request.IsSymLink);
|
||||
Assert.AreEqual(_newLinkPath, request.NewLinkPath);
|
||||
Assert.AreEqual(_protocolVersion, request.ProtocolVersion);
|
||||
Assert.AreEqual(_requestId, request.RequestId);
|
||||
Assert.AreEqual(SftpMessageTypes.Link, request.SftpMessageType);
|
||||
|
||||
request = new SftpLinkRequest(_protocolVersion, _requestId, _newLinkPath, _existingPath, false, null);
|
||||
|
||||
Assert.IsFalse(request.IsSymLink);
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void Complete_SftpStatusResponse()
|
||||
{
|
||||
var statusActionInvocations = new List<SftpStatusResponse>();
|
||||
|
||||
Action<SftpStatusResponse> statusAction = statusActionInvocations.Add;
|
||||
var statusResponse = new SftpStatusResponse(_protocolVersion);
|
||||
|
||||
var request = new SftpLinkRequest(_protocolVersion, _requestId, _newLinkPath, _existingPath, true, statusAction);
|
||||
|
||||
request.Complete(statusResponse);
|
||||
|
||||
Assert.HasCount(1, statusActionInvocations);
|
||||
Assert.AreSame(statusResponse, statusActionInvocations[0]);
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void GetBytes()
|
||||
{
|
||||
var request = new SftpLinkRequest(_protocolVersion, _requestId, _newLinkPath, _existingPath, true, null);
|
||||
|
||||
var bytes = request.GetBytes();
|
||||
|
||||
var expectedBytesLength = 0;
|
||||
expectedBytesLength += 4; // Length
|
||||
expectedBytesLength += 1; // Type
|
||||
expectedBytesLength += 4; // RequestId
|
||||
expectedBytesLength += 4; // NewLinkPath length
|
||||
expectedBytesLength += _newLinkPathBytes.Length; // NewLinkPath
|
||||
expectedBytesLength += 4; // ExistingPath length
|
||||
expectedBytesLength += _existingPathBytes.Length; // ExistingPath
|
||||
expectedBytesLength += 1; // IsSymLink
|
||||
|
||||
Assert.HasCount(expectedBytesLength, bytes);
|
||||
|
||||
var sshDataStream = new SshDataStream(bytes);
|
||||
|
||||
Assert.AreEqual((uint)bytes.Length - 4, sshDataStream.ReadUInt32());
|
||||
Assert.AreEqual((byte)SftpMessageTypes.Link, sshDataStream.ReadByte());
|
||||
Assert.AreEqual(_requestId, sshDataStream.ReadUInt32());
|
||||
|
||||
Assert.AreEqual((uint)_newLinkPathBytes.Length, sshDataStream.ReadUInt32());
|
||||
var actualNewLinkPath = new byte[_newLinkPathBytes.Length];
|
||||
_ = sshDataStream.Read(actualNewLinkPath, 0, actualNewLinkPath.Length);
|
||||
CollectionAssert.AreEqual(_newLinkPathBytes, actualNewLinkPath);
|
||||
|
||||
Assert.AreEqual((uint)_existingPathBytes.Length, sshDataStream.ReadUInt32());
|
||||
var actualExistingPath = new byte[_existingPathBytes.Length];
|
||||
_ = sshDataStream.Read(actualExistingPath, 0, actualExistingPath.Length);
|
||||
CollectionAssert.AreEqual(_existingPathBytes, actualExistingPath);
|
||||
|
||||
Assert.AreEqual(1, sshDataStream.ReadByte());
|
||||
|
||||
Assert.IsTrue(sshDataStream.IsEndOfData);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,129 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Globalization;
|
||||
using System.Text;
|
||||
|
||||
using Microsoft.VisualStudio.TestTools.UnitTesting;
|
||||
|
||||
using Renci.SshNet.Common;
|
||||
using Renci.SshNet.Sftp;
|
||||
using Renci.SshNet.Sftp.Requests;
|
||||
using Renci.SshNet.Sftp.Responses;
|
||||
|
||||
namespace Renci.SshNet.Tests.Classes.Sftp.Requests
|
||||
{
|
||||
[TestClass]
|
||||
public class SftpReadLinkRequestTest
|
||||
{
|
||||
private uint _protocolVersion;
|
||||
private uint _requestId;
|
||||
private Encoding _encoding;
|
||||
private string _path;
|
||||
private byte[] _pathBytes;
|
||||
|
||||
[TestInitialize]
|
||||
public void Init()
|
||||
{
|
||||
var random = new Random();
|
||||
|
||||
_protocolVersion = (uint)random.Next(0, int.MaxValue);
|
||||
_requestId = (uint)random.Next(0, int.MaxValue);
|
||||
_encoding = Encoding.Unicode;
|
||||
_path = random.Next().ToString(CultureInfo.InvariantCulture);
|
||||
_pathBytes = _encoding.GetBytes(_path);
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void Constructor()
|
||||
{
|
||||
var request = new SftpReadLinkRequest(_protocolVersion, _requestId, _path, _encoding, null, null);
|
||||
|
||||
Assert.AreSame(_encoding, request.Encoding);
|
||||
Assert.AreEqual(_path, request.Path);
|
||||
Assert.AreEqual(_protocolVersion, request.ProtocolVersion);
|
||||
Assert.AreEqual(_requestId, request.RequestId);
|
||||
Assert.AreEqual(SftpMessageTypes.ReadLink, request.SftpMessageType);
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void Complete_SftpNameResponse()
|
||||
{
|
||||
var statusActionInvocations = new List<SftpStatusResponse>();
|
||||
var nameActionInvocations = new List<SftpNameResponse>();
|
||||
|
||||
Action<SftpStatusResponse> statusAction = statusActionInvocations.Add;
|
||||
Action<SftpNameResponse> nameAction = nameActionInvocations.Add;
|
||||
var nameResponse = new SftpNameResponse(_protocolVersion, Encoding.Unicode);
|
||||
|
||||
var request = new SftpReadLinkRequest(
|
||||
_protocolVersion,
|
||||
_requestId,
|
||||
_path,
|
||||
_encoding,
|
||||
nameAction,
|
||||
statusAction);
|
||||
|
||||
request.Complete(nameResponse);
|
||||
|
||||
Assert.IsEmpty(statusActionInvocations);
|
||||
Assert.HasCount(1, nameActionInvocations);
|
||||
Assert.AreSame(nameResponse, nameActionInvocations[0]);
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void Complete_SftpStatusResponse()
|
||||
{
|
||||
var statusActionInvocations = new List<SftpStatusResponse>();
|
||||
var nameActionInvocations = new List<SftpNameResponse>();
|
||||
|
||||
Action<SftpStatusResponse> statusAction = statusActionInvocations.Add;
|
||||
Action<SftpNameResponse> nameAction = nameActionInvocations.Add;
|
||||
var statusResponse = new SftpStatusResponse(_protocolVersion);
|
||||
|
||||
var request = new SftpReadLinkRequest(
|
||||
_protocolVersion,
|
||||
_requestId,
|
||||
_path,
|
||||
_encoding,
|
||||
nameAction,
|
||||
statusAction);
|
||||
|
||||
request.Complete(statusResponse);
|
||||
|
||||
Assert.HasCount(1, statusActionInvocations);
|
||||
Assert.AreSame(statusResponse, statusActionInvocations[0]);
|
||||
Assert.IsEmpty(nameActionInvocations);
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void GetBytes()
|
||||
{
|
||||
var request = new SftpReadLinkRequest(_protocolVersion, _requestId, _path, _encoding, null, null);
|
||||
|
||||
var bytes = request.GetBytes();
|
||||
|
||||
var expectedBytesLength = 0;
|
||||
expectedBytesLength += 4; // Length
|
||||
expectedBytesLength += 1; // Type
|
||||
expectedBytesLength += 4; // RequestId
|
||||
expectedBytesLength += 4; // Path length
|
||||
expectedBytesLength += _pathBytes.Length; // Path
|
||||
|
||||
Assert.HasCount(expectedBytesLength, bytes);
|
||||
|
||||
var sshDataStream = new SshDataStream(bytes);
|
||||
|
||||
Assert.AreEqual((uint)bytes.Length - 4, sshDataStream.ReadUInt32());
|
||||
Assert.AreEqual((byte)SftpMessageTypes.ReadLink, sshDataStream.ReadByte());
|
||||
Assert.AreEqual(_requestId, sshDataStream.ReadUInt32());
|
||||
|
||||
Assert.AreEqual((uint)_pathBytes.Length, sshDataStream.ReadUInt32());
|
||||
var actualPath = new byte[_pathBytes.Length];
|
||||
_ = sshDataStream.Read(actualPath, 0, actualPath.Length);
|
||||
CollectionAssert.AreEqual(_pathBytes, actualPath);
|
||||
|
||||
Assert.IsTrue(sshDataStream.IsEndOfData);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,96 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
using Microsoft.VisualStudio.TestTools.UnitTesting;
|
||||
|
||||
using Renci.SshNet.Common;
|
||||
using Renci.SshNet.Sftp;
|
||||
using Renci.SshNet.Sftp.Requests;
|
||||
using Renci.SshNet.Sftp.Responses;
|
||||
|
||||
namespace Renci.SshNet.Tests.Classes.Sftp.Requests
|
||||
{
|
||||
[TestClass]
|
||||
public class SftpUnblockRequestTest
|
||||
{
|
||||
private uint _protocolVersion;
|
||||
private uint _requestId;
|
||||
private byte[] _handle;
|
||||
private ulong _offset;
|
||||
private ulong _length;
|
||||
|
||||
[TestInitialize]
|
||||
public void Init()
|
||||
{
|
||||
var random = new Random();
|
||||
|
||||
_protocolVersion = (uint)random.Next(0, int.MaxValue);
|
||||
_requestId = (uint)random.Next(0, int.MaxValue);
|
||||
_handle = new byte[random.Next(1, 10)];
|
||||
random.NextBytes(_handle);
|
||||
_offset = (ulong)random.Next(0, int.MaxValue);
|
||||
_length = (ulong)random.Next(0, int.MaxValue);
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void Constructor()
|
||||
{
|
||||
var request = new SftpUnblockRequest(_protocolVersion, _requestId, _handle, _offset, _length, null);
|
||||
|
||||
Assert.AreSame(_handle, request.Handle);
|
||||
Assert.AreEqual(_protocolVersion, request.ProtocolVersion);
|
||||
Assert.AreEqual(_requestId, request.RequestId);
|
||||
Assert.AreEqual(SftpMessageTypes.Unblock, request.SftpMessageType);
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void Complete_SftpStatusResponse()
|
||||
{
|
||||
var statusActionInvocations = new List<SftpStatusResponse>();
|
||||
Action<SftpStatusResponse> statusAction = statusActionInvocations.Add;
|
||||
var statusResponse = new SftpStatusResponse(_protocolVersion);
|
||||
|
||||
var request = new SftpUnblockRequest(_protocolVersion, _requestId, _handle, _offset, _length, statusAction);
|
||||
|
||||
request.Complete(statusResponse);
|
||||
|
||||
Assert.HasCount(1, statusActionInvocations);
|
||||
Assert.AreSame(statusResponse, statusActionInvocations[0]);
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void GetBytes()
|
||||
{
|
||||
var request = new SftpUnblockRequest(_protocolVersion, _requestId, _handle, _offset, _length, null);
|
||||
|
||||
var bytes = request.GetBytes();
|
||||
|
||||
var expectedBytesLength = 0;
|
||||
expectedBytesLength += 4; // Length
|
||||
expectedBytesLength += 1; // Type
|
||||
expectedBytesLength += 4; // RequestId
|
||||
expectedBytesLength += 4; // Handle length
|
||||
expectedBytesLength += _handle.Length; // Handle
|
||||
expectedBytesLength += 8; // Offset
|
||||
expectedBytesLength += 8; // Length
|
||||
|
||||
Assert.HasCount(expectedBytesLength, bytes);
|
||||
|
||||
var sshDataStream = new SshDataStream(bytes);
|
||||
|
||||
Assert.AreEqual((uint)bytes.Length - 4, sshDataStream.ReadUInt32());
|
||||
Assert.AreEqual((byte)SftpMessageTypes.Unblock, sshDataStream.ReadByte());
|
||||
Assert.AreEqual(_requestId, sshDataStream.ReadUInt32());
|
||||
|
||||
Assert.AreEqual((uint)_handle.Length, sshDataStream.ReadUInt32());
|
||||
var actualHandle = new byte[_handle.Length];
|
||||
_ = sshDataStream.Read(actualHandle, 0, actualHandle.Length);
|
||||
CollectionAssert.AreEqual(_handle, actualHandle);
|
||||
|
||||
Assert.AreEqual(_offset, sshDataStream.ReadUInt64());
|
||||
Assert.AreEqual(_length, sshDataStream.ReadUInt64());
|
||||
|
||||
Assert.IsTrue(sshDataStream.IsEndOfData);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user