Skip to content

Commit 2926aa1

Browse files
committed
Merge remote-tracking branch 'upstream/develop' into feature_AES_CSP
2 parents 36cea67 + 5021f6d commit 2926aa1

File tree

99 files changed

+436
-744
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

99 files changed

+436
-744
lines changed

.editorconfig

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -572,6 +572,13 @@ dotnet_diagnostic.CA5401.severity = none
572572

573573
#### Roslyn IDE analyser rules ####
574574

575+
# IDE0028: Simplify collection initialization; and
576+
# IDE0305: Simplify collection initialization
577+
#
578+
# Temporarily suppressing collection expression recommendations coming from .NET 8 SDK
579+
dotnet_diagnostic.IDE0028.severity = none
580+
dotnet_diagnostic.IDE0305.severity = none
581+
575582
# IDE0032: Use auto-implemented property
576583
#
577584
# For performance reasons, we do not always want to enforce the use of

.gitattributes

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,3 +15,6 @@
1515
*.nupkg binary
1616
*.pdf binary
1717
*.snk binary
18+
19+
# Ensure key files have LF endings for easier usage with ssh-keygen
20+
test/Data/* eol=lf

global.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"sdk": {
33
"version": "7.0.403",
4-
"rollForward": "disable"
4+
"rollForward": "latestMajor"
55
}
66
}

src/Renci.SshNet/Abstractions/DiagnosticAbstraction.cs

Lines changed: 53 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,65 @@
1-
using System.Diagnostics;
1+
using System.ComponentModel;
2+
using System.Diagnostics;
23

34
namespace Renci.SshNet.Abstractions
45
{
5-
internal static class DiagnosticAbstraction
6+
/// <summary>
7+
/// Provides access to the <see cref="System.Diagnostics"/> internals of SSH.NET.
8+
/// </summary>
9+
[EditorBrowsable(EditorBrowsableState.Never)]
10+
public static class DiagnosticAbstraction
611
{
7-
private static readonly SourceSwitch SourceSwitch = new SourceSwitch("SshNetSwitch");
8-
9-
public static bool IsEnabled(TraceEventType traceEventType)
10-
{
11-
return SourceSwitch.ShouldTrace(traceEventType);
12-
}
13-
14-
private static readonly TraceSource Loggging =
1512
#if DEBUG
16-
new TraceSource("SshNet.Logging", SourceLevels.All);
17-
#else
18-
new TraceSource("SshNet.Logging");
19-
#endif // DEBUG
13+
/// <summary>
14+
/// The <see cref="TraceSource"/> instance used by SSH.NET.
15+
/// </summary>
16+
/// <remarks>
17+
/// <para>
18+
/// Configuration on .NET Core must be done programmatically, e.g.
19+
/// <code>
20+
/// DiagnosticAbstraction.Source.Switch = new SourceSwitch("sourceSwitch", "Verbose");
21+
/// DiagnosticAbstraction.Source.Listeners.Remove("Default");
22+
/// DiagnosticAbstraction.Source.Listeners.Add(new ConsoleTraceListener());
23+
/// DiagnosticAbstraction.Source.Listeners.Add(new TextWriterTraceListener("trace.log"));
24+
/// </code>
25+
/// </para>
26+
/// <para>
27+
/// On .NET Framework, it is possible to configure via App.config, e.g.
28+
/// <code>
29+
/// <![CDATA[
30+
/// <configuration>
31+
/// <system.diagnostics>
32+
/// <trace autoflush="true"/>
33+
/// <sources>
34+
/// <source name="SshNet.Logging" switchValue="Verbose">
35+
/// <listeners>
36+
/// <remove name="Default" />
37+
/// <add name="console"
38+
/// type="System.Diagnostics.ConsoleTraceListener" />
39+
/// <add name="logFile"
40+
/// type="System.Diagnostics.TextWriterTraceListener"
41+
/// initializeData="SshNetTrace.log" />
42+
/// </listeners>
43+
/// </source>
44+
/// </sources>
45+
/// </system.diagnostics>
46+
/// </configuration>
47+
/// ]]>
48+
/// </code>
49+
/// </para>
50+
/// </remarks>
51+
public static readonly TraceSource Source = new TraceSource("SshNet.Logging");
52+
#endif
2053

54+
/// <summary>
55+
/// Logs a message to <see cref="Source"/> at the <see cref="TraceEventType.Verbose"/>
56+
/// level.
57+
/// </summary>
58+
/// <param name="text">The message to log.</param>
2159
[Conditional("DEBUG")]
2260
public static void Log(string text)
2361
{
24-
Loggging.TraceEvent(TraceEventType.Verbose,
62+
Source.TraceEvent(TraceEventType.Verbose,
2563
System.Environment.CurrentManagedThreadId,
2664
text);
2765
}

src/Renci.SshNet/Connection/ConnectorBase.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ protected Socket SocketConnect(string host, int port, TimeSpan timeout)
4949
{
5050
SocketAbstraction.Connect(socket, ep, timeout);
5151

52-
const int socketBufferSize = 2 * Session.MaximumSshPacketSize;
52+
const int socketBufferSize = 10 * Session.MaximumSshPacketSize;
5353
socket.SendBufferSize = socketBufferSize;
5454
socket.ReceiveBufferSize = socketBufferSize;
5555
return socket;

src/Renci.SshNet/Messages/Authentication/FailureMessage.cs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,5 +60,13 @@ internal override void Process(Session session)
6060
{
6161
session.OnUserAuthenticationFailureReceived(this);
6262
}
63+
64+
/// <inheritdoc/>
65+
public override string ToString()
66+
{
67+
#pragma warning disable MA0089 // Optimize string method usage
68+
return $"SSH_MSG_USERAUTH_FAILURE {string.Join(",", AllowedAuthentications)} ({nameof(PartialSuccess)}:{PartialSuccess})";
69+
#pragma warning restore MA0089 // Optimize string method usage
70+
}
6371
}
6472
}

src/Renci.SshNet/Messages/Authentication/PublicKeyMessage.cs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,5 +60,11 @@ protected override void SaveData()
6060
WriteBinaryString(PublicKeyAlgorithmName);
6161
WriteBinaryString(PublicKeyData);
6262
}
63+
64+
/// <inheritdoc/>
65+
public override string ToString()
66+
{
67+
return $"SSH_MSG_USERAUTH_PK_OK ({Ascii.GetString(PublicKeyAlgorithmName)})";
68+
}
6369
}
6470
}

src/Renci.SshNet/Messages/Authentication/RequestMessage.cs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,5 +106,11 @@ internal override void Process(Session session)
106106
{
107107
throw new NotImplementedException();
108108
}
109+
110+
/// <inheritdoc/>
111+
public override string ToString()
112+
{
113+
return $"SSH_MSG_USERAUTH_REQUEST ({MethodName})";
114+
}
109115
}
110116
}

src/Renci.SshNet/Messages/Authentication/RequestMessagePublicKey.cs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,5 +96,11 @@ protected override void SaveData()
9696
WriteBinaryString(Signature);
9797
}
9898
}
99+
100+
/// <inheritdoc/>
101+
public override string ToString()
102+
{
103+
return $"{base.ToString()} {Ascii.GetString(PublicKeyAlgorithmName)} {(Signature != null ? "with" : "without")} signature.";
104+
}
99105
}
100106
}

src/Renci.SshNet/Renci.SshNet.csproj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
</PropertyGroup>
77

88
<PropertyGroup Condition=" '$(TargetFramework)' == 'net462' ">
9-
<DefineConstants>FEATURE_BINARY_SERIALIZATION;FEATURE_SOCKET_EAP;FEATURE_SOCKET_APM;FEATURE_DNS_SYNC;FEATURE_HASH_RIPEMD160_CREATE;FEATURE_HMAC_RIPEMD160</DefineConstants>
9+
<DefineConstants>$(DefineConstants);FEATURE_BINARY_SERIALIZATION;FEATURE_SOCKET_EAP;FEATURE_SOCKET_APM;FEATURE_DNS_SYNC;FEATURE_HASH_RIPEMD160_CREATE;FEATURE_HMAC_RIPEMD160</DefineConstants>
1010
</PropertyGroup>
1111

1212
<ItemGroup Condition=" '$(TargetFramework)' == 'netstandard2.0' or '$(TargetFramework)' == 'netstandard2.1' or '$(TargetFramework)' == 'net6.0' or '$(TargetFramework)' == 'net7.0' ">
@@ -18,6 +18,6 @@
1818
</ItemGroup>
1919

2020
<PropertyGroup Condition=" '$(TargetFramework)' == 'netstandard2.0' or '$(TargetFramework)' == 'netstandard2.1' or '$(TargetFramework)' == 'net6.0' or '$(TargetFramework)' == 'net7.0' ">
21-
<DefineConstants>FEATURE_SOCKET_TAP;FEATURE_SOCKET_APM;FEATURE_SOCKET_EAP;FEATURE_DNS_SYNC;FEATURE_DNS_APM;FEATURE_DNS_TAP</DefineConstants>
21+
<DefineConstants>$(DefineConstants);FEATURE_SOCKET_TAP;FEATURE_SOCKET_APM;FEATURE_SOCKET_EAP;FEATURE_DNS_SYNC;FEATURE_DNS_APM;FEATURE_DNS_TAP</DefineConstants>
2222
</PropertyGroup>
2323
</Project>

0 commit comments

Comments
 (0)