Skip to content
Permalink
Browse files

[FIXED JENKINS-24273] Thrilead SSH throws IOE when passed an unknown …

…keytype
  • Loading branch information
stephenc committed Aug 15, 2014
1 parent 5c60c86 commit a5fb4045c3e50d651e32593a789310d01a31648a
@@ -35,6 +35,7 @@
import hudson.util.Secret;

import java.io.IOException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.List;
@@ -102,16 +103,25 @@ protected boolean doAuthenticate() {
Collection<String> availableMethods = getRemainingAuthMethods();
if (availableMethods.contains("publickey")) {
int count = 0;
List<IOException> ioe = new ArrayList<IOException>();
for (String privateKey : getPrivateKeys(user)) {
if (connection.authenticateWithPublicKey(username, privateKey.toCharArray(), passphrase)) {
LOGGER.fine("Authentication with 'publickey' succeeded.");
return true;
try {
if (connection.authenticateWithPublicKey(username, privateKey.toCharArray(), passphrase)) {
LOGGER.fine("Authentication with 'publickey' succeeded.");
return true;
}
} catch (IOException e) {
ioe.add(e);
}
count++;
getListener()
.error("Server rejected the %d private key(s) for %s (credentialId:%s/method:publickey)",
count, username, user.getId());
}
for (IOException e : ioe) {
e.printStackTrace(getListener()
.error("Failed to authenticate as %s with credential=%s", username, getUser().getId()));
}
return false;
} else {
getListener().error("The server does not allow public key authentication. Available options are %s",

0 comments on commit a5fb404

Please sign in to comment.
You can’t perform that action at this time.