Skip to content

Commit 5a5c6ae

Browse files
authored
Merge branch 'develop' into aesgcm-netframework
2 parents 93a5c20 + 03e2821 commit 5a5c6ae

33 files changed

+669
-233
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,7 @@ OpenSSH certificate authentication is supported for all of the above, e.g. ssh-e
176176

177177
**SSH.NET** supports the following target frameworks:
178178
* .NETFramework 4.6.2 (and higher)
179-
* .NET Standard 2.0 and 2.1
179+
* .NET Standard 2.0
180180
* .NET 8 (and higher)
181181

182182
## Building the library

src/Renci.SshNet/Abstractions/SocketExtensions.cs

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -93,11 +93,7 @@ public static async Task ConnectAsync(this Socket socket, EndPoint remoteEndpoin
9393
{
9494
args.RemoteEndPoint = remoteEndpoint;
9595

96-
#if NETSTANDARD2_1
97-
await using (cancellationToken.Register(o => ((AwaitableSocketAsyncEventArgs)o).SetCancelled(), args, useSynchronizationContext: false).ConfigureAwait(continueOnCapturedContext: false))
98-
#else
9996
using (cancellationToken.Register(o => ((AwaitableSocketAsyncEventArgs)o).SetCancelled(), args, useSynchronizationContext: false))
100-
#endif
10197
{
10298
await args.ExecuteAsync(socket.ConnectAsync);
10399
}
@@ -112,11 +108,7 @@ public static async Task<int> ReceiveAsync(this Socket socket, byte[] buffer, in
112108
{
113109
args.SetBuffer(buffer, offset, length);
114110

115-
#if NETSTANDARD2_1
116-
await using (cancellationToken.Register(o => ((AwaitableSocketAsyncEventArgs)o).SetCancelled(), args, useSynchronizationContext: false).ConfigureAwait(continueOnCapturedContext: false))
117-
#else
118111
using (cancellationToken.Register(o => ((AwaitableSocketAsyncEventArgs)o).SetCancelled(), args, useSynchronizationContext: false))
119-
#endif
120112
{
121113
await args.ExecuteAsync(socket.ReceiveAsync);
122114
}

src/Renci.SshNet/Abstractions/StreamExtensions.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#if NETFRAMEWORK || NETSTANDARD2_0
1+
#if !NET
22
using System;
33
using System.IO;
44
using System.Threading.Tasks;

src/Renci.SshNet/Channels/ChannelSession.cs

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -239,26 +239,18 @@ public bool SendSubsystemRequest(string subsystem)
239239
/// <param name="rows">The rows.</param>
240240
/// <param name="width">The width.</param>
241241
/// <param name="height">The height.</param>
242-
/// <returns>
243-
/// <see langword="true"/> if request was successful; otherwise <see langword="false"/>.
244-
/// </returns>
245-
public bool SendWindowChangeRequest(uint columns, uint rows, uint width, uint height)
242+
public void SendWindowChangeRequest(uint columns, uint rows, uint width, uint height)
246243
{
247244
SendMessage(new ChannelRequestMessage(RemoteChannelNumber, new WindowChangeRequestInfo(columns, rows, width, height)));
248-
return true;
249245
}
250246

251247
/// <summary>
252248
/// Sends the local flow request.
253249
/// </summary>
254250
/// <param name="clientCanDo">if set to <see langword="true"/> [client can do].</param>
255-
/// <returns>
256-
/// <see langword="true"/> if request was successful; otherwise <see langword="false"/>.
257-
/// </returns>
258-
public bool SendLocalFlowRequest(bool clientCanDo)
251+
public void SendLocalFlowRequest(bool clientCanDo)
259252
{
260253
SendMessage(new ChannelRequestMessage(RemoteChannelNumber, new XonXoffRequestInfo(clientCanDo)));
261-
return true;
262254
}
263255

264256
/// <summary>

src/Renci.SshNet/Channels/IChannelSession.cs

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -97,19 +97,13 @@ bool SendPseudoTerminalRequest(string environmentVariable,
9797
/// <param name="rows">The rows.</param>
9898
/// <param name="width">The width.</param>
9999
/// <param name="height">The height.</param>
100-
/// <returns>
101-
/// <see langword="true"/> if request was successful; otherwise <see langword="false"/>.
102-
/// </returns>
103-
bool SendWindowChangeRequest(uint columns, uint rows, uint width, uint height);
100+
void SendWindowChangeRequest(uint columns, uint rows, uint width, uint height);
104101

105102
/// <summary>
106103
/// Sends the local flow request.
107104
/// </summary>
108105
/// <param name="clientCanDo">if set to <see langword="true"/> [client can do].</param>
109-
/// <returns>
110-
/// <see langword="true"/> if request was successful; otherwise <see langword="false"/>.
111-
/// </returns>
112-
bool SendLocalFlowRequest(bool clientCanDo);
106+
void SendLocalFlowRequest(bool clientCanDo);
113107

114108
/// <summary>
115109
/// Sends the signal request.

src/Renci.SshNet/ClientAuthentication.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ private bool TryAuthenticate(ISession session,
105105
{
106106
authenticationException = new SshAuthenticationException(string.Format(CultureInfo.InvariantCulture,
107107
"No suitable authentication method found to complete authentication ({0}).",
108-
#if NET || NETSTANDARD2_1
108+
#if NET
109109
string.Join(',', allowedAuthenticationMethods)))
110110
#else
111111
string.Join(",", allowedAuthenticationMethods)))

src/Renci.SshNet/Common/Extensions.cs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ internal static ServiceName ToServiceName(this byte[] data)
5050

5151
internal static BigInteger ToBigInteger(this ReadOnlySpan<byte> data)
5252
{
53-
#if NETSTANDARD2_1 || NET
53+
#if NET
5454
return new BigInteger(data, isBigEndian: true);
5555
#else
5656
var reversed = data.ToArray();
@@ -61,7 +61,7 @@ internal static BigInteger ToBigInteger(this ReadOnlySpan<byte> data)
6161

6262
internal static BigInteger ToBigInteger(this byte[] data)
6363
{
64-
#if NETSTANDARD2_1 || NET
64+
#if NET
6565
return new BigInteger(data, isBigEndian: true);
6666
#else
6767
var reversed = new byte[data.Length];
@@ -76,7 +76,7 @@ internal static BigInteger ToBigInteger(this byte[] data)
7676
/// </summary>
7777
public static BigInteger ToBigInteger2(this byte[] data)
7878
{
79-
#if NETSTANDARD2_1 || NET
79+
#if NET
8080
return new BigInteger(data, isBigEndian: true, isUnsigned: true);
8181
#else
8282
if ((data[0] & (1 << 7)) != 0)
@@ -91,7 +91,7 @@ public static BigInteger ToBigInteger2(this byte[] data)
9191
#endif
9292
}
9393

94-
#if NETFRAMEWORK || NETSTANDARD2_0
94+
#if !NET
9595
public static byte[] ToByteArray(this BigInteger bigInt, bool isUnsigned = false, bool isBigEndian = false)
9696
{
9797
var data = bigInt.ToByteArray();
@@ -361,7 +361,7 @@ internal static string Join(this IEnumerable<string> values, string separator)
361361
return string.Join(separator, values);
362362
}
363363

364-
#if NETFRAMEWORK || NETSTANDARD2_0
364+
#if !NET
365365
internal static bool TryAdd<TKey, TValue>(this Dictionary<TKey, TValue> dictionary, TKey key, TValue value)
366366
{
367367
if (!dictionary.ContainsKey(key))

src/Renci.SshNet/Common/PipeStream.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ public override int Read(byte[] buffer, int offset, int count)
5151
return Read(buffer.AsSpan(offset, count));
5252
}
5353

54-
#if NETSTANDARD2_1 || NET
54+
#if NET
5555
/// <inheritdoc/>
5656
public override int Read(Span<byte> buffer)
5757
#else
@@ -99,7 +99,7 @@ public override void Write(byte[] buffer, int offset, int count)
9999
}
100100
}
101101

102-
#if NETSTANDARD2_1 || NET
102+
#if NET
103103
/// <inheritdoc/>
104104
public override void Write(ReadOnlySpan<byte> buffer)
105105
{
@@ -157,7 +157,7 @@ public override Task WriteAsync(byte[] buffer, int offset, int count, Cancellati
157157
return WriteAsync(buffer.AsMemory(offset, count), cancellationToken).AsTask();
158158
}
159159

160-
#if NETSTANDARD2_1 || NET
160+
#if NET
161161
/// <inheritdoc/>
162162
public override async ValueTask WriteAsync(ReadOnlyMemory<byte> buffer, CancellationToken cancellationToken = default)
163163
#else

src/Renci.SshNet/Common/SshData.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -372,7 +372,7 @@ protected void Write(BigInteger data)
372372
/// <param name="data">name-list data to write.</param>
373373
protected void Write(string[] data)
374374
{
375-
#if NET || NETSTANDARD2_1
375+
#if NET
376376
Write(string.Join(',', data), Ascii);
377377
#else
378378
Write(string.Join(",", data), Ascii);

src/Renci.SshNet/Common/SshDataStream.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ public bool IsEndOfData
5959
}
6060
}
6161

62-
#if NETFRAMEWORK || NETSTANDARD2_0
62+
#if !NET
6363
private void Write(ReadOnlySpan<byte> buffer)
6464
{
6565
var sharedBuffer = System.Buffers.ArrayPool<byte>.Shared.Rent(buffer.Length);
@@ -129,7 +129,7 @@ public void Write(string s, Encoding encoding)
129129
ThrowHelper.ThrowIfNull(s);
130130
ThrowHelper.ThrowIfNull(encoding);
131131

132-
#if NETSTANDARD2_1 || NET
132+
#if NET
133133
ReadOnlySpan<char> value = s;
134134
var count = encoding.GetByteCount(value);
135135
var bytes = count <= 256 ? stackalloc byte[count] : new byte[count];
@@ -220,7 +220,7 @@ public void WriteBinary(byte[] buffer, int offset, int count)
220220
/// </returns>
221221
public BigInteger ReadBigInt()
222222
{
223-
#if NETSTANDARD2_1 || NET
223+
#if NET
224224
var data = ReadBinarySegment();
225225
return new BigInteger(data, isBigEndian: true);
226226
#else

src/Renci.SshNet/Connection/ProxyConnector.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,14 +21,14 @@ protected ProxyConnector(ISocketFactory socketFactory)
2121

2222
// ToDo: Performs async/sync fallback, true async version should be implemented in derived classes
2323
protected virtual
24-
#if NET || NETSTANDARD2_1
24+
#if NET
2525
async
2626
#endif
2727
Task HandleProxyConnectAsync(IConnectionInfo connectionInfo, Socket socket, CancellationToken cancellationToken)
2828
{
2929
cancellationToken.ThrowIfCancellationRequested();
3030

31-
#if NET || NETSTANDARD2_1
31+
#if NET
3232
await using (cancellationToken.Register(o => ((Socket)o).Dispose(), socket, useSynchronizationContext: false).ConfigureAwait(continueOnCapturedContext: false))
3333
#else
3434
using (cancellationToken.Register(o => ((Socket)o).Dispose(), socket, useSynchronizationContext: false))
@@ -39,7 +39,7 @@ Task HandleProxyConnectAsync(IConnectionInfo connectionInfo, Socket socket, Canc
3939
#pragma warning restore MA0042 // Do not use blocking calls in an async method
4040
}
4141

42-
#if !NET && !NETSTANDARD2_1
42+
#if !NET
4343
return Task.CompletedTask;
4444
#endif
4545
}

src/Renci.SshNet/IServiceFactory.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ internal partial interface IServiceFactory
109109
/// <param name="session">The SSH session.</param>
110110
/// <param name="terminalName">The <c>TERM</c> environment variable.</param>
111111
/// <param name="columns">The terminal width in columns.</param>
112-
/// <param name="rows">The terminal width in rows.</param>
112+
/// <param name="rows">The terminal height in rows.</param>
113113
/// <param name="width">The terminal width in pixels.</param>
114114
/// <param name="height">The terminal height in pixels.</param>
115115
/// <param name="terminalModeValues">The terminal mode values.</param>

0 commit comments

Comments
 (0)