File tree 3 files changed +18
-12
lines changed
test/Renci.SshNet.IntegrationTests
3 files changed +18
-12
lines changed Original file line number Diff line number Diff line change @@ -23,7 +23,6 @@ public void TearDown()
23
23
}
24
24
25
25
[ TestMethod ]
26
- [ Ignore ]
27
26
public void SNtruP761X25519Sha512 ( )
28
27
{
29
28
_remoteSshdConfig . ClearKeyExchangeAlgorithms ( )
Original file line number Diff line number Diff line change @@ -22,19 +22,24 @@ public SshConnectionRestorer BreakConnections()
22
22
23
23
private static void PauseSshd ( SshClient client )
24
24
{
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" ) )
28
26
{
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
+ }
31
33
}
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" ) )
35
36
{
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
+ }
38
43
}
39
44
}
40
45
}
Original file line number Diff line number Diff line change @@ -75,14 +75,16 @@ public async Task DisposeAsync()
75
75
{
76
76
if ( _sshServer != null )
77
77
{
78
+ #pragma warning disable S6966 // Awaitable method should be used
78
79
//try
79
80
//{
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) );
81
82
//}
82
83
//catch (Exception ex)
83
84
//{
84
85
// Console.Error.WriteLine(ex.ToString());
85
86
//}
87
+ #pragma warning restore S6966 // Awaitable method should be used
86
88
87
89
await _sshServer . DisposeAsync ( ) ;
88
90
}
You can’t perform that action at this time.
0 commit comments