Skip to content

Commit cb4f1b3

Browse files
committed
merge #1553
1 parent 7c9405f commit cb4f1b3

File tree

3 files changed

+18
-12
lines changed

3 files changed

+18
-12
lines changed

test/Renci.SshNet.IntegrationTests/KeyExchangeAlgorithmTests.cs

-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@ public void TearDown()
2323
}
2424

2525
[TestMethod]
26-
[Ignore]
2726
public void SNtruP761X25519Sha512()
2827
{
2928
_remoteSshdConfig.ClearKeyExchangeAlgorithms()

test/Renci.SshNet.IntegrationTests/SshConnectionDisruptor.cs

+15-10
Original file line numberDiff line numberDiff line change
@@ -22,19 +22,24 @@ public SshConnectionRestorer BreakConnections()
2222

2323
private static void PauseSshd(SshClient client)
2424
{
25-
var command = client.CreateCommand("sudo echo 'DenyUsers sshnet' >> /etc/ssh/sshd_config");
26-
var output = command.Execute();
27-
if (command.ExitStatus != 0)
25+
using (var command = client.CreateCommand("sudo echo 'DenyUsers sshnet' >> /etc/ssh/sshd_config"))
2826
{
29-
throw new ApplicationException(
30-
$"Blocking user sshnet failed with exit code {command.ExitStatus}.\r\n{output}\r\n{command.Error}");
27+
var output = command.Execute();
28+
if (command.ExitStatus != 0)
29+
{
30+
throw new ApplicationException(
31+
$"Blocking user sshnet failed with exit code {command.ExitStatus}.\r\n{output}\r\n{command.Error}");
32+
}
3133
}
32-
command = client.CreateCommand("sudo pkill -9 -U sshnet -f sshd.pam");
33-
output = command.Execute();
34-
if (command.ExitStatus != 0)
34+
35+
using (var command = client.CreateCommand("sudo pkill -9 -U sshnet -f sshd-session.pam"))
3536
{
36-
throw new ApplicationException(
37-
$"Killing sshd.pam service failed with exit code {command.ExitStatus}.\r\n{output}\r\n{command.Error}");
37+
var output = command.Execute();
38+
if (command.ExitStatus != 0)
39+
{
40+
throw new ApplicationException(
41+
$"Killing sshd-session.pam service failed with exit code {command.ExitStatus}.\r\n{output}\r\n{command.Error}");
42+
}
3843
}
3944
}
4045
}

test/Renci.SshNet.IntegrationTests/TestsFixtures/InfrastructureFixture.cs

+3-1
Original file line numberDiff line numberDiff line change
@@ -75,14 +75,16 @@ public async Task DisposeAsync()
7575
{
7676
if (_sshServer != null)
7777
{
78+
#pragma warning disable S6966 // Awaitable method should be used
7879
//try
7980
//{
80-
// File.WriteAllBytes(@"C:\tmp\auth.log", await _sshServer.ReadFileAsync("/var/log/auth.log"));
81+
// File.WriteAllBytes(@"C:\tmp\auth.log", await _sshServer.ReadFileAsync("/var/log/auth.log").ConfigureAwait(false));
8182
//}
8283
//catch (Exception ex)
8384
//{
8485
// Console.Error.WriteLine(ex.ToString());
8586
//}
87+
#pragma warning restore S6966 // Awaitable method should be used
8688

8789
await _sshServer.DisposeAsync();
8890
}

0 commit comments

Comments
 (0)