-
-
Notifications
You must be signed in to change notification settings - Fork 962
Description
We are using SSH.NET(2014.4.6.0) dll to connect to the sftp sites in our application. If all the required parameters are correct the code works as desired. But if the sftp password is incorrect the system crashes. The try catch block is not able to catch the error. An log is written in the event viewer “The process was terminated due to stack overflow.”
Added the reference of the latest Renci dll from package manager console. Have tried using the beta version of the dll as well with no success(https://www.nuget.org/packages/SSH.NET)
Debugged the code when the sftp password is incorrect and below are the findings:
- The authenticationMethod.Authenticate(session) always returns authentication result as "PartialSuccess"
- Because of this the "TryAuthenticate" methods goes into an recursive loop
- We are getting the stack overflow exception and the system crashes.
This being an production issue, we have deployed a quick fix.
- In the PasswordAuthenticationMethod.cs class file, commented the below 3 lines of code in the "Session_UserAuthenticationFailureReceived" method:
//if (e.Message.PartialSuccess)
// _authenticationResult = AuthenticationResult.PartialSuccess;
//else - Doing this the authentication result returned for the Password method will either be success or failure.
- Also caught the "SshAuthenticationException" exception.
Note: This is not happening all the time but for certain sftp sites.
Requesting you to please look into this issue.