Browse Source

Fix partial authentication error

olegkap_cp 13 years ago
parent
commit
552a9f0cc3
1 changed files with 3 additions and 1 deletions
  1. 3 1
      Renci.SshClient/Renci.SshNet/ConnectionInfo.cs

+ 3 - 1
Renci.SshClient/Renci.SshNet/ConnectionInfo.cs

@@ -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.");