Quantcast
Channel: sshnet Issue Tracker Rss Feed
Viewing all articles
Browse latest Browse all 1026

Edited Issue: No Connection possible with the same auth method requested multiple times [1930]

$
0
0
If you try to connect to a server which requires more than one auth,
it only works it the auth-methods differ.

If you use:
```
AuthenticationMethods password,password
```
or
```
AuthenticationMethods pubkey,pubkey
```

it will fail with "no suitable auth methods..."

But this server config works with OpenSSH and Putty.

I nailed the issue down to Authenticate() in ConnectionInfo, where SSH.Net filters and counts auth-methods.
So a auth method can just used once!

Following quickpatch fixes the isse:

```
--- a/Renci.SshNet/ConnectionInfo.cs
+++ b/Renci.SshNet/ConnectionInfo.cs
@@ -411,7 +411,7 @@ public bool Authenticate(Session session)
while (authenticated != AuthenticationResult.Success)
{
// Find first authentication method
- var method = this.AuthenticationMethods.Where((a) => allowedAuthentications.Contains(a.Name) && !triedAuthentications.Contains(a.Name)).FirstOrDefault();
+ var method = this.AuthenticationMethods.Where((a) => allowedAuthentications.Contains(a.Name)).FirstOrDefault();
if (method == null)
throw new SshAuthenticationException("No suitable authentication method found to complete authentication.");

@@ -419,7 +419,7 @@ public bool Authenticate(Session session)

authenticated = method.Authenticate(session);

- if (authenticated == AuthenticationResult.PartialSuccess || (method.AllowedAuthentications != null && method.AllowedAuthentications.Count() < allowedAuthentications.Count()))
+ if (authenticated == AuthenticationResult.PartialSuccess || (method.AllowedAuthentications != null))
{
// If further authentication is required then continue to try another method
allowedAuthentications = method.AllowedAuthentications;
@@ -427,7 +427,7 @@ public bool Authenticate(Session session)
}

// If authentication Fail, and all the authentication have been tried.
- if (authenticated == AuthenticationResult.Failure && (triedAuthentications.Count() == allowedAuthentications.Count()))
+ if (authenticated == AuthenticationResult.Failure)
{
break;
}
```
Comments: ** Comment from web user: drieseng **

Fixed in changeset 34957.


Viewing all articles
Browse latest Browse all 1026

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>