Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix Seek Operations in SftpFileStream #910

Merged
merged 7 commits into from Nov 29, 2022
Merged

Fix Seek Operations in SftpFileStream #910

merged 7 commits into from Nov 29, 2022

Conversation

lemonyte
Copy link
Contributor

@lemonyte lemonyte commented Jan 5, 2022

Changed SftpFileStream.Seek() to add offset instead of subtracting when origin is set to SeekOrigin.End. Fixes #909, fixes #1018.

Copy link
Collaborator

@IgorMilavec IgorMilavec left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch!

Can you also cover cases for invalid origin and trying to move before the beginning of the file? Here are the exceptions I feel would better describe the problems (and are somewhat aligned with the FileStream behavior):

throw new ArgumentException("Invalid seek origin.", "origin")
throw new IOException("An attempt was made to move the file pointer before the beginning of the file.");
throw new EndOfStreamException("An attempt was made to move the file pointer past the end of the file.");

I see that you have changed formatting of the code. Based on my past experience the maintainer will request you to undo these changes.

Can you add tests for the cases you mentioned were not covered?

@lemonyte
Copy link
Contributor Author

lemonyte commented Jan 25, 2022

I see that you have changed formatting of the code.

I am not sure what formatting changes you are referring to. The only change other than replacing - with + was the removal of a duplicate identical code block, as below:

if (condition)
{
    // Condition specific code

    switch (origin)
    {
        // ...
    }

    if (newPosn == -1)
    {
        throw new EndOfStreamException("End of stream.");
    }
    _position = newPosn;
}
else
{
    // Condition specific code

    switch (origin)
    {
        // ...
    }

    if (newPosn < 0)
    {
        throw new EndOfStreamException();
    }
    _position = newPosn;
}

Refactored to:

if (condition)
{
    // Condition specific code
}
else
{
    // Condition specific code
}

switch (origin)
{
    // ...
}
if (newPosn < 0)
{
    throw new EndOfStreamException("End of stream.");
}
_position = newPosn;
throw new EndOfStreamException("An attempt was made to move the file pointer past the end of the file.");

I think a seek operation past the end of a file is a valid operation, but correct me if I am wrong. Most platforms allow seeking past the end of a file, only raising an exception when a read is attempted after EOF. A case for seeking before the beginning of a file already exists:

throw new EndOfStreamException("End of stream.");

throw new EndOfStreamException();

Can you add tests for the cases you mentioned were not covered?

I am not very experienced in C#, being primarily a Python developer, but I'll see what I can reverse-engineer from the existing tests. Some guidance on how to use the available tests would be much appreciated.

@IgorMilavec
Copy link
Collaborator

To run the tests in VS 2019, open Test Explorer and you will see a list of tests. Filter Traits (there is a filter icon at the column heading) and deselect "integration" and "LongRunning". Then run all the tests from Test Explorer.

To cover this scenario, you create new test classes SftpFileStreamTest_Seek_PositionedAtBeginningOfStream_OriginEndAndOffset* by copiing SftpFileStreamTest_Seek_PositionedAtBeginningOfStream_OriginBeginAndOffset* and adjusting appropriately.

Also, due to the changes in this PR, the SeekShouldHaveThrownEndOfStreamException test is failing, I will flag the probable cause for this in the code review.

