Fix partial authentication error

This commit is contained in:
olegkap_cp
2012-12-19 17:08:32 +00:00
parent d89e0e055e
commit 552a9f0cc3
@@ -373,10 +373,12 @@ namespace Renci.SshNet
var allowedAuthentications = noneAuthenticationMethod.AllowedAuthentications;
var triedAuthentications = new List<string>();
while (authenticated != AuthenticationResult.Success)
{
// Find first authentication method
var method = this.AuthenticationMethods.Where((a) => allowedAuthentications.Contains(a.Name)).FirstOrDefault();
var method = this.AuthenticationMethods.Where((a) => allowedAuthentications.Contains(a.Name) && !triedAuthentications.Contains(a.Name)).FirstOrDefault();
triedAuthentications.Add(method.Name);
if (method == null)
throw new SshAuthenticationException("No suitable authentication method found to complete authentication.");