Commit Graph

1654 Commits

Author SHA1 Message Date
mus65 ebdcb3ea7d CI: add Windows Integration Tests for .NET (#1704)
* CI: add Windows Integration Tests for .NET

see https://github.com/sshnet/SSH.NET/pull/1702#issuecomment-3342506642

* fix podman setup with Windows and .NET

* debug

* x

* x

* x

* revert

* Run Windows .NET tests in separate job

so they run in parallel and we avoid the Common_CreateMoreChannelsThanMaxSessions test failure.

* fix coverlet artifacts

* fix missing PermitTTY in RemoteSshdConfig Reset

this fixes a test failure in Common_CreateMoreChannelsThanMaxSessions
when running the tests multiple times against the same SSH server
instance.

see https://github.com/sshnet/SSH.NET/pull/1704#issuecomment-3343210311

* speed up Windows tests

turns out this is caused by DNS resolution taking about
2 seconds on every new connection...

* add windows integration tests to Publish needs:

---------

Co-authored-by: Rob Hague <rob.hague00@gmail.com>
Co-authored-by: Robert Hague <rh@johnstreetcapital.com>
2025-10-04 10:00:09 +01:00
Rob Hague af279d206a Fix SftpFileAttributes file type detection (#1688)
* Fix SftpFileAttributes file type detection

To get the file type, S_IFMT should be used as the mask. Instead it was using each file
type as the mask. It meant that e.g. a symbolic link would also show as a regular file
and a character device.

Also allow setting and retrieving the setuid/setgid/sticky bits

* fix build
2025-10-01 22:19:42 +02:00
Rob Hague c335ce2f20 Remove calls to Socket.Poll and use SocketShutdown.Both (#1706)
The message loop currently sits in a call to Poll until the socket has data to read or
it is closed. This is unnecessary - it can equally just sit in the call to Receive.

The call to Poll in Session.IsConnected is also unnecessary - we can instead just call
Socket.Connected. This only returns the connection state as of the last operation, but
we are always performing operations in the message loop (or else we are not connected),
so it should work equally well while being cheaper.

Lastly, when shutting down the socket, shut down both sides rather than just the sending
side (SocketShutdown.Both rather than SocketShutdown.Send) - at this point we do not care
about reading anything else. This makes it (more) certain that we will break out of the
Receive call in the message loop, as has been noted in #355 for whatever remaining issues
still exist there.
2025-10-01 20:19:28 +02:00
Scott Xu 081d3052b4 Use BCL Curve25519 for Windows 10+ (#1702)
* Use BCL Curve25519 when possible

* Update KeyExchangeMLKem768X25519Sha256 and KeyExchangeSNtruP761X25519Sha512

* Split Start and Finish methods for inheritance

* Some refactor

* Update src/Renci.SshNet/Security/KeyExchangeEC.BclImpl.cs

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

* revert

* Create dedicated KeyExchangeECCurve25519 BclImpl

* cleanup

* minor code refactor

* integration test

* Revert "integration test"

This reverts commit 326962664c.

---------

Co-authored-by: Rob Hague <rob.hague00@gmail.com>
2025-10-01 20:18:29 +02:00
dependabot[bot] 2f0ae3190c Bump test dependencies (#1693)
* Bump actions/checkout from 4 to 5
* Bump actions/upload-pages-artifact from 3 to 4
* Bump actions/download-artifact from 4 to 5
* Bump the dependencies group with 5 updates
* fix
* fix locally failing portforwarding tests

port already in use

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Rob Hague <rob.hague00@gmail.com>
2025-09-22 22:42:30 +02:00
Rob Hague b199467971 Fix key material extension during key exchange (#1689)
When the key exchange produces less key material than is needed for the cipher or hmac
algorithms, there is an iterative procedure to produce more.

For example, a SHA-1 key exchange algorithm produces 20 bytes of key material.
A SHA-256 hmac uses a 32 byte key, so one iteration of the procedure produces another
20 bytes of key material for a total of 40 which is sufficient for the hmac key.

The library works correctly in such cases of one iteration, but the logic is wrong if
more than one iteration is needed. In #1660, the connection uses a SHA-1 kex algorithm
with a SHA-512 hmac (64 byte key), requiring 3 iterations of the extension procedure and
resulting in an error upon connection.

This change fixes the logic to use the output of the previous iteration per the spec.

closes #1660
2025-08-17 23:49:40 +02:00
Rob Hague 6cba1be72e Truncate existing file in CreateText (#1686)
SftpClient.CreateText does not truncate the file if it exists, contrary to
System.IO.File.CreateText which does. It is documented, but seems pretty
unintuitive and more like a mistake than a concious decision.

I considered leaving this 14 year old behaviour as it is, but turns out other
people have hit it as well (it also affects WriteAll{Bytes/Text/Lines}).
2025-08-10 17:11:42 +02:00
dependabot[bot] 03ae6bfa0f Bump dependencies (#1682)
* Bump the dependencies group with 4 updates

Bumps BouncyCastle.Cryptography from 2.6.1 to 2.6.2
Bumps Meziantou.Analyzer from 2.0.205 to 2.0.210
Bumps MSTest from 3.9.3 to 3.10.0
Bumps SonarAnalyzer.CSharp from 10.13.0.120203 to 10.15.0.120848

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Rob Hague <rob.hague00@gmail.com>
2025-08-02 17:57:09 +02:00
Rob Hague 605ee7fe23 Use ReadExactly in ReadAllBytes and yield in ReadLines (#1681)
* Use ReadExactly in ReadAllBytes and yield in ReadLines

* on second thought, open the file lazily in ReadLines
2025-08-02 16:32:08 +02:00
dependabot[bot] 9f733e4393 Bump Vampire/setup-wsl from 5.0.1 to 6.0.0 (#1683)
Bumps [Vampire/setup-wsl](https://github.com/vampire/setup-wsl) from 5.0.1 to 6.0.0.
- [Release notes](https://github.com/vampire/setup-wsl/releases)
- [Commits](https://github.com/vampire/setup-wsl/compare/3b46b44374d5d0ae94654c45d114a3ed7a0e07a8...6a8db447be7ed35f2f499c02c6e60ff77ef11278)

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-08-02 13:01:42 +02:00
Rob Hague 13bcb7713e Remove unnecessary SftpFileStream unit tests and dedup Open{Async} (#1680)
* deletions

* test additions/tweaks

* dedup SftpFileStream init logic
2025-08-02 12:15:14 +02:00
Rob Hague dab8a11738 Use BouncyCastle for Diffie-Hellman key exchange (#1654)
Removes another vestige of hand-rolled crypto, and makes the classes public +
configurable for if/when we remove certain algorithms.
2025-08-02 11:08:56 +02:00
Rob Hague b7c5f1a87d Adapt InternalUploadFile for async (#1653)
The recently added UploadFileAsync effectively calls stream.CopyToAsync(SftpFileStream).
This is slower than the sync UploadFile (by about 4x in a local test) because the sync
version sends multiple write requests concurrently, without waiting for each response
in turn like the stream-based version does.

This change adapts the sync code for async and uses it to bring the performance of
UploadFileAsync in line with that of UploadFile.
2025-08-02 11:08:27 +02:00
Bart Vries d40bc43ac1 Refactor logging to allow a loggerfactory per session (#1673)
* Refactor logging to allow a loggerfactory per session specified in the ConnectionInfo.

This commit introduces an `ILoggerFactory` to various classes, replacing the static logger factory with an instance-based approach for more flexible and session-specific logging. These changes improve the logging framework's flexibility and maintainability and allow unit testing of logging.

* Improvements bases on feedback. Fixed tests. Added documentation.

* Update src/Renci.SshNet/ConnectionInfo.cs

---------

Co-authored-by: Rob Hague <rob.hague00@gmail.com>
2025-07-26 21:24:48 +02:00
dependabot[bot] fc988bd938 Bump dependencies
* Bump the dependencies group with 5 updates

Signed-off-by: dependabot[bot] <support@github.com>

* seal types not publicly instantiable (ma0053)

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Rob Hague <rob.hague00@gmail.com>
2025-07-12 21:03:08 +02:00
Jacob Slusser 4886529ee2 Fixes spelling errors (#1668)
* Fixes spelling errors in comments, private members, and public members in test projects

* Adds en-GB as spell checker option; reverts notable cases of American English

* convert file UTF-16 LE BOM -> UTF-8

---------

Co-authored-by: Rob Hague <rob.hague00@gmail.com>
2025-07-12 21:01:57 +02:00
thegame4craft 6bb397872b scp: notify for uploading finished when uploaded an empty file (#1658)
* scp: add flag to notify for uploading finished when uploaded an empty file

* remove notifyOnEmptyFile Flag
2025-06-20 08:53:51 +02:00
Rob Hague fd05d76ad6 Use ArraySegment for channel data (#1650)
The library currently allocates 4 bytes (and some) for every 1 byte of file
downloaded(*). It could be 0. This takes it to 3.

(*)
1. Array allocated for read of encrypted packet from socket
2. Array for decrypted packet
3. Array for channel data (removed in this change)
4. Array for sftp data packet
2025-06-06 08:52:23 +02:00
Rob Hague 1f1a5fe2ac Use an array buffer for the sftp packet stream (#1649)
The sftp packet stream runs within but independently of the channel data stream,
meaning a channel data packet can contain multiple sftp packets, or an sftp packet
can be split across multiple channel data packets.

Normally the packets are sized such there is a 1-to-1 relationship for efficiency.
When this doesn't happen the library falls back to buffering via a List<byte>,
which is not so efficient. This change uses an array-based buffer instead.

In a sample download which hit this fallback I see about a 20% reduction in memory
allocated.
2025-06-06 07:34:59 +02:00
Rob Hague caac95c836 Check host key algorithms before continuing key exchange (#1642)
The library currently does not check for matching host key algorithms until needed
at the end of the key exchange, in contrast to other algorithm types which are checked
beforehand. This leads to confusing or uninformative errors, normally from the server
(correctly) closing the connection.

This change moves that check alongside the rest of them, and also improves the error
messages that arise from no matching algorithms.
2025-06-06 07:34:06 +02:00
dependabot[bot] 26bc749409 Bump dependencies (#1652)
---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Rob Hague <rob.hague00@gmail.com>
2025-06-06 07:32:45 +02:00
dependabot[bot] f82ebbabea Bump alpine from 3.21 to 3.22 in /test/Renci.SshNet.IntegrationTests (#1651)
Bumps alpine from 3.21 to 3.22.

---
updated-dependencies:
- dependency-name: alpine
  dependency-version: '3.22'
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-06-05 23:20:58 +02:00
William Decker 9cf282731a Added GetAttributesAsync to SftpClient (#1648)
* Added GetAttributesAsync to SftpClient

* Adding integration tests + unit test

* Address warnings in test classes.

---------

Co-authored-by: William Decker <william.decker@syndigo.com>
2025-06-05 23:20:13 +02:00
mus65 03e28219ba Drop netstandard2.1 target (#1647) 2025-05-29 20:33:02 +02:00
Rob Hague a024b83def Fix hang in SftpClient.UploadFile upon error (#1643)
* Fix deadlock in SftpClient.UploadFile upon error

* Make RequestWrite deterministic wrt. exception handling

* add regression test; fix race

* x
2025-05-27 09:26:36 +02:00
Ivan 4fcf6048f8 Re-introduce ChangeWindow method on ShellStream (#1646)
* Re-introduce ChangeWindow method on ShellStream

* Fix pipeline build

* Fix pipeline build

* tweaks

Co-authored-by: Glen Kleidon <glenk@galkam.com.au>
Co-authored-by: oheiheiheiheihei <294797392@qq.com>

---------

Co-authored-by: Ivan Zaitsev <crackbargains@gmail.com>
Co-authored-by: Robert Hague <rh@johnstreetcapital.com>
Co-authored-by: Glen Kleidon <glenk@galkam.com.au>
Co-authored-by: oheiheiheiheihei <294797392@qq.com>
2025-05-25 20:09:03 +02:00
mus65 f24a5d6de6 fix IDE0350 warnings with .NET SDK 9.0.300 (#1645)
test\Renci.SshNet.IntegrationTests\OldIntegrationTests\SshCommandTest.cs(460,21,460,22): warning IDE0350: Lambda expression can be simplified (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/style-rules/ide0350)
2025-05-25 17:21:30 +02:00
Noah Dela Rosa d08c4aaa8a Add UploadFileAsync and DownloadFileAsync methods (#1634)
* add interface methods

* add internal file methods

* impl interface methods

* tweak buffer size usage

* swap tests with async upload

* swap more upload file references

* add async download tests

* add upload/download integration async test

* check if net48

* silence not await warning

* try tweaking test init

* remove request close from upload

* dispose already closes, remove dup call

* remove extra upload overload

* inherit doc

* configure await

* remove excess util functions

* add cancel throws

* add cancellation tests

* missed one configure await

* use default buffer size

* private ctor

* docs

---------

Co-authored-by: Rob Hague <rob.hague00@gmail.com>
2025-05-05 23:03:10 +02:00
Rob Hague 7c07b10e4a Read the underlying buffer in SshDataStream (#1638)
SshDataStream is a MemoryStream, so we can access the buffer directly.
Also simplify some usage in PrivateKeyFile.
2025-05-04 12:39:01 +02:00
Rob Hague 6039e121a8 Override more methods in PipeStream, ShellStream (#1637)
Where beneficial, add additional overrides from the base Stream class. Namely the Span
variants and for PipeStream, the WriteAsync variants (see comments).

The change also adds an internal type borrowed from the runtime repo for easier buffer
management, which could also be used elsewhere.
2025-05-04 11:40:37 +02:00
Rob Hague 98982a931e Update docs and remove a leftover DSA certificate algorithm (#1632)
* Update docs and remove a leftover DSA certificate algorithm

* more cleanup
2025-05-04 11:39:54 +02:00
Rob Hague 85905082db Add a debug helper for reading traffic with Wireshark (#1627)
Wireshark can already helpfully dissect the initial SSH handshake. When given the
session keys, it can also dissect the encrypted traffic for inspection/debugging.
This adds a helper in Debug mode to write out that information in the format
Wireshark requires.

Usage is to set `SshNetLoggingConfiguration.WiresharkKeyLogFilePath` before connecting, and supply the same value to Wireshark in Edit -> Preferences -> Protocols
-> SSH -> "Key log filename".

The description of the format is at https://wiki.wireshark.org/SSH#key-log-format
2025-05-04 11:38:55 +02:00
Rob Hague 17afcdb0fe Set version to '2025.0.1-prerelease.{height}' 2025-04-18 20:38:06 +01:00
Rob Hague 53a5be0a7d Set version to '2025.0.0' 2025.0.0 2025-04-18 20:38:06 +01:00
Martin 1cc527e205 Added ExistsAsync and GetAsync to ISftpClient (#1628)
Co-authored-by: Martin Solarik <martin.solarik@rws.com>
Co-authored-by: Rob Hague <rob.hague00@gmail.com>
2025-04-10 13:00:07 +02:00
dependabot[bot] 58eaeec226 Bump the dependencies (#1625)
* Bump the dependencies group with 5 updates

* use MEL 8.0.3

* use MSTest meta package

* revert Meziantou due to NRE

* add a more useful global.json and pin third party action

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Rob Hague <rob.hague00@gmail.com>
2025-04-10 09:13:36 +02:00
mus65 ad174829cc remove unused bcrypt code (#1626) 2025-04-05 15:50:00 +02:00
mus65 02c30c88a9 Only enable TreatWarningsAsErrors in Release (#1624)
* Only enable TreatWarningsAsErrors in Release

* Remove global.json

this doesn't actually do anything useful like this.

* Also check CI

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

---------

Co-authored-by: Rob Hague <rob.hague00@gmail.com>
2025-03-29 19:53:36 +01:00
mus65 c318e39d2c lock SendData to fix random connection failures (#1623) 2025-03-29 17:16:42 +01:00
Rob Hague 153b47d976 Add an OrderedDictionary implementation for algorithm priorities (#1611)
* Add an OrderedDictionary implementation for algorithm priorities

During the key exchange, the algorithms to be used are chosen based on the order that
the client sends: first algorithm is most desirable. Currently, the algorithm
collections in ConnectionInfo are defined as IDictionary<,> and backed by
Dictionary<,>, which does not have any guarantees on the order of enumeration
(in practice, when only adding and not removing items it does enumerate in the order
that items were added as an implementation detail, but it's not great to rely on it).

This change adds IOrderedDictionary<,> and uses it in ConnectionInfo. On .NET 9,
this is backed by System.Collections.Generic.OrderedDictionary<,> and on lower
targets, it uses a relatively simple implementation backed by a List and a
Dictionary.

* use ThrowIfNegative
2025-03-25 14:27:19 +01:00
Rob Hague 484afbdf9d Add a Stream buffer validation helper (#1605)
* Add a Stream buffer validation helper

* add ThrowHelper.ThrowIfNegative
2025-03-25 12:45:18 +01:00
Rob Hague bb3beeb6c5 Fix API break on KeyExchange (#1609)
This type is public and a `private protected` ctor breaks subclassing outside the assembly
2025-03-25 09:57:46 +01:00
mus65 071a8d56a6 CI: run .NET Framework Integration Tests on Windows (#1615)
* CI: run .NET Framework Integration Tests on Windows

* use apt-get

* use vampire/setup-wsl

* Run Windows Integration Tests in separate job

so publish doesn't depend on it

* Ignore flakey Test from #1253 in CI
2025-03-25 09:13:28 +01:00
dependabot[bot] b803932903 Bump dependencies (#1607)
* Bump the dependencies group with 7 updates

Bumps the dependencies group with 7 updates:

| Package | From | To |
| --- | --- | --- |
| [BouncyCastle.Cryptography](https://github.com/bcgit/bc-csharp) | `2.5.0` | `2.5.1` |
| [Microsoft.NETFramework.ReferenceAssemblies](https://github.com/Microsoft/dotnet) | `1.0.3` | `1.0.3` |
| [Meziantou.Analyzer](https://github.com/meziantou/Meziantou.Analyzer) | `2.0.186` | `2.0.188` |
| [Microsoft.Extensions.Logging.Abstractions](https://github.com/dotnet/runtime) | `6.0.0` | `6.0.4` |
| [SonarAnalyzer.CSharp](https://github.com/SonarSource/sonar-dotnet) | `10.6.0.109712` | `10.7.0.110445` |
| [Microsoft.Extensions.Logging.Console](https://github.com/dotnet/runtime) | `9.0.1` | `9.0.2` |
| [MSTest.TestFramework](https://github.com/microsoft/testfx) | `3.7.3` | `3.8.2` |


Updates `BouncyCastle.Cryptography` from 2.5.0 to 2.5.1
- [Commits](https://github.com/bcgit/bc-csharp/compare/release-2.5.0...release-2.5.1)

Updates `Microsoft.NETFramework.ReferenceAssemblies` from 1.0.3 to 1.0.3
- [Commits](https://github.com/Microsoft/dotnet/commits)

Updates `Meziantou.Analyzer` from 2.0.186 to 2.0.188
- [Release notes](https://github.com/meziantou/Meziantou.Analyzer/releases)
- [Commits](https://github.com/meziantou/Meziantou.Analyzer/compare/2.0.186...2.0.188)

Updates `Microsoft.NETFramework.ReferenceAssemblies` from 1.0.3 to 1.0.3
- [Commits](https://github.com/Microsoft/dotnet/commits)

Updates `Microsoft.Extensions.Logging.Abstractions` from 6.0.0 to 6.0.4
- [Release notes](https://github.com/dotnet/runtime/releases)
- [Commits](https://github.com/dotnet/runtime/compare/v6.0.0...v6.0.4)

Updates `Microsoft.NETFramework.ReferenceAssemblies` from 1.0.3 to 1.0.3
- [Commits](https://github.com/Microsoft/dotnet/commits)

Updates `Microsoft.NETFramework.ReferenceAssemblies` from 1.0.3 to 1.0.3
- [Commits](https://github.com/Microsoft/dotnet/commits)

Updates `SonarAnalyzer.CSharp` from 10.6.0.109712 to 10.7.0.110445
- [Release notes](https://github.com/SonarSource/sonar-dotnet/releases)
- [Commits](https://github.com/SonarSource/sonar-dotnet/compare/10.6.0.109712...10.7.0.110445)

Updates `Microsoft.Extensions.Logging.Console` from 9.0.1 to 9.0.2
- [Release notes](https://github.com/dotnet/runtime/releases)
- [Commits](https://github.com/dotnet/runtime/compare/v9.0.1...v9.0.2)

Updates `MSTest.TestFramework` from 3.7.3 to 3.8.2
- [Release notes](https://github.com/microsoft/testfx/releases)
- [Changelog](https://github.com/microsoft/testfx/blob/main/docs/Changelog.md)
- [Commits](https://github.com/microsoft/testfx/compare/v3.7.3...v3.8.2)

Updates `Microsoft.NETFramework.ReferenceAssemblies` from 1.0.3 to 1.0.3
- [Commits](https://github.com/Microsoft/dotnet/commits)

---
updated-dependencies:
- dependency-name: BouncyCastle.Cryptography
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: dependencies
- dependency-name: Microsoft.NETFramework.ReferenceAssemblies
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: dependencies
- dependency-name: Meziantou.Analyzer
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: dependencies
- dependency-name: Microsoft.NETFramework.ReferenceAssemblies
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: dependencies
- dependency-name: Microsoft.Extensions.Logging.Abstractions
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: dependencies
- dependency-name: Microsoft.NETFramework.ReferenceAssemblies
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: dependencies
- dependency-name: Microsoft.NETFramework.ReferenceAssemblies
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: dependencies
- dependency-name: SonarAnalyzer.CSharp
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: dependencies
- dependency-name: Microsoft.Extensions.Logging.Console
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: dependencies
- dependency-name: MSTest.TestFramework
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: dependencies
- dependency-name: Microsoft.NETFramework.ReferenceAssemblies
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: dependencies
...

Signed-off-by: dependabot[bot] <support@github.com>

* downgrades+upgrades

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Robert Hague <rh@johnstreetcapital.com>
2025-03-02 18:01:21 +01:00
mus65 d1213cf751 remove Reverse extension to avoid source-breaking change with .NET 10 (#1606)
* remove Reverse extension to avoid source-breaking change with .NET 10

* revert to ifdef in some places

to avoid extra array copy on lower targets
2025-03-01 17:01:23 +01:00
mus65 86dc811458 Drop net6.0 target (#1580)
* Drop net6.0 target

* Update src/Renci.SshNet/Common/TaskToAsyncResult.cs

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

* remove redundant #if

for some reason this made the compiler suddenly
realize that the plain text variables are unused.

* use TargetFrameworkIdentifier

this doesn't work in Directory.Build.props, moved it to Directory.Build.targets.

* fix null reference warnings in Benchmarks

seems like the warnings were (somehow) disabled here
before and were fixed by the previous TargetFrameworkIdentifier
change.

* fix unused plainTextOffset in AesGcmCipher.BclImpl

* CI retry

* more cosmetics

* more

* update README

* Revert "use TargetFrameworkIdentifier"

This reverts commit 076ede161d.

---------

Co-authored-by: Rob Hague <rob.hague00@gmail.com>
Co-authored-by: Robert Hague <rh@johnstreetcapital.com>
2025-02-19 13:37:38 +01:00
Rob Hague 99ef23cd87 Don't dispose channel when completing SshCommand (#1596)
The new(-ish) implementation of SshCommand has a race condition for short-lived
commands where SSH_MSG_CHANNEL_CLOSE may be processed on the message loop thread
before SSH_MSG_CHANNEL_SUCCESS is waited upon on the Execute (main) thread. This
manifests in an ArgumentNull/NullReference exception on the wait handle because
the channel has already been closed and disposed.

Fix this by only delaying the channel dispose until the command dispose.
2025-02-19 13:16:12 +01:00
Rob Hague a0c6bac3a7 Reply to global requests when want_reply is true (#1600)
We currently don't recognise any global requests from the server, but if one is
sent, then per RFC 4253 section 4 we still need to reply when the server expects
one. So send SSH_MSG_REQUEST_FAILURE in this case.
2025-02-19 13:15:45 +01:00
Rob Hague 429f7502ca Tweak logging.md (#1601) 2025-02-19 13:07:44 +01:00
dependabot[bot] 16d84d0395 Bump test dependencies (#1583)
* Bump coverlet.collector from 6.0.2 to 6.0.4

Bumps [coverlet.collector](https://github.com/coverlet-coverage/coverlet) from 6.0.2 to 6.0.4.
- [Release notes](https://github.com/coverlet-coverage/coverlet/releases)
- [Commits](https://github.com/coverlet-coverage/coverlet/compare/v6.0.2...v6.0.4)

---
updated-dependencies:
- dependency-name: coverlet.collector
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>

* update test deps

* update test deps

* some fixes

* group dependencies

* analyzer fixes

* just group them all together

* more cleanup

* silent analyzers -> suggestion

* restore constant

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Robert Hague <rh@johnstreetcapital.com>
Co-authored-by: Rob Hague <rob.hague00@gmail.com>
2025-02-04 21:58:59 +01:00