From 003263a0d49764b598bb30b85e212aecdbf40ed3 Mon Sep 17 00:00:00 2001 From: Patrick Tasse Date: Tue, 17 Mar 2015 18:10:50 -0400 Subject: [PATCH] Bug 462418 - Use stored password on non-preferred password based auth. Change-Id: Id169ecbb47cb4ad8d04d68a5d37338dad77b2b60 Signed-off-by: Patrick Tasse --- .../eclipse/remote/internal/jsch/core/JSchConnection.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/bundles/org.eclipse.remote.jsch.core/src/org/eclipse/remote/internal/jsch/core/JSchConnection.java b/bundles/org.eclipse.remote.jsch.core/src/org/eclipse/remote/internal/jsch/core/JSchConnection.java index f622559d3d6..c38d967ff08 100644 --- a/bundles/org.eclipse.remote.jsch.core/src/org/eclipse/remote/internal/jsch/core/JSchConnection.java +++ b/bundles/org.eclipse.remote.jsch.core/src/org/eclipse/remote/internal/jsch/core/JSchConnection.java @@ -7,6 +7,7 @@ * * Contributors: * IBM Corporation - Initial API and implementation + * Patrick Tasse - [462418] use stored password on non-preferred password based authentication *******************************************************************************/ package org.eclipse.remote.internal.jsch.core; @@ -828,10 +829,13 @@ public class JSchConnection implements IRemoteConnectionControlService, IRemoteC session.setUserInfo(new JSchUserInfo()); if (isPasswordAuth()) { session.setConfig("PreferredAuthentications", "password,keyboard-interactive,gssapi-with-mic,publickey"); //$NON-NLS-1$ //$NON-NLS-2$ - session.setPassword(getPassword()); } else { session.setConfig("PreferredAuthentications", "publickey,gssapi-with-mic,password,keyboard-interactive"); //$NON-NLS-1$ //$NON-NLS-2$ } + String password = getPassword(); + if (!password.isEmpty()) { + session.setPassword(password); + } if (getProxyCommand().isEmpty() && getProxyConnectionName().isEmpty()) { fJSchService.connect(session, getTimeout() * 1000, progress.newChild(10)); // connect without proxy } else {