Ensure that ssh authentication is retried only in JGit

JGit wants to control retries during ssh authentication. But JSch by
default already retries 6 times. Hence disable retries in JSch. Without
this the credentials provider isn't reset if e.g. wrong credentials are
specified.

Bug: 430210
Change-Id: I6fa726a14a84b06411e7010608c7a1e2bfb8bfe8
This commit is contained in:
Christian Halstrick 2014-03-14 16:21:46 +01:00 committed by Matthias Sohn
parent 1bdfd3b3aa
commit fc9b1fbf6b
1 changed files with 3 additions and 0 deletions

View File

@ -148,6 +148,9 @@ private Session createSession(CredentialsProvider credentialsProvider,
FS fs, String user, final String pass, String host, int port, FS fs, String user, final String pass, String host, int port,
final OpenSshConfig.Host hc) throws JSchException { final OpenSshConfig.Host hc) throws JSchException {
final Session session = createSession(hc, user, host, port, fs); final Session session = createSession(hc, user, host, port, fs);
// We retry already in getSession() method. JSch must not retry
// on its own.
session.setConfig("MaxAuthTries", "1"); //$NON-NLS-1$ //$NON-NLS-2$
if (pass != null) if (pass != null)
session.setPassword(pass); session.setPassword(pass);
final String strictHostKeyCheckingPolicy = hc final String strictHostKeyCheckingPolicy = hc