_position = newPosn;
if (newPosn < 0)
{
throw new EndOfStreamException("End of stream.");
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You are providing a non-default exception message, causing the test SeekShouldHaveThrownEndOfStreamException to fail. I beleive if you just use throw new EndOfStreamException(); this will be fixed.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for pointing that out. The exception message is already present in another part of the code, so I assumed I should leave it in there.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@drieseng There have been suggestions in other issues that we should localize exception messages. While that is probably too much work at this time, I propose to use default exception messages where possible and to stop checking error messages in the tests and rely on only asserting exception type (and other structured info in the exception) in the tests. Do you agree?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have noticed that the exception message format is different across .NET versions. For example:
.NET Framework 3.5

ArgumentException error message.
Parameter name: ParamName

.NET Core 3.0

ArgumentException error message. (Parameter 'ParamName')

This causes some tests to pass on one framework and fail on another.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@IgorMilavec, in general I prefer very specific asserts. To be honest, I think we have more important stuff to deal with than localization. But I'm ok to discuss this as a team, and decide where we want to go with this.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@LemonPi314, that's indeed something I was already aware of and which I dealt with in other (professional) projects.

@IgorMilavec
Copy link
Collaborator

Changed SftpFileStream.Seek() to add offset instead of subtracting when origin is set to SeekOrigin.End. (#909)

@LemonPi314 can you please edit the above to include "Fix #909" so this PR will be linked to the issue? Tnx!

@daviburg
Copy link
Collaborator

Test case for the error(s) been fixed is still needed in this PR.

@daviburg
Copy link
Collaborator

Can you also cover cases for invalid origin and trying to move before the beginning of the file? Here are the exceptions I feel would better describe the problems (and are somewhat aligned with the FileStream behavior):

throw new ArgumentException("Invalid seek origin.", "origin")
throw new IOException("An attempt was made to move the file pointer before the beginning of the file.");
throw new EndOfStreamException("An attempt was made to move the file pointer past the end of the file.");

I second this suggestion to use specific and descriptive exceptions.

@daviburg
Copy link
Collaborator

I see that you have changed formatting of the code. Based on my past experience the maintainer will request you to undo these changes.

I am ambivalent about that. If the formatting change is specific to the code been already updated for the fix, and covered by the tests, I find it a good opportunity to clean up.
If the formatting change is extensive and makes it difficult to understand the functional change, I can see how that may best be done in a separate PR.

@drieseng
Copy link
Member

I am ambivalent about that. If the formatting change is specific to the code been already updated for the fix, and covered by the tests, I find it a good opportunity to clean up. If the formatting change is extensive and makes it difficult to understand the functional change, I can see how that may best be done in a separate PR.

In general, I prefer a separate PR unless we're talking about a very minimal change.
To avoid discussions on what such a minimal change is, it may be better to not mix formatting and non-formatting changes at all.

@lemonyte
Copy link
Contributor Author

I've added tests for seeking from SeekOrigin.End.
Regarding formatting changes, to be frank I do not see what formatting exactly is causing an issue, but I will keep your feedback in mind for future contributions.
As for exceptions and exception messages, those are out of the scope of this PR, and would best be addressed separately in a new PR.

I do not want to pull this thread any more off-topic than it already is, but I think it is worth noting that while developing this PR I've encountered several issues with the tests. Notably, failures in tests unrelated to the changed portions (see AppVeyor checks 45419708 and 45419751), and failures caused by exception messages not matching (see below and this comment).

 Ctor_PartialSuccessLimit_Zero
   Source: ClientAuthenticationTest.cs line 19
   Duration: < 1 ms

  Message: 
    Assert.AreEqual failed. Expected:<Cannot be less than one.
    Parameter name: partialSuccessLimit>. Actual:<Cannot be less than one. (Parameter 'partialSuccessLimit')>. 

  Stack Trace: 
    ClientAuthenticationTest.Ctor_PartialSuccessLimit_Zero() line 31

If there is anything else I can do to improve this PR, let me know. In any case, hopefully this fix is merged soon.

@drieseng
Copy link
Member

drieseng commented Nov 19, 2022

@LemonPi314, your changes are looking good. Thanks!

I'd only like to hold off on merging until I (or someone else) had time to add a few integration tests for this.
Should this take too long, do not hesitate to spam me :-)

@drieseng
Copy link
Member

I'll submit a PR for the integration test changes once sshnet/IntegrationTests#8 has landed.

drieseng added a commit to sshnet/IntegrationTests that referenced this pull request Nov 29, 2022
* Add tests for SftpFileStream.Seek(...) to cover sshnet/SSH.NET#910.

* Review feedback.
.gitignore Outdated
@@ -22,3 +22,6 @@ project.lock.json

# Build outputs
build/target/

# Visual Studio cache/options directory
.vs/
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please add leading forward slash since this ignore only applies to the root directory of the repo.

_position = newPosn;
if (newPosn < 0)
{
throw new EndOfStreamException("End of stream.");
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@IgorMilavec, in general I prefer very specific asserts. To be honest, I think we have more important stuff to deal with than localization. But I'm ok to discuss this as a team, and decide where we want to go with this.

_position = newPosn;
if (newPosn < 0)
{
throw new EndOfStreamException("End of stream.");
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@LemonPi314, that's indeed something I was already aware of and which I dealt with in other (professional) projects.

src/Renci.SshNet/Sftp/SftpFileStream.cs Outdated Show resolved Hide resolved
src/Renci.SshNet/Sftp/SftpFileStream.cs Show resolved Hide resolved
@drieseng drieseng merged commit f3ebc29 into sshnet:develop Nov 29, 2022
drieseng pushed a commit that referenced this pull request May 24, 2023
* Fix offset operations in SftpFileStream.Seek
* Fix seek exception message and add default case for invalid seek origin
* Use named params when throwing ArgumentException
* Add tests for seeking from end of file
@WojciechNagorski WojciechNagorski added this to the vNext milestone Sep 13, 2023
WojciechNagorski added a commit that referenced this pull request Oct 10, 2023
* Assets/logos (#782)

* Added logo assets

* Added PNG 1260x640 with white border

Co-authored-by: 103filgualan <f.gualandi@crif.com>

* OPENSSH KeyReader for more keys (#614)

* OPENSSH KeyReader for more keys

Add support to parse OpenSSH Keys with ECDSA 256/384/521 and RSA.

https://github.com/openssh/openssh-portable/blob/master/PROTOCOL.key

Change-Id: Iaa9cce0f2522e5fee377a82cb252f81f0b7cc563

* Fix ED25519Key KeyLength

* Fix ED25519 PubKey-auth

LeadingZeros of BigInteger-Conversion have to be removed
before sending the Key.

* Add interface to SftpFile #120 (#812)

* Create ISftpFile interface. SftpFile sealed. Return ISftpFile from SftpClient instead of SftpFile. Make ISftpClient interface disposable.

Co-authored-by: Wojciech Swieboda <wswieboda@chathamfinancial.com>

* Start MessageListener with ThreadAbstraction.ExecuteThreadLongRunning (#902)

* Fix Thread pool exhaustion due to MessageListener running on ThreadPool
* Mark long running thread as background

* Add async support to SftpClient and SftpFileStream (#819)

* Add FEATURE_TAP and net472 target
* Add TAP async support to SftpClient and SftpFileStream
* Add async support to DnsAbstraction and SocketAbstraction
* Add async support to *Connector and refactor the hierarchy
* Add ConnectAsync to BaseClient

* Add CODEOWNERS file.

* Fix virus false-positive by Defender on Renci.SSHNet.Tests.dll (#867)

Co-authored-by: Pedro Fonseca <pfonseca@qti.qualcomm.com>

* Add unit tests for task-based asynchronous API (#906)

* Fix runtime and culture dependant tests.
* Set C# 7.3 in Tests.csproj to limit intellisense's suggestions under different targets
* Add SftpClientTest.*Async
* Add SftpFileStreamTest_OpenAsync_*
* Add SftpFileStreamTest_WriteAsync_*
* Add SftpFileStreamTest_ReadAsync_*
* Align AppVeyor script with Test project target frameworks

* correct 'Documenation' to 'Documentation' (#838)

in the documentation's window title

* Agent auth and Keygen (#794)

* Allow to set PrivateKeyFile Key directly
   So you can add your own Key-Classes to SSH.NET
* Add ED25519 ctor for just pub key part.
* Make ECDSA Key Bits accessible
   You cant export imported CngKeys. To be able to export them to agent or Key-Files make the private bits also accessible.
* Better NETFRAMEWORK vs NETSTANDARD handling
* Add Comment Property to Key
* Add IPrivateKeySource
  So Extension can add own PrivateKeyFiles, e.g. PuttyKeyFile.

* Use cryptographically secure random number generator.
Fixes CVE-2022-29245.

* Remove unused import.

* Add IBaseClient for BaseClient and ISftpClient to inherit from (#975)

Add IBaseClient for BaseClient and ISftpClient to inherit from

* fix typo (#999)

* Fix Seek Operations in SftpFileStream (#910)

* Fix offset operations in SftpFileStream.Seek
* Fix seek exception message and add default case for invalid seek origin
* Use named params when throwing ArgumentException
* Add tests for seeking from end of file

* Add back copyright to license. (#1060)

Fixes #1059.

* Removing old target frameworks (#1109)

Remove support for legacy / deprecated target frameworks while adding support for .NET 6.0 (and higher).
The supported target frameworks are now:
* .NETFramework 4.6.2 (and higher)
* .NET Standard 2.0
* .NET 6.0 (and higher)

* Remove old features [Part 1] (#1117)

Remove obsolete feature switches (now that we've remove support for legacy target frameworks) and remove corresponding conditional code.

* Remove FEATURE_DIRECTORYINFO_ENUMERATEFILES (#1119)

* Remove FEATURE_DIRECTORYINFO_ENUMERATEFILES
* Add exception documentation

* Fix some (lots of) issues reported by analyzers. (#1125)

Fix some (lots of) issues reported by analyzers.

* Round 2 of analyzer fixes and general cleanup. (#1132)

* Analyzer fixes round 3. (#1135)

* Replace Array<T>.Empty with Array.Empty<T>() (#1137)

* Replace IsNullOrWhiteSpace extension (#1142)

* Use License Expression for NuGet Package

licenseUrl is deprecated, see NuGet/Announcements#32

* Integration tests

* Remove todos

* Update CODEOWNERS

* Use correct SSH.NET

* ListDirectoryAsync return IAsyncEnumerable (#1126)

* ListDirectoryAsync return IAsyncEnumerable

* Fix documentation

* Update README.md

* Fix

* Add Sftp ListDirectoryAsync test

* Revert

* Integration tests for ListDirectoryAsync with IAsyncEnumerable

* Fix the assembly resolution build warning (#1165)

* Delete performance/longrunning tests (#1143)

Co-authored-by: Wojciech Nagórski <wojtpl2@gmail.com>

* Move Integration tests (#1173)

* Renci.SshNet.IntegrationTests

* Renci.SshNet.TestTools.OpenSSH

* Move integration tests to main repo

* Move old tests to new integration tests

* Move old integration tests to new integration tests

* Move more tests

* Move authentication tests

* Move SshClientTests

* Fix some tests

* Remove duplicated test

* Poc of ProcessDisruptor

* Rename

* Some fixes

* Remove performance tests

* Small improvements

* Add a benchmarks project (#1151)

* Add a benchmarks project

* Small improvements

---------

Co-authored-by: Wojciech Nagórski <wojtpl2@gmail.com>

* Use ExceptionDispatchInfo to retain call stack in Session.WaitOnHandle() (#936)

* Use ExceptionDispatchInfo to retain call stack in Session.WaitOnHandle()

* merge

* Update src/Renci.SshNet/Session.cs

Co-authored-by: Rob Hague <rob.hague00@gmail.com>

---------

Co-authored-by: Wojciech Nagórski <wojtpl2@gmail.com>
Co-authored-by: Rob Hague <rob.hague00@gmail.com>

* Support SHA256 fingerprints for host key validation (#1098)

* Add tests for HostKeyEventArgs

* Add SHA256 fingerprint support

* Add support for RSA SHA-2 public key algorithms (#1177)

* Abstract out the hash algorithm from RsaDigitalSignature

* Add integration tests

* Add DigitalSignature property to KeyHostAlgorithm

* Add IHostAlgorithmsProvider interface

* Verify the host signature

* Fix HostKeyEventArgsTest after merge

* Remove PubkeyAcceptedAlgorithms ssh-rsa

* Add test coverage for RSA keys in PrivateKeyFile

* Obsolete IPrivateKeySource

---------

Co-authored-by: Wojciech Nagórski <wojtpl2@gmail.com>

* Improvements after #1177 (#1180)

* Use ExceptionDispatchInfo in more places (#1182)

Co-authored-by: Wojciech Nagórski <wojtpl2@gmail.com>

* Try to "fix" the flaky test (#1185)

* Enable DSA tests (#1181)

Co-authored-by: Wojciech Nagórski <wojtpl2@gmail.com>

* FingerPrints (#1186)

* Use OS-agnostic socket error codes to allow tests run on different OSes (#1179)

SocketErrorCode is OS agnostic, ErrorCode is OS specific.

On Windows ErrorCode = (int) SocketErrorCode, but on Mac and Unix it is not.

For example ExitCode for HostNotFound (11001) on Windows is 11001, on Mac & Unix is -131073. So testing for ExitCode == 11001 fails on Mac & Unix.

Co-authored-by: Wojciech Nagórski <wojtpl2@gmail.com>

* Fix for channel session semaphore from thread blocking (#1071)

* Merging fix from @clivetong into our own SSH.NET fork
- The following article describes some of the issues with the double check lock that we have seen issues with: https://www.sudhanshutheone.com/posts/double-check-lock-csharp

* Merging fix from @clivetong into our own SSH.NET fork
- The following article describes some of the issues with the double check lock that we have seen issues with: https://www.sudhanshutheone.com/posts/double-check-lock-csharp

* Update Channel to fix AppVeyor failure (field should be readonly)

* Update ISftpClient for #120 (#1193)

* Implement set last write and access time (#1194)

* Add/migrate hmac+cipher integration tests (#1189)

* Add/migrate hmac+cipher integration tests

* fix integration tests

---------

Co-authored-by: Wojciech Nagórski <wojtpl2@gmail.com>

* Update tests for SetLastAccessTime(Utc) to also verify the time component and the Kind of the DateTime value returned by GetLastAccessTime(Utc). (#1198)

---------

Co-authored-by: Filippo Gualandi <filippo.gualandi@gmail.com>
Co-authored-by: 103filgualan <f.gualandi@crif.com>
Co-authored-by: Stefan Rinkes <darinkes@users.noreply.github.com>
Co-authored-by: wxtsxt <wojciech.swieboda@gmail.com>
Co-authored-by: Wojciech Swieboda <wswieboda@chathamfinancial.com>
Co-authored-by: Igor Milavec <igor.milavec@gmail.com>
Co-authored-by: drieseng <gert.driesen@telenet.be>
Co-authored-by: Pedro Fonseca <pbfonseca@gmail.com>
Co-authored-by: Pedro Fonseca <pfonseca@qti.qualcomm.com>
Co-authored-by: Maximiliano Jabase <maxijabase@gmail.com>
Co-authored-by: Owen Krueger <37021716+Owen-Krueger@users.noreply.github.com>
Co-authored-by: Masuri <psh0258@gmail.com>
Co-authored-by: LemonPi314 <49930425+LemonPi314@users.noreply.github.com>
Co-authored-by: Gert Driesen <gertdriesen@msn.com>
Co-authored-by: Rob Hague <rob.hague00@gmail.com>
Co-authored-by: Rob Hague <rh@johnstreetcapital.com>
Co-authored-by: Marius Thesing <marius.thesing@gmail.com>
Co-authored-by: Dāvis Mošenkovs <davikovs@gmail.com>
Co-authored-by: Dmitry Tsarevich <dimhotepus@users.noreply.github.com>
Co-authored-by: Patrick Yates <114094360+patrick-yates-redgate@users.noreply.github.com>
WojciechNagorski added a commit that referenced this pull request Dec 29, 2023
* Release 2023.0.0 (#1201)

* Assets/logos (#782)

* Added logo assets

* Added PNG 1260x640 with white border

Co-authored-by: 103filgualan <f.gualandi@crif.com>

* OPENSSH KeyReader for more keys (#614)

* OPENSSH KeyReader for more keys

Add support to parse OpenSSH Keys with ECDSA 256/384/521 and RSA.

https://github.com/openssh/openssh-portable/blob/master/PROTOCOL.key

Change-Id: Iaa9cce0f2522e5fee377a82cb252f81f0b7cc563

* Fix ED25519Key KeyLength

* Fix ED25519 PubKey-auth

LeadingZeros of BigInteger-Conversion have to be removed
before sending the Key.

* Add interface to SftpFile #120 (#812)

* Create ISftpFile interface. SftpFile sealed. Return ISftpFile from SftpClient instead of SftpFile. Make ISftpClient interface disposable.

Co-authored-by: Wojciech Swieboda <wswieboda@chathamfinancial.com>

* Start MessageListener with ThreadAbstraction.ExecuteThreadLongRunning (#902)

* Fix Thread pool exhaustion due to MessageListener running on ThreadPool
* Mark long running thread as background

* Add async support to SftpClient and SftpFileStream (#819)

* Add FEATURE_TAP and net472 target
* Add TAP async support to SftpClient and SftpFileStream
* Add async support to DnsAbstraction and SocketAbstraction
* Add async support to *Connector and refactor the hierarchy
* Add ConnectAsync to BaseClient

* Add CODEOWNERS file.

* Fix virus false-positive by Defender on Renci.SSHNet.Tests.dll (#867)

Co-authored-by: Pedro Fonseca <pfonseca@qti.qualcomm.com>

* Add unit tests for task-based asynchronous API (#906)

* Fix runtime and culture dependant tests.
* Set C# 7.3 in Tests.csproj to limit intellisense's suggestions under different targets
* Add SftpClientTest.*Async
* Add SftpFileStreamTest_OpenAsync_*
* Add SftpFileStreamTest_WriteAsync_*
* Add SftpFileStreamTest_ReadAsync_*
* Align AppVeyor script with Test project target frameworks

* correct 'Documenation' to 'Documentation' (#838)

in the documentation's window title

* Agent auth and Keygen (#794)

* Allow to set PrivateKeyFile Key directly
   So you can add your own Key-Classes to SSH.NET
* Add ED25519 ctor for just pub key part.
* Make ECDSA Key Bits accessible
   You cant export imported CngKeys. To be able to export them to agent or Key-Files make the private bits also accessible.
* Better NETFRAMEWORK vs NETSTANDARD handling
* Add Comment Property to Key
* Add IPrivateKeySource
  So Extension can add own PrivateKeyFiles, e.g. PuttyKeyFile.

* Use cryptographically secure random number generator.
Fixes CVE-2022-29245.

* Remove unused import.

* Add IBaseClient for BaseClient and ISftpClient to inherit from (#975)

Add IBaseClient for BaseClient and ISftpClient to inherit from

* fix typo (#999)

* Fix Seek Operations in SftpFileStream (#910)

* Fix offset operations in SftpFileStream.Seek
* Fix seek exception message and add default case for invalid seek origin
* Use named params when throwing ArgumentException
* Add tests for seeking from end of file

* Add back copyright to license. (#1060)

Fixes #1059.

* Removing old target frameworks (#1109)

Remove support for legacy / deprecated target frameworks while adding support for .NET 6.0 (and higher).
The supported target frameworks are now:
* .NETFramework 4.6.2 (and higher)
* .NET Standard 2.0
* .NET 6.0 (and higher)

* Remove old features [Part 1] (#1117)

Remove obsolete feature switches (now that we've remove support for legacy target frameworks) and remove corresponding conditional code.

* Remove FEATURE_DIRECTORYINFO_ENUMERATEFILES (#1119)

* Remove FEATURE_DIRECTORYINFO_ENUMERATEFILES
* Add exception documentation

* Fix some (lots of) issues reported by analyzers. (#1125)

Fix some (lots of) issues reported by analyzers.

* Round 2 of analyzer fixes and general cleanup. (#1132)

* Analyzer fixes round 3. (#1135)

* Replace Array<T>.Empty with Array.Empty<T>() (#1137)

* Replace IsNullOrWhiteSpace extension (#1142)

* Use License Expression for NuGet Package

licenseUrl is deprecated, see NuGet/Announcements#32

* Integration tests

* Remove todos

* Update CODEOWNERS

* Use correct SSH.NET

* ListDirectoryAsync return IAsyncEnumerable (#1126)

* ListDirectoryAsync return IAsyncEnumerable

* Fix documentation

* Update README.md

* Fix

* Add Sftp ListDirectoryAsync test

* Revert

* Integration tests for ListDirectoryAsync with IAsyncEnumerable

* Fix the assembly resolution build warning (#1165)

* Delete performance/longrunning tests (#1143)

Co-authored-by: Wojciech Nagórski <wojtpl2@gmail.com>

* Move Integration tests (#1173)

* Renci.SshNet.IntegrationTests

* Renci.SshNet.TestTools.OpenSSH

* Move integration tests to main repo

* Move old tests to new integration tests

* Move old integration tests to new integration tests

* Move more tests

* Move authentication tests

* Move SshClientTests

* Fix some tests

* Remove duplicated test

* Poc of ProcessDisruptor

* Rename

* Some fixes

* Remove performance tests

* Small improvements

* Add a benchmarks project (#1151)

* Add a benchmarks project

* Small improvements

---------

Co-authored-by: Wojciech Nagórski <wojtpl2@gmail.com>

* Use ExceptionDispatchInfo to retain call stack in Session.WaitOnHandle() (#936)

* Use ExceptionDispatchInfo to retain call stack in Session.WaitOnHandle()

* merge

* Update src/Renci.SshNet/Session.cs

Co-authored-by: Rob Hague <rob.hague00@gmail.com>

---------

Co-authored-by: Wojciech Nagórski <wojtpl2@gmail.com>
Co-authored-by: Rob Hague <rob.hague00@gmail.com>

* Support SHA256 fingerprints for host key validation (#1098)

* Add tests for HostKeyEventArgs

* Add SHA256 fingerprint support

* Add support for RSA SHA-2 public key algorithms (#1177)

* Abstract out the hash algorithm from RsaDigitalSignature

* Add integration tests

* Add DigitalSignature property to KeyHostAlgorithm

* Add IHostAlgorithmsProvider interface

* Verify the host signature

* Fix HostKeyEventArgsTest after merge

* Remove PubkeyAcceptedAlgorithms ssh-rsa

* Add test coverage for RSA keys in PrivateKeyFile

* Obsolete IPrivateKeySource

---------

Co-authored-by: Wojciech Nagórski <wojtpl2@gmail.com>

* Improvements after #1177 (#1180)

* Use ExceptionDispatchInfo in more places (#1182)

Co-authored-by: Wojciech Nagórski <wojtpl2@gmail.com>

* Try to "fix" the flaky test (#1185)

* Enable DSA tests (#1181)

Co-authored-by: Wojciech Nagórski <wojtpl2@gmail.com>

* FingerPrints (#1186)

* Use OS-agnostic socket error codes to allow tests run on different OSes (#1179)

SocketErrorCode is OS agnostic, ErrorCode is OS specific.

On Windows ErrorCode = (int) SocketErrorCode, but on Mac and Unix it is not.

For example ExitCode for HostNotFound (11001) on Windows is 11001, on Mac & Unix is -131073. So testing for ExitCode == 11001 fails on Mac & Unix.

Co-authored-by: Wojciech Nagórski <wojtpl2@gmail.com>

* Fix for channel session semaphore from thread blocking (#1071)

* Merging fix from @clivetong into our own SSH.NET fork
- The following article describes some of the issues with the double check lock that we have seen issues with: https://www.sudhanshutheone.com/posts/double-check-lock-csharp

* Merging fix from @clivetong into our own SSH.NET fork
- The following article describes some of the issues with the double check lock that we have seen issues with: https://www.sudhanshutheone.com/posts/double-check-lock-csharp

* Update Channel to fix AppVeyor failure (field should be readonly)

* Update ISftpClient for #120 (#1193)

* Implement set last write and access time (#1194)

* Add/migrate hmac+cipher integration tests (#1189)

* Add/migrate hmac+cipher integration tests

* fix integration tests

---------

Co-authored-by: Wojciech Nagórski <wojtpl2@gmail.com>

* Update tests for SetLastAccessTime(Utc) to also verify the time component and the Kind of the DateTime value returned by GetLastAccessTime(Utc). (#1198)

---------

Co-authored-by: Filippo Gualandi <filippo.gualandi@gmail.com>
Co-authored-by: 103filgualan <f.gualandi@crif.com>
Co-authored-by: Stefan Rinkes <darinkes@users.noreply.github.com>
Co-authored-by: wxtsxt <wojciech.swieboda@gmail.com>
Co-authored-by: Wojciech Swieboda <wswieboda@chathamfinancial.com>
Co-authored-by: Igor Milavec <igor.milavec@gmail.com>
Co-authored-by: drieseng <gert.driesen@telenet.be>
Co-authored-by: Pedro Fonseca <pbfonseca@gmail.com>
Co-authored-by: Pedro Fonseca <pfonseca@qti.qualcomm.com>
Co-authored-by: Maximiliano Jabase <maxijabase@gmail.com>
Co-authored-by: Owen Krueger <37021716+Owen-Krueger@users.noreply.github.com>
Co-authored-by: Masuri <psh0258@gmail.com>
Co-authored-by: LemonPi314 <49930425+LemonPi314@users.noreply.github.com>
Co-authored-by: Gert Driesen <gertdriesen@msn.com>
Co-authored-by: Rob Hague <rob.hague00@gmail.com>
Co-authored-by: Rob Hague <rh@johnstreetcapital.com>
Co-authored-by: Marius Thesing <marius.thesing@gmail.com>
Co-authored-by: Dāvis Mošenkovs <davikovs@gmail.com>
Co-authored-by: Dmitry Tsarevich <dimhotepus@users.noreply.github.com>
Co-authored-by: Patrick Yates <114094360+patrick-yates-redgate@users.noreply.github.com>

* Remove code examples

---------

Co-authored-by: Filippo Gualandi <filippo.gualandi@gmail.com>
Co-authored-by: 103filgualan <f.gualandi@crif.com>
Co-authored-by: Stefan Rinkes <darinkes@users.noreply.github.com>
Co-authored-by: wxtsxt <wojciech.swieboda@gmail.com>
Co-authored-by: Wojciech Swieboda <wswieboda@chathamfinancial.com>
Co-authored-by: Igor Milavec <igor.milavec@gmail.com>
Co-authored-by: drieseng <gert.driesen@telenet.be>
Co-authored-by: Pedro Fonseca <pbfonseca@gmail.com>
Co-authored-by: Pedro Fonseca <pfonseca@qti.qualcomm.com>
Co-authored-by: Maximiliano Jabase <maxijabase@gmail.com>
Co-authored-by: Owen Krueger <37021716+Owen-Krueger@users.noreply.github.com>
Co-authored-by: Masuri <psh0258@gmail.com>
Co-authored-by: LemonPi314 <49930425+LemonPi314@users.noreply.github.com>
Co-authored-by: Gert Driesen <gertdriesen@msn.com>
Co-authored-by: Rob Hague <rob.hague00@gmail.com>
Co-authored-by: Rob Hague <rh@johnstreetcapital.com>
Co-authored-by: Marius Thesing <marius.thesing@gmail.com>
Co-authored-by: Dāvis Mošenkovs <davikovs@gmail.com>
Co-authored-by: Dmitry Tsarevich <dimhotepus@users.noreply.github.com>
Co-authored-by: Patrick Yates <114094360+patrick-yates-redgate@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

SFTP file stream not working with System.IO.Compression.Zip Incorrect Seek Operations in SftpFileStream
5 participants