File tree Expand file tree Collapse file tree 2 files changed +6
-9
lines changed
Renci.SshNet.Tests/Classes Expand file tree Collapse file tree 2 files changed +6
-9
lines changed Original file line number Diff line number Diff line change 1
- using System ;
2
- using System . Net . Sockets ;
3
- using System . Threading ;
1
+ using System . Net . Sockets ;
4
2
using Microsoft . VisualStudio . TestTools . UnitTesting ;
5
3
using Renci . SshNet . Messages . Connection ;
6
4
7
5
namespace Renci . SshNet . Tests . Classes
8
6
{
9
7
/// <summary>
10
- /// Test for https://github.com/sshnet/SSH.NET/pull/9 .
8
+ /// Test for https://github.com/sshnet/SSH.NET/issues/8 .
11
9
/// </summary>
12
10
[ TestClass ]
13
11
public class SessionTest_Connected_GlobalRequestMessageAfterAuthenticationRace : SessionTest_ConnectedBase
Original file line number Diff line number Diff line change @@ -590,9 +590,6 @@ public void Connect()
590
590
591
591
// Some server implementations might sent this message first, prior establishing encryption algorithm
592
592
RegisterMessage ( "SSH_MSG_USERAUTH_BANNER" ) ;
593
-
594
- // Modern versions of OpenSSH server use this generic message for various proprietary extensions of the SSH protocol.
595
- RegisterMessage ( "SSH_MSG_GLOBAL_REQUEST" ) ;
596
593
597
594
// mark the message listener threads as started
598
595
_messageListenerCompleted . Reset ( ) ;
@@ -621,11 +618,13 @@ public void Connect()
621
618
throw new SshException ( "Username is not specified." ) ;
622
619
}
623
620
621
+ // Some servers send a global request immediately after successful authentication
622
+ // Avoid race condition by already enabling SSH_MSG_GLOBAL_REQUEST before authentication
623
+ RegisterMessage ( "SSH_MSG_GLOBAL_REQUEST" ) ;
624
+
624
625
ConnectionInfo . Authenticate ( this , _serviceFactory ) ;
625
626
_isAuthenticated = true ;
626
627
627
- Thread . Sleep ( 2000 ) ;
628
-
629
628
// Register Connection messages
630
629
RegisterMessage ( "SSH_MSG_REQUEST_SUCCESS" ) ;
631
630
RegisterMessage ( "SSH_MSG_REQUEST_FAILURE" ) ;
You can’t perform that action at this time.
0 commit comments