diff --git a/0001-Ensure-the-correct-classpath-is-set-for-the-jgit-com.patch b/0001-Ensure-the-correct-classpath-is-set-for-the-jgit-com.patch index b5e945c..f17052f 100644 --- a/0001-Ensure-the-correct-classpath-is-set-for-the-jgit-com.patch +++ b/0001-Ensure-the-correct-classpath-is-set-for-the-jgit-com.patch @@ -1,7 +1,7 @@ -From 63c00fabcdea6418ccf03c139d3db751fcf7684b Mon Sep 17 00:00:00 2001 +From 49b9177852da113b9fe2833a6f7b2acf1ba6491d Mon Sep 17 00:00:00 2001 From: Mat Booth Date: Fri, 7 Dec 2018 10:04:44 +0000 -Subject: [PATCH 1/5] Ensure the correct classpath is set for the jgit command +Subject: [PATCH 1/3] Ensure the correct classpath is set for the jgit command line tool --- @@ -17,7 +17,7 @@ index e263782..87e85c7 100644 [ $? -gt 0 -a -f "$0" ] && this_script="$0" cp=$this_script - -+export JGIT_CLASSPATH="$(build-classpath jgit slf4j/api slf4j/simple args4j jzlib jsch commons-compress xz-java javaewah httpcomponents/httpcore httpcomponents/httpclient commons-logging commons-codec eddsa apache-sshd)" ++export JGIT_CLASSPATH="$(build-classpath jgit slf4j/api slf4j/simple args4j jzlib jsch commons-compress xz-java javaewah httpcomponents/httpcore httpcomponents/httpclient commons-logging commons-codec eddsa apache-sshd/sshd-osgi apache-sshd/sshd-sftp)" platform="`uname`" if [ -n "$JGIT_CLASSPATH" ] then diff --git a/0002-Don-t-embed-versions-of-third-party-libs-use-feature.patch b/0002-Don-t-embed-versions-of-third-party-libs-use-feature.patch index d461fca..539494e 100644 --- a/0002-Don-t-embed-versions-of-third-party-libs-use-feature.patch +++ b/0002-Don-t-embed-versions-of-third-party-libs-use-feature.patch @@ -1,7 +1,7 @@ -From 3c29ed87fd2cd38961e9b3ac9c4809fe659096fd Mon Sep 17 00:00:00 2001 +From 85226840dbe9f5547dd2778734415d6283c90258 Mon Sep 17 00:00:00 2001 From: Mat Booth Date: Fri, 7 Dec 2018 10:17:02 +0000 -Subject: [PATCH 2/5] Don't embed versions of third-party libs, use feature +Subject: [PATCH 2/3] Don't embed versions of third-party libs, use feature requirements instead --- @@ -14,7 +14,7 @@ Subject: [PATCH 2/5] Don't embed versions of third-party libs, use feature 6 files changed, 24 insertions(+), 155 deletions(-) diff --git a/org.eclipse.jgit.packaging/org.eclipse.jgit.feature/feature.xml b/org.eclipse.jgit.packaging/org.eclipse.jgit.feature/feature.xml -index d99f5de..da2de2f 100644 +index d213b7b..1783bb1 100644 --- a/org.eclipse.jgit.packaging/org.eclipse.jgit.feature/feature.xml +++ b/org.eclipse.jgit.packaging/org.eclipse.jgit.feature/feature.xml @@ -22,6 +22,18 @@ @@ -113,13 +113,13 @@ index d99f5de..da2de2f 100644 - diff --git a/org.eclipse.jgit.packaging/org.eclipse.jgit.http.apache.feature/feature.xml b/org.eclipse.jgit.packaging/org.eclipse.jgit.http.apache.feature/feature.xml -index 2966c42..59d2ed9 100644 +index f45fb19..1f70cc1 100644 --- a/org.eclipse.jgit.packaging/org.eclipse.jgit.http.apache.feature/feature.xml +++ b/org.eclipse.jgit.packaging/org.eclipse.jgit.http.apache.feature/feature.xml @@ -24,6 +24,8 @@ - + + + @@ -145,20 +145,20 @@ index 2966c42..59d2ed9 100644 - diff --git a/org.eclipse.jgit.packaging/org.eclipse.jgit.junit.feature/feature.xml b/org.eclipse.jgit.packaging/org.eclipse.jgit.junit.feature/feature.xml -index b14057c..2b9e42b 100644 +index 34a0868..d6b8125 100644 --- a/org.eclipse.jgit.packaging/org.eclipse.jgit.junit.feature/feature.xml +++ b/org.eclipse.jgit.packaging/org.eclipse.jgit.junit.feature/feature.xml -@@ -24,6 +24,9 @@ - +@@ -25,6 +25,9 @@ + + -+ ++ + @@ -170,7 +170,7 @@ index b14057c..2b9e42b 100644 - unpack="false"/> - - diff --git a/org.eclipse.jgit.packaging/org.eclipse.jgit.lfs.feature/feature.xml b/org.eclipse.jgit.packaging/org.eclipse.jgit.lfs.feature/feature.xml -index 52c960f..cf02cda 100644 +index 8213753..3c5598b 100644 --- a/org.eclipse.jgit.packaging/org.eclipse.jgit.lfs.feature/feature.xml +++ b/org.eclipse.jgit.packaging/org.eclipse.jgit.lfs.feature/feature.xml @@ -24,6 +24,7 @@ - + + @@ -209,20 +209,20 @@ index 52c960f..cf02cda 100644 - diff --git a/org.eclipse.jgit.packaging/org.eclipse.jgit.pgm.feature/feature.xml b/org.eclipse.jgit.packaging/org.eclipse.jgit.pgm.feature/feature.xml -index 023c09a..976ae9b 100644 +index f6c9cfc..82caaa8 100644 --- a/org.eclipse.jgit.packaging/org.eclipse.jgit.pgm.feature/feature.xml +++ b/org.eclipse.jgit.packaging/org.eclipse.jgit.pgm.feature/feature.xml -@@ -34,6 +34,9 @@ - - - +@@ -38,6 +38,9 @@ + + + + + + @@ -249,14 +249,14 @@ index 023c09a..976ae9b 100644 - diff --git a/org.eclipse.jgit.packaging/org.eclipse.jgit.ssh.apache.feature/feature.xml b/org.eclipse.jgit.packaging/org.eclipse.jgit.ssh.apache.feature/feature.xml -index 94c7230..19807ac 100644 +index f4dded6..9d92cb2 100644 --- a/org.eclipse.jgit.packaging/org.eclipse.jgit.ssh.apache.feature/feature.xml +++ b/org.eclipse.jgit.packaging/org.eclipse.jgit.ssh.apache.feature/feature.xml @@ -24,6 +24,9 @@ - -+ + ++ + + @@ -267,7 +267,7 @@ index 94c7230..19807ac 100644 unpack="false"/> - -Date: Fri, 7 Dec 2018 10:33:23 +0000 -Subject: [PATCH 3/5] Port to apache-sshd 2.2.0 - -IoConnector.connect() grew extra parameters to support specifying -the local bind port/address and optional context. Passing nulls -continues to use an automatically selected ephemeral port/address, -with no context. - -The shutdownOnExit parameter was removed everywhere the use of -'java.util.concurrent.ExecutorService' was substituted for the use -of 'org.apache.sshd.common.util.threads.ExecutorService' ---- - .../META-INF/MANIFEST.MF | 42 +++---- - org.eclipse.jgit.junit.ssh/pom.xml | 2 +- - .../jgit/junit/ssh/SshTestGitServer.java | 30 +++-- - .../META-INF/MANIFEST.MF | 80 ++++++------ - org.eclipse.jgit.ssh.apache/pom.xml | 2 +- - .../sshd/CachingKeyPairProvider.java | 96 +++------------ - .../sshd/EncryptedFileKeyPairProvider.java | 45 +++---- - .../transport/sshd/JGitClientSession.java | 12 +- - .../transport/sshd/JGitPublicKeyIterator.java | 15 ++- - .../transport/sshd/JGitSshClient.java | 56 ++++----- - .../transport/sshd/JGitSshConfig.java | 5 +- - .../sshd/OpenSshServerKeyVerifier.java | 2 +- - .../sshd/PasswordProviderWrapper.java | 42 +++---- - .../sshd/RepeatingFilePasswordProvider.java | 115 ------------------ - .../transport/sshd/SshdSessionFactory.java | 21 ++-- - pom.xml | 2 +- - 16 files changed, 202 insertions(+), 365 deletions(-) - delete mode 100644 org.eclipse.jgit.ssh.apache/src/org/eclipse/jgit/internal/transport/sshd/RepeatingFilePasswordProvider.java - -diff --git a/org.eclipse.jgit.junit.ssh/META-INF/MANIFEST.MF b/org.eclipse.jgit.junit.ssh/META-INF/MANIFEST.MF -index cf6cf1a..85cf64f 100644 ---- a/org.eclipse.jgit.junit.ssh/META-INF/MANIFEST.MF -+++ b/org.eclipse.jgit.junit.ssh/META-INF/MANIFEST.MF -@@ -8,27 +8,27 @@ Bundle-Localization: plugin - Bundle-Vendor: %provider_name - Bundle-ActivationPolicy: lazy - Bundle-RequiredExecutionEnvironment: JavaSE-1.8 --Import-Package: org.apache.sshd.common;version="[2.0.0,2.1.0)", -- org.apache.sshd.common.config.keys;version="[2.0.0,2.1.0)", -- org.apache.sshd.common.file.virtualfs;version="[2.0.0,2.1.0)", -- org.apache.sshd.common.helpers;version="[2.0.0,2.1.0)", -- org.apache.sshd.common.io;version="[2.0.0,2.1.0)", -- org.apache.sshd.common.kex;version="[2.0.0,2.1.0)", -- org.apache.sshd.common.keyprovider;version="[2.0.0,2.1.0)", -- org.apache.sshd.common.session;version="[2.0.0,2.1.0)", -- org.apache.sshd.common.util.buffer;version="[2.0.0,2.1.0)", -- org.apache.sshd.common.util.logging;version="[2.0.0,2.1.0)", -- org.apache.sshd.common.util.security;version="[2.0.0,2.1.0)", -- org.apache.sshd.server;version="[2.0.0,2.1.0)", -- org.apache.sshd.server.auth;version="[2.0.0,2.1.0)", -- org.apache.sshd.server.auth.gss;version="[2.0.0,2.1.0)", -- org.apache.sshd.server.auth.keyboard;version="[2.0.0,2.1.0)", -- org.apache.sshd.server.auth.password;version="[2.0.0,2.1.0)", -- org.apache.sshd.server.command;version="[2.0.0,2.1.0)", -- org.apache.sshd.server.session;version="[2.0.0,2.1.0)", -- org.apache.sshd.server.shell;version="[2.0.0,2.1.0)", -- org.apache.sshd.server.subsystem;version="[2.0.0,2.1.0)", -- org.apache.sshd.server.subsystem.sftp;version="[2.0.0,2.1.0)", -+Import-Package: org.apache.sshd.common;version="[2.2.0,2.3.0)", -+ org.apache.sshd.common.config.keys;version="[2.2.0,2.3.0)", -+ org.apache.sshd.common.file.virtualfs;version="[2.2.0,2.3.0)", -+ org.apache.sshd.common.helpers;version="[2.2.0,2.3.0)", -+ org.apache.sshd.common.io;version="[2.2.0,2.3.0)", -+ org.apache.sshd.common.kex;version="[2.2.0,2.3.0)", -+ org.apache.sshd.common.keyprovider;version="[2.2.0,2.3.0)", -+ org.apache.sshd.common.session;version="[2.2.0,2.3.0)", -+ org.apache.sshd.common.util.buffer;version="[2.2.0,2.3.0)", -+ org.apache.sshd.common.util.logging;version="[2.2.0,2.3.0)", -+ org.apache.sshd.common.util.security;version="[2.2.0,2.3.0)", -+ org.apache.sshd.server;version="[2.2.0,2.3.0)", -+ org.apache.sshd.server.auth;version="[2.2.0,2.3.0)", -+ org.apache.sshd.server.auth.gss;version="[2.2.0,2.3.0)", -+ org.apache.sshd.server.auth.keyboard;version="[2.2.0,2.3.0)", -+ org.apache.sshd.server.auth.password;version="[2.2.0,2.3.0)", -+ org.apache.sshd.server.command;version="[2.2.0,2.3.0)", -+ org.apache.sshd.server.session;version="[2.2.0,2.3.0)", -+ org.apache.sshd.server.shell;version="[2.2.0,2.3.0)", -+ org.apache.sshd.server.subsystem;version="[2.2.0,2.3.0)", -+ org.apache.sshd.server.subsystem.sftp;version="[2.2.0,2.3.0)", - org.eclipse.jgit.annotations;version="[5.3.0,5.4.0)", - org.eclipse.jgit.lib;version="[5.3.0,5.4.0)", - org.eclipse.jgit.transport;version="[5.3.0,5.4.0)", -diff --git a/org.eclipse.jgit.junit.ssh/pom.xml b/org.eclipse.jgit.junit.ssh/pom.xml -index 22e3bb5..87e7314 100644 ---- a/org.eclipse.jgit.junit.ssh/pom.xml -+++ b/org.eclipse.jgit.junit.ssh/pom.xml -@@ -73,7 +73,7 @@ - - - org.apache.sshd -- sshd-core -+ sshd-osgi - ${apache-sshd-version} - - -diff --git a/org.eclipse.jgit.junit.ssh/src/org/eclipse/jgit/junit/ssh/SshTestGitServer.java b/org.eclipse.jgit.junit.ssh/src/org/eclipse/jgit/junit/ssh/SshTestGitServer.java -index f5af2e5..03ca0b4 100644 ---- a/org.eclipse.jgit.junit.ssh/src/org/eclipse/jgit/junit/ssh/SshTestGitServer.java -+++ b/org.eclipse.jgit.junit.ssh/src/org/eclipse/jgit/junit/ssh/SshTestGitServer.java -@@ -55,10 +55,9 @@ - import java.util.Collections; - import java.util.List; - import java.util.Locale; --import java.util.concurrent.ExecutorService; --import java.util.concurrent.Executors; - - import org.apache.sshd.common.NamedFactory; -+import org.apache.sshd.common.NamedResource; - import org.apache.sshd.common.SshConstants; - import org.apache.sshd.common.config.keys.AuthorizedKeyEntry; - import org.apache.sshd.common.config.keys.KeyUtils; -@@ -67,6 +66,8 @@ - import org.apache.sshd.common.session.Session; - import org.apache.sshd.common.util.buffer.Buffer; - import org.apache.sshd.common.util.security.SecurityUtils; -+import org.apache.sshd.common.util.threads.CloseableExecutorService; -+import org.apache.sshd.common.util.threads.ThreadUtils; - import org.apache.sshd.server.ServerAuthenticationManager; - import org.apache.sshd.server.SshServer; - import org.apache.sshd.server.auth.UserAuth; -@@ -110,8 +111,8 @@ - @NonNull - protected PublicKey testKey; - -- private final ExecutorService executorService = Executors -- .newFixedThreadPool(2); -+ private final CloseableExecutorService executorService = ThreadUtils -+ .newFixedThreadPool("", 2); - - /** - * Creates a ssh git test server. It serves one single repository, -@@ -138,11 +139,12 @@ public SshTestGitServer(@NonNull String testUser, @NonNull Path testKey, - server = SshServer.setUpDefaultServer(); - // Set host key - try (ByteArrayInputStream in = new ByteArrayInputStream(hostKey)) { -- hostKeys.add(SecurityUtils.loadKeyPairIdentity("", in, null)); -+ SecurityUtils.loadKeyPairIdentities(null, NamedResource.ofName(""), -+ in, null).forEach(hostKeys::add); - } catch (IOException | GeneralSecurityException e) { - // Ignore. - } -- server.setKeyPairProvider(() -> hostKeys); -+ server.setKeyPairProvider(session -> hostKeys); - - configureAuthentication(); - -@@ -276,13 +278,15 @@ protected void configureShell() { - public void addHostKey(@NonNull Path key, boolean inFront) - throws IOException, GeneralSecurityException { - try (InputStream in = Files.newInputStream(key)) { -- KeyPair pair = SecurityUtils.loadKeyPairIdentity(key.toString(), in, -- null); -+ Iterable pairs = SecurityUtils.loadKeyPairIdentities(null, -+ NamedResource.ofName(key.toString()), in, null); -+ for (KeyPair pair : pairs) { - if (inFront) { - hostKeys.add(0, pair); - } else { - hostKeys.add(pair); - } -+ } - } - } - -@@ -335,14 +339,14 @@ public void stop() throws IOException { - public void setTestUserPublicKey(Path key) - throws IOException, GeneralSecurityException { - this.testKey = AuthorizedKeyEntry.readAuthorizedKeys(key).get(0) -- .resolvePublicKey(PublicKeyEntryResolver.IGNORING); -+ .resolvePublicKey(null, PublicKeyEntryResolver.IGNORING); - } - - private class GitUploadPackCommand extends AbstractCommandSupport { - - protected GitUploadPackCommand(String command, -- ExecutorService executorService) { -- super(command, executorService, false); -+ CloseableExecutorService executorService) { -+ super(command, executorService); - } - - @Override -@@ -370,8 +374,8 @@ public void run() { - private class GitReceivePackCommand extends AbstractCommandSupport { - - protected GitReceivePackCommand(String command, -- ExecutorService executorService) { -- super(command, executorService, false); -+ CloseableExecutorService executorService) { -+ super(command, executorService); - } - - @Override -diff --git a/org.eclipse.jgit.ssh.apache/META-INF/MANIFEST.MF b/org.eclipse.jgit.ssh.apache/META-INF/MANIFEST.MF -index 25ebc48..40b0a27 100644 ---- a/org.eclipse.jgit.ssh.apache/META-INF/MANIFEST.MF -+++ b/org.eclipse.jgit.ssh.apache/META-INF/MANIFEST.MF -@@ -32,46 +32,46 @@ Export-Package: org.eclipse.jgit.internal.transport.sshd;version="5.3.0";x-inter - org.apache.sshd.client.session, - org.apache.sshd.client.keyverifier" - Import-Package: net.i2p.crypto.eddsa;version="[0.3.0,0.4.0)", -- org.apache.sshd.agent;version="[2.0.0,2.1.0)", -- org.apache.sshd.client;version="[2.0.0,2.1.0)", -- org.apache.sshd.client.auth;version="[2.0.0,2.1.0)", -- org.apache.sshd.client.auth.keyboard;version="[2.0.0,2.1.0)", -- org.apache.sshd.client.auth.password;version="[2.0.0,2.1.0)", -- org.apache.sshd.client.auth.pubkey;version="[2.0.0,2.1.0)", -- org.apache.sshd.client.channel;version="[2.0.0,2.1.0)", -- org.apache.sshd.client.config.hosts;version="[2.0.0,2.1.0)", -- org.apache.sshd.client.config.keys;version="[2.0.0,2.1.0)", -- org.apache.sshd.client.future;version="[2.0.0,2.1.0)", -- org.apache.sshd.client.keyverifier;version="[2.0.0,2.1.0)", -- org.apache.sshd.client.session;version="[2.0.0,2.1.0)", -- org.apache.sshd.client.subsystem.sftp;version="[2.0.0,2.1.0)", -- org.apache.sshd.common;version="[2.0.0,2.1.0)", -- org.apache.sshd.common.auth;version="[2.0.0,2.1.0)", -- org.apache.sshd.common.channel;version="[2.0.0,2.1.0)", -- org.apache.sshd.common.compression;version="[2.0.0,2.1.0)", -- org.apache.sshd.common.config.keys;version="[2.0.0,2.1.0)", -- org.apache.sshd.common.config.keys.loader;version="[2.0.0,2.1.0)", -- org.apache.sshd.common.digest;version="[2.0.0,2.1.0)", -- org.apache.sshd.common.forward;version="[2.0.0,2.1.0)", -- org.apache.sshd.common.future;version="[2.0.0,2.1.0)", -- org.apache.sshd.common.helpers;version="[2.0.0,2.1.0)", -- org.apache.sshd.common.io;version="[2.0.0,2.1.0)", -- org.apache.sshd.common.kex;version="[2.0.0,2.1.0)", -- org.apache.sshd.common.keyprovider;version="[2.0.0,2.1.0)", -- org.apache.sshd.common.mac;version="[2.0.0,2.1.0)", -- org.apache.sshd.common.random;version="[2.0.0,2.1.0)", -- org.apache.sshd.common.session;version="[2.0.0,2.1.0)", -- org.apache.sshd.common.session.helpers;version="[2.0.0,2.1.0)", -- org.apache.sshd.common.signature;version="[2.0.0,2.1.0)", -- org.apache.sshd.common.subsystem.sftp;version="[2.0.0,2.1.0)", -- org.apache.sshd.common.util;version="[2.0.0,2.1.0)", -- org.apache.sshd.common.util.buffer;version="[2.0.0,2.1.0)", -- org.apache.sshd.common.util.closeable;version="[2.0.0,2.1.0)", -- org.apache.sshd.common.util.io;version="[2.0.0,2.1.0)", -- org.apache.sshd.common.util.logging;version="[2.0.0,2.1.0)", -- org.apache.sshd.common.util.net;version="[2.0.0,2.1.0)", -- org.apache.sshd.common.util.security;version="[2.0.0,2.1.0)", -- org.apache.sshd.server.auth;version="[2.0.0,2.1.0)", -+ org.apache.sshd.agent;version="[2.2.0,2.3.0)", -+ org.apache.sshd.client;version="[2.2.0,2.3.0)", -+ org.apache.sshd.client.auth;version="[2.2.0,2.3.0)", -+ org.apache.sshd.client.auth.keyboard;version="[2.2.0,2.3.0)", -+ org.apache.sshd.client.auth.password;version="[2.2.0,2.3.0)", -+ org.apache.sshd.client.auth.pubkey;version="[2.2.0,2.3.0)", -+ org.apache.sshd.client.channel;version="[2.2.0,2.3.0)", -+ org.apache.sshd.client.config.hosts;version="[2.2.0,2.3.0)", -+ org.apache.sshd.client.config.keys;version="[2.2.0,2.3.0)", -+ org.apache.sshd.client.future;version="[2.2.0,2.3.0)", -+ org.apache.sshd.client.keyverifier;version="[2.2.0,2.3.0)", -+ org.apache.sshd.client.session;version="[2.2.0,2.3.0)", -+ org.apache.sshd.client.subsystem.sftp;version="[2.2.0,2.3.0)", -+ org.apache.sshd.common;version="[2.2.0,2.3.0)", -+ org.apache.sshd.common.auth;version="[2.2.0,2.3.0)", -+ org.apache.sshd.common.channel;version="[2.2.0,2.3.0)", -+ org.apache.sshd.common.compression;version="[2.2.0,2.3.0)", -+ org.apache.sshd.common.config.keys;version="[2.2.0,2.3.0)", -+ org.apache.sshd.common.config.keys.loader;version="[2.2.0,2.3.0)", -+ org.apache.sshd.common.digest;version="[2.2.0,2.3.0)", -+ org.apache.sshd.common.forward;version="[2.2.0,2.3.0)", -+ org.apache.sshd.common.future;version="[2.2.0,2.3.0)", -+ org.apache.sshd.common.helpers;version="[2.2.0,2.3.0)", -+ org.apache.sshd.common.io;version="[2.2.0,2.3.0)", -+ org.apache.sshd.common.kex;version="[2.2.0,2.3.0)", -+ org.apache.sshd.common.keyprovider;version="[2.2.0,2.3.0)", -+ org.apache.sshd.common.mac;version="[2.2.0,2.3.0)", -+ org.apache.sshd.common.random;version="[2.2.0,2.3.0)", -+ org.apache.sshd.common.session;version="[2.2.0,2.3.0)", -+ org.apache.sshd.common.session.helpers;version="[2.2.0,2.3.0)", -+ org.apache.sshd.common.signature;version="[2.2.0,2.3.0)", -+ org.apache.sshd.common.subsystem.sftp;version="[2.2.0,2.3.0)", -+ org.apache.sshd.common.util;version="[2.2.0,2.3.0)", -+ org.apache.sshd.common.util.buffer;version="[2.2.0,2.3.0)", -+ org.apache.sshd.common.util.closeable;version="[2.2.0,2.3.0)", -+ org.apache.sshd.common.util.io;version="[2.2.0,2.3.0)", -+ org.apache.sshd.common.util.logging;version="[2.2.0,2.3.0)", -+ org.apache.sshd.common.util.net;version="[2.2.0,2.3.0)", -+ org.apache.sshd.common.util.security;version="[2.2.0,2.3.0)", -+ org.apache.sshd.server.auth;version="[2.2.0,2.3.0)", - org.eclipse.jgit.annotations;version="[5.3.0,5.4.0)", - org.eclipse.jgit.errors;version="[5.3.0,5.4.0)", - org.eclipse.jgit.fnmatch;version="[5.3.0,5.4.0)", -diff --git a/org.eclipse.jgit.ssh.apache/pom.xml b/org.eclipse.jgit.ssh.apache/pom.xml -index a00ce31..120f63c 100644 ---- a/org.eclipse.jgit.ssh.apache/pom.xml -+++ b/org.eclipse.jgit.ssh.apache/pom.xml -@@ -75,7 +75,7 @@ - - - org.apache.sshd -- sshd-core -+ sshd-osgi - ${apache-sshd-version} - - -diff --git a/org.eclipse.jgit.ssh.apache/src/org/eclipse/jgit/internal/transport/sshd/CachingKeyPairProvider.java b/org.eclipse.jgit.ssh.apache/src/org/eclipse/jgit/internal/transport/sshd/CachingKeyPairProvider.java -index 1072f32..7efb7f1 100644 ---- a/org.eclipse.jgit.ssh.apache/src/org/eclipse/jgit/internal/transport/sshd/CachingKeyPairProvider.java -+++ b/org.eclipse.jgit.ssh.apache/src/org/eclipse/jgit/internal/transport/sshd/CachingKeyPairProvider.java -@@ -54,9 +54,9 @@ - import java.util.Collections; - import java.util.Iterator; - import java.util.List; --import java.util.NoSuchElementException; --import java.util.concurrent.CancellationException; - -+import org.apache.sshd.common.NamedResource; -+import org.apache.sshd.common.session.SessionContext; - import org.eclipse.jgit.transport.sshd.KeyCache; - - /** -@@ -66,8 +66,6 @@ - public class CachingKeyPairProvider extends EncryptedFileKeyPairProvider - implements Iterable { - -- private final KeyCache cache; -- - /** - * Creates a new {@link CachingKeyPairProvider} using the given - * {@link KeyCache}. If the cache is {@code null}, this is a simple -@@ -80,7 +78,6 @@ - */ - public CachingKeyPairProvider(List paths, KeyCache cache) { - super(paths); -- this.cache = cache; - } - - @Override -@@ -89,16 +86,29 @@ public CachingKeyPairProvider(List paths, KeyCache cache) { - if (resources.isEmpty()) { - return Collections.emptyListIterator(); - } -- return new CancellingKeyPairIterator(resources); -+ Collection c = new ArrayList<>(); -+ for (Path r : resources) { -+ try { -+ doLoadKeys(sessioncontext, r).forEach(c::add); -+ } catch (IOException | GeneralSecurityException e) { -+ // TODO Auto-generated catch block -+ e.printStackTrace(); -+ } -+ } -+ return c.iterator(); - } - -+ private SessionContext sessioncontext; -+ - @Override -- public Iterable loadKeys() { -+ public Iterable loadKeys(SessionContext session) { -+ this.sessioncontext = session; - return this; - } - - @Override -- protected KeyPair doLoadKey(Path resource) -+ protected Iterable doLoadKeys(SessionContext session, -+ Path resource) - throws IOException, GeneralSecurityException { - if (!Files.exists(resource)) { - log.warn(format(SshdText.get().identityFileNotFound, resource)); -@@ -107,74 +117,8 @@ protected KeyPair doLoadKey(Path resource) - // By calling doLoadKey(String, Path, FilePasswordProvider) instead of - // super.doLoadKey(Path) we can bypass the key caching in - // AbstractResourceKeyPairProvider, over which we have no real control. -- String resourceId = resource.toString(); -- if (cache == null) { -- return doLoadKey(resourceId, resource, getPasswordFinder()); -- } -- Throwable t[] = { null }; -- KeyPair key = cache.get(resource, p -> { -- try { -- return doLoadKey(resourceId, p, getPasswordFinder()); -- } catch (IOException | GeneralSecurityException e) { -- t[0] = e; -- return null; -- } -- }); -- if (t[0] != null) { -- if (t[0] instanceof CancellationException) { -- throw (CancellationException) t[0]; -- } -- throw new IOException( -- format(SshdText.get().keyLoadFailed, resource), t[0]); -- } -- return key; -+ NamedResource resourceId = NamedResource.ofName(resource.toString()); -+ return doLoadKeys(session, resourceId, resource, getPasswordFinder()); - } - -- private class CancellingKeyPairIterator implements Iterator { -- -- private final Iterator paths; -- -- private KeyPair nextItem; -- -- private boolean nextSet; -- -- public CancellingKeyPairIterator(Collection resources) { -- List copy = new ArrayList<>(resources.size()); -- copy.addAll(resources); -- paths = copy.iterator(); -- } -- -- @Override -- public boolean hasNext() { -- if (nextSet) { -- return nextItem != null; -- } -- nextSet = true; -- while (nextItem == null && paths.hasNext()) { -- try { -- nextItem = doLoadKey(paths.next()); -- } catch (CancellationException cancelled) { -- throw cancelled; -- } catch (Exception other) { -- log.warn(other.toString()); -- } -- } -- return nextItem != null; -- } -- -- @Override -- public KeyPair next() { -- if (!nextSet && !hasNext()) { -- throw new NoSuchElementException(); -- } -- KeyPair result = nextItem; -- nextItem = null; -- nextSet = false; -- if (result == null) { -- throw new NoSuchElementException(); -- } -- return result; -- } -- -- } - } -diff --git a/org.eclipse.jgit.ssh.apache/src/org/eclipse/jgit/internal/transport/sshd/EncryptedFileKeyPairProvider.java b/org.eclipse.jgit.ssh.apache/src/org/eclipse/jgit/internal/transport/sshd/EncryptedFileKeyPairProvider.java -index ef8e611..431a5a0 100644 ---- a/org.eclipse.jgit.ssh.apache/src/org/eclipse/jgit/internal/transport/sshd/EncryptedFileKeyPairProvider.java -+++ b/org.eclipse.jgit.ssh.apache/src/org/eclipse/jgit/internal/transport/sshd/EncryptedFileKeyPairProvider.java -@@ -51,24 +51,23 @@ - import java.security.InvalidKeyException; - import java.security.KeyPair; - import java.security.NoSuchProviderException; --import java.security.PrivateKey; - import java.util.Collection; - import java.util.Iterator; - import java.util.List; - --import javax.security.auth.DestroyFailedException; -- -+import org.apache.sshd.common.NamedResource; - import org.apache.sshd.common.config.keys.FilePasswordProvider; -+import org.apache.sshd.common.config.keys.FilePasswordProvider.ResourceDecodeResult; - import org.apache.sshd.common.config.keys.loader.KeyPairResourceParser; - import org.apache.sshd.common.keyprovider.FileKeyPairProvider; -+import org.apache.sshd.common.session.SessionContext; - import org.apache.sshd.common.util.io.IoUtils; - import org.apache.sshd.common.util.security.SecurityUtils; --import org.eclipse.jgit.internal.transport.sshd.RepeatingFilePasswordProvider.ResourceDecodeResult; - - /** - * A {@link FileKeyPairProvider} that asks repeatedly for a passphrase for an - * encrypted private key if the {@link FilePasswordProvider} is a -- * {@link RepeatingFilePasswordProvider}. -+ * {@link PasswordProviderWrapper}. - */ - public abstract class EncryptedFileKeyPairProvider extends FileKeyPairProvider { - -@@ -88,11 +87,13 @@ public EncryptedFileKeyPairProvider(List paths) { - } - - @Override -- protected KeyPair doLoadKey(String resourceKey, InputStream inputStream, -+ protected Iterable doLoadKeys(SessionContext session, -+ NamedResource resourceKey, InputStream inputStream, - FilePasswordProvider provider) - throws IOException, GeneralSecurityException { -- if (!(provider instanceof RepeatingFilePasswordProvider)) { -- return super.doLoadKey(resourceKey, inputStream, provider); -+ if (!(provider instanceof PasswordProviderWrapper)) { -+ return super.doLoadKeys(session, resourceKey, inputStream, -+ provider); - } - KeyPairResourceParser parser = SecurityUtils.getKeyPairResourceParser(); - if (parser == null) { -@@ -100,22 +101,25 @@ protected KeyPair doLoadKey(String resourceKey, InputStream inputStream, - throw new NoSuchProviderException( - "No registered key-pair resource parser"); //$NON-NLS-1$ - } -- RepeatingFilePasswordProvider realProvider = (RepeatingFilePasswordProvider) provider; -+ PasswordProviderWrapper realProvider = (PasswordProviderWrapper) provider; - // Read the stream now so that we can process the content several - // times. - List lines = IoUtils.readAllLines(inputStream); - Collection ids = null; - while (ids == null) { - try { -- ids = parser.loadKeyPairs(resourceKey, realProvider, lines); -- realProvider.handleDecodeAttemptResult(resourceKey, "", null); //$NON-NLS-1$ -+ ids = parser.loadKeyPairs(session, resourceKey, realProvider, -+ lines); -+ realProvider.handleDecodeAttemptResult(session, resourceKey, 0, -+ "", null); //$NON-NLS-1$ - // No exception; success. Exit the loop even if ids is still - // null! - break; - } catch (IOException | GeneralSecurityException - | RuntimeException e) { - ResourceDecodeResult loadResult = realProvider -- .handleDecodeAttemptResult(resourceKey, "", e); //$NON-NLS-1$ -+ .handleDecodeAttemptResult(session, resourceKey, 0, "", //$NON-NLS-1$ -+ e); - if (loadResult == null - || loadResult == ResourceDecodeResult.TERMINATE) { - throw e; -@@ -138,21 +142,6 @@ protected KeyPair doLoadKey(String resourceKey, InputStream inputStream, - throw new InvalidKeyException(format( - SshdText.get().identityFileUnsupportedFormat, resourceKey)); - } -- KeyPair result = keys.next(); -- if (keys.hasNext()) { -- log.warn(format(SshdText.get().identityFileMultipleKeys, -- resourceKey)); -- keys.forEachRemaining(k -> { -- PrivateKey pk = k.getPrivate(); -- if (pk != null) { -- try { -- pk.destroy(); -- } catch (DestroyFailedException e) { -- // Ignore -- } -- } -- }); -- } -- return result; -+ return ids; - } - } -diff --git a/org.eclipse.jgit.ssh.apache/src/org/eclipse/jgit/internal/transport/sshd/JGitClientSession.java b/org.eclipse.jgit.ssh.apache/src/org/eclipse/jgit/internal/transport/sshd/JGitClientSession.java -index 9b4694c..0a807b8 100644 ---- a/org.eclipse.jgit.ssh.apache/src/org/eclipse/jgit/internal/transport/sshd/JGitClientSession.java -+++ b/org.eclipse.jgit.ssh.apache/src/org/eclipse/jgit/internal/transport/sshd/JGitClientSession.java -@@ -175,7 +175,13 @@ protected IoWriteFuture sendIdentification(String ident) - throw new IOException(other.getLocalizedMessage(), other); - } - } else { -- return sendStartSsh(); -+ try { -+ return sendStartSsh(); -+ } catch (IOException e) { -+ throw e; -+ } catch (Exception other) { -+ throw new IOException(other.getLocalizedMessage(), other); -+ } - } - } - -@@ -184,10 +190,10 @@ protected IoWriteFuture sendIdentification(String ident) - * identification and the KEX init message. - * - * @return the client's KEX seed -- * @throws IOException -+ * @throws Exception - * if something goes wrong - */ -- private byte[] sendStartSsh() throws IOException { -+ private byte[] sendStartSsh() throws Exception { - super.sendIdentification(clientVersion); - return super.sendKexInit(); - } -diff --git a/org.eclipse.jgit.ssh.apache/src/org/eclipse/jgit/internal/transport/sshd/JGitPublicKeyIterator.java b/org.eclipse.jgit.ssh.apache/src/org/eclipse/jgit/internal/transport/sshd/JGitPublicKeyIterator.java -index cda1262..ee6e2bf 100644 ---- a/org.eclipse.jgit.ssh.apache/src/org/eclipse/jgit/internal/transport/sshd/JGitPublicKeyIterator.java -+++ b/org.eclipse.jgit.ssh.apache/src/org/eclipse/jgit/internal/transport/sshd/JGitPublicKeyIterator.java -@@ -44,6 +44,7 @@ - - import java.io.IOException; - import java.nio.channels.Channel; -+import java.security.GeneralSecurityException; - import java.security.KeyPair; - import java.security.PublicKey; - import java.util.ArrayList; -@@ -140,7 +141,7 @@ public JGitPublicKeyIterator(ClientSession session, - keys.add( - new KeyPairIdentityIterator(session.getRegisteredIdentities(), - session, signatureFactories)); -- keys.add(new KeyPairIdentityIterator(session.getKeyPairProvider(), -+ keys.add(new KeyPairIdentityIterator(session.getKeyIdentityProvider(), - session, signatureFactories)); - keyIter = keys.iterator(); - } -@@ -255,7 +256,17 @@ public KeyPairIdentityIterator(KeyIdentityProvider provider, - SignatureFactoriesManager signatureFactories) { - this.session = session; - this.signatureFactories = signatureFactories; -- keyPairs = provider == null ? null : provider.loadKeys().iterator(); -+ Iterator kps = null; -+ try { -+ if (provider != null) { -+ kps = provider.loadKeys(session).iterator(); -+ } -+ } catch (IOException | GeneralSecurityException e) { -+ // TODO Auto-generated catch block -+ e.printStackTrace(); -+ } finally { -+ keyPairs = kps; -+ } - } - - @Override -diff --git a/org.eclipse.jgit.ssh.apache/src/org/eclipse/jgit/internal/transport/sshd/JGitSshClient.java b/org.eclipse.jgit.ssh.apache/src/org/eclipse/jgit/internal/transport/sshd/JGitSshClient.java -index b9ff5e5..3e62ad6 100644 ---- a/org.eclipse.jgit.ssh.apache/src/org/eclipse/jgit/internal/transport/sshd/JGitSshClient.java -+++ b/org.eclipse.jgit.ssh.apache/src/org/eclipse/jgit/internal/transport/sshd/JGitSshClient.java -@@ -52,6 +52,7 @@ - import java.nio.file.InvalidPathException; - import java.nio.file.Path; - import java.nio.file.Paths; -+import java.security.GeneralSecurityException; - import java.security.KeyPair; - import java.util.Arrays; - import java.util.Iterator; -@@ -71,7 +72,8 @@ - import org.apache.sshd.common.io.IoConnectFuture; - import org.apache.sshd.common.io.IoSession; - import org.apache.sshd.common.keyprovider.AbstractResourceKeyPairProvider; --import org.apache.sshd.common.keyprovider.KeyPairProvider; -+import org.apache.sshd.common.keyprovider.KeyIdentityProvider; -+import org.apache.sshd.common.session.SessionContext; - import org.apache.sshd.common.session.helpers.AbstractSession; - import org.apache.sshd.common.util.ValidateUtils; - import org.eclipse.jgit.internal.transport.sshd.proxy.HttpClientConnector; -@@ -149,7 +151,7 @@ public ConnectFuture connect(HostConfigEntry hostConfig) - address = configureProxy(proxy, address); - proxy.clearPassword(); - } -- connector.connect(address).addListener(listener); -+ connector.connect(address, null, null).addListener(listener); - return connectFuture; - } - -@@ -244,8 +246,8 @@ private JGitClientSession createSession(IoSession ioSession, - session.getProperties().put(PASSWORD_PROMPTS, - Integer.valueOf(numberOfPasswordPrompts)); - FilePasswordProvider passwordProvider = getFilePasswordProvider(); -- if (passwordProvider instanceof RepeatingFilePasswordProvider) { -- ((RepeatingFilePasswordProvider) passwordProvider) -+ if (passwordProvider instanceof PasswordProviderWrapper) { -+ ((PasswordProviderWrapper) passwordProvider) - .setAttempts(numberOfPasswordPrompts); - } - List identities = hostConfig.getIdentities().stream() -@@ -263,16 +265,16 @@ private JGitClientSession createSession(IoSession ioSession, - identities, keyCache); - ourConfiguredKeysProvider.setPasswordFinder(passwordProvider); - if (hostConfig.isIdentitiesOnly()) { -- session.setKeyPairProvider(ourConfiguredKeysProvider); -+ session.setKeyIdentityProvider(ourConfiguredKeysProvider); - } else { -- KeyPairProvider defaultKeysProvider = getKeyPairProvider(); -+ KeyIdentityProvider defaultKeysProvider = getKeyIdentityProvider(); - if (defaultKeysProvider instanceof AbstractResourceKeyPairProvider) { - ((AbstractResourceKeyPairProvider) defaultKeysProvider) - .setPasswordFinder(passwordProvider); - } -- KeyPairProvider combinedProvider = new CombinedKeyPairProvider( -+ KeyIdentityProvider combinedProvider = new CombinedKeyPairProvider( - ourConfiguredKeysProvider, defaultKeysProvider); -- session.setKeyPairProvider(combinedProvider); -+ session.setKeyIdentityProvider(combinedProvider); - } - return session; - } -@@ -363,39 +365,29 @@ protected ClientSessionImpl doCreateSession(IoSession ioSession) - } - - /** -- * A {@link KeyPairProvider} that iterates over the {@link Iterable}s -- * returned by other {@link KeyPairProvider}s. -+ * A {@link KeyIdentityProvider} that iterates over the {@link Iterable}s -+ * returned by other {@link KeyIdentityProvider}s. - */ -- private static class CombinedKeyPairProvider implements KeyPairProvider { -+ private static class CombinedKeyPairProvider -+ implements KeyIdentityProvider { - -- private final List providers; -+ private final List providers; - -- public CombinedKeyPairProvider(KeyPairProvider... providers) { -+ public CombinedKeyPairProvider(KeyIdentityProvider... providers) { - this(Arrays.stream(providers).filter(Objects::nonNull) - .collect(Collectors.toList())); - } - -- public CombinedKeyPairProvider(List providers) { -+ public CombinedKeyPairProvider(List providers) { - this.providers = providers; - } - - @Override -- public Iterable getKeyTypes() { -- throw new UnsupportedOperationException( -- "Should not have been called in a ssh client"); //$NON-NLS-1$ -- } -- -- @Override -- public KeyPair loadKey(String type) { -- throw new UnsupportedOperationException( -- "Should not have been called in a ssh client"); //$NON-NLS-1$ -- } -- -- @Override -- public Iterable loadKeys() { -+ public Iterable loadKeys(SessionContext session) { - return () -> new Iterator() { - -- private Iterator factories = providers.iterator(); -+ private Iterator factories = providers -+ .iterator(); - private Iterator current; - - private Boolean hasElement; -@@ -407,7 +399,13 @@ public boolean hasNext() { - } - while (current == null || !current.hasNext()) { - if (factories.hasNext()) { -- current = factories.next().loadKeys().iterator(); -+ try { -+ current = factories.next().loadKeys(session) -+ .iterator(); -+ } catch (IOException | GeneralSecurityException e) { -+ // TODO Auto-generated catch block -+ e.printStackTrace(); -+ } - } else { - current = null; - hasElement = Boolean.FALSE; -diff --git a/org.eclipse.jgit.ssh.apache/src/org/eclipse/jgit/internal/transport/sshd/JGitSshConfig.java b/org.eclipse.jgit.ssh.apache/src/org/eclipse/jgit/internal/transport/sshd/JGitSshConfig.java -index 9846439..a8407d5 100644 ---- a/org.eclipse.jgit.ssh.apache/src/org/eclipse/jgit/internal/transport/sshd/JGitSshConfig.java -+++ b/org.eclipse.jgit.ssh.apache/src/org/eclipse/jgit/internal/transport/sshd/JGitSshConfig.java -@@ -47,11 +47,13 @@ - - import java.io.File; - import java.io.IOException; -+import java.net.SocketAddress; - import java.util.Map; - import java.util.TreeMap; - - import org.apache.sshd.client.config.hosts.HostConfigEntry; - import org.apache.sshd.client.config.hosts.HostConfigEntryResolver; -+import org.apache.sshd.common.AttributeRepository; - import org.apache.sshd.common.util.net.SshdSocketAddress; - import org.eclipse.jgit.annotations.NonNull; - import org.eclipse.jgit.internal.transport.ssh.OpenSshConfigFile; -@@ -101,7 +103,8 @@ public JGitSshConfig(@NonNull File home, @NonNull File config, - - @Override - public HostConfigEntry resolveEffectiveHost(String host, int port, -- String username) throws IOException { -+ SocketAddress localAddress, String username, -+ AttributeRepository context) throws IOException { - HostEntry entry = configFile.lookup(host, port, username); - JGitHostConfigEntry config = new JGitHostConfigEntry(); - // Apache MINA conflates all keys, even multi-valued ones, in one map -diff --git a/org.eclipse.jgit.ssh.apache/src/org/eclipse/jgit/internal/transport/sshd/OpenSshServerKeyVerifier.java b/org.eclipse.jgit.ssh.apache/src/org/eclipse/jgit/internal/transport/sshd/OpenSshServerKeyVerifier.java -index 7d8f3fd..1da1c38 100644 ---- a/org.eclipse.jgit.ssh.apache/src/org/eclipse/jgit/internal/transport/sshd/OpenSshServerKeyVerifier.java -+++ b/org.eclipse.jgit.ssh.apache/src/org/eclipse/jgit/internal/transport/sshd/OpenSshServerKeyVerifier.java -@@ -673,7 +673,7 @@ public HostKeyFile(Path path) { - continue; - } - try { -- PublicKey serverKey = keyPart.resolvePublicKey( -+ PublicKey serverKey = keyPart.resolvePublicKey(null, - PublicKeyEntryResolver.IGNORING); - if (serverKey == null) { - LOG.warn(format( -diff --git a/org.eclipse.jgit.ssh.apache/src/org/eclipse/jgit/internal/transport/sshd/PasswordProviderWrapper.java b/org.eclipse.jgit.ssh.apache/src/org/eclipse/jgit/internal/transport/sshd/PasswordProviderWrapper.java -index 93bd102..b897321 100644 ---- a/org.eclipse.jgit.ssh.apache/src/org/eclipse/jgit/internal/transport/sshd/PasswordProviderWrapper.java -+++ b/org.eclipse.jgit.ssh.apache/src/org/eclipse/jgit/internal/transport/sshd/PasswordProviderWrapper.java -@@ -46,25 +46,23 @@ - import java.net.URISyntaxException; - import java.security.GeneralSecurityException; - import java.util.Arrays; --import java.util.Map; --import java.util.concurrent.ConcurrentHashMap; --import java.util.concurrent.atomic.AtomicInteger; - -+import org.apache.sshd.common.NamedResource; -+import org.apache.sshd.common.config.keys.FilePasswordProvider; -+import org.apache.sshd.common.session.SessionContext; - import org.eclipse.jgit.annotations.NonNull; - import org.eclipse.jgit.transport.CredentialsProvider; - import org.eclipse.jgit.transport.URIish; - import org.eclipse.jgit.transport.sshd.KeyPasswordProvider; - - /** -- * A bridge from sshd's {@link RepeatingFilePasswordProvider} to our -+ * A bridge from sshd's {@link FilePasswordProvider} to our - * {@link KeyPasswordProvider} API. - */ --public class PasswordProviderWrapper implements RepeatingFilePasswordProvider { -+public class PasswordProviderWrapper implements FilePasswordProvider { - - private final KeyPasswordProvider delegate; - -- private Map counts = new ConcurrentHashMap<>(); -- - /** - * @param delegate - */ -@@ -72,21 +70,25 @@ public PasswordProviderWrapper(@NonNull KeyPasswordProvider delegate) { - this.delegate = delegate; - } - -- @Override -+ /** -+ * @param numberOfPasswordPrompts -+ */ - public void setAttempts(int numberOfPasswordPrompts) { - delegate.setAttempts(numberOfPasswordPrompts); - } - -- @Override -+ /** -+ * @return number of attempts -+ */ - public int getAttempts() { - return delegate.getAttempts(); - } - - @Override -- public String getPassword(String resourceKey) throws IOException { -- int attempt = counts -- .computeIfAbsent(resourceKey, k -> new AtomicInteger()).get(); -- char[] passphrase = delegate.getPassphrase(toUri(resourceKey), attempt); -+ public String getPassword(SessionContext session, NamedResource resourceKey, -+ int retryIndex) throws IOException { -+ char[] passphrase = delegate.getPassphrase(toUri(resourceKey.getName()), -+ retryIndex); - if (passphrase == null) { - return null; - } -@@ -98,23 +100,17 @@ public String getPassword(String resourceKey) throws IOException { - } - - @Override -- public ResourceDecodeResult handleDecodeAttemptResult(String resourceKey, -+ public ResourceDecodeResult handleDecodeAttemptResult( -+ SessionContext session, NamedResource resourceKey, int retryIndex, - String password, Exception err) - throws IOException, GeneralSecurityException { -- AtomicInteger count = counts.get(resourceKey); -- int numberOfAttempts = count == null ? 0 : count.incrementAndGet(); - ResourceDecodeResult result = null; -- try { -- if (delegate.keyLoaded(toUri(resourceKey), numberOfAttempts, err)) { -+ if (delegate.keyLoaded(toUri(resourceKey.getName()), retryIndex, -+ err)) { - result = ResourceDecodeResult.RETRY; - } else { - result = ResourceDecodeResult.TERMINATE; - } -- } finally { -- if (result != ResourceDecodeResult.RETRY) { -- counts.remove(resourceKey); -- } -- } - return result; - } - -diff --git a/org.eclipse.jgit.ssh.apache/src/org/eclipse/jgit/internal/transport/sshd/RepeatingFilePasswordProvider.java b/org.eclipse.jgit.ssh.apache/src/org/eclipse/jgit/internal/transport/sshd/RepeatingFilePasswordProvider.java -deleted file mode 100644 -index e491cae..0000000 ---- a/org.eclipse.jgit.ssh.apache/src/org/eclipse/jgit/internal/transport/sshd/RepeatingFilePasswordProvider.java -+++ /dev/null -@@ -1,115 +0,0 @@ --/* -- * Copyright (C) 2018, Thomas Wolf -- * and other copyright owners as documented in the project's IP log. -- * -- * This program and the accompanying materials are made available -- * under the terms of the Eclipse Distribution License v1.0 which -- * accompanies this distribution, is reproduced below, and is -- * available at http://www.eclipse.org/org/documents/edl-v10.php -- * -- * All rights reserved. -- * -- * Redistribution and use in source and binary forms, with or -- * without modification, are permitted provided that the following -- * conditions are met: -- * -- * - Redistributions of source code must retain the above copyright -- * notice, this list of conditions and the following disclaimer. -- * -- * - Redistributions in binary form must reproduce the above -- * copyright notice, this list of conditions and the following -- * disclaimer in the documentation and/or other materials provided -- * with the distribution. -- * -- * - Neither the name of the Eclipse Foundation, Inc. nor the -- * names of its contributors may be used to endorse or promote -- * products derived from this software without specific prior -- * written permission. -- * -- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND -- * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, -- * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES -- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -- * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR -- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT -- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -- * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, -- * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) -- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF -- * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -- */ --package org.eclipse.jgit.internal.transport.sshd; -- --import java.io.IOException; --import java.security.GeneralSecurityException; -- --import org.apache.sshd.common.config.keys.FilePasswordProvider; -- --/** -- * A {@link FilePasswordProvider} augmented to support repeatedly asking for -- * passwords. -- * -- */ --public interface RepeatingFilePasswordProvider extends FilePasswordProvider { -- -- /** -- * Define the maximum number of attempts to get a password that should be -- * attempted for one identity resource through this provider. -- * -- * @param numberOfPasswordPrompts -- * number of times to ask for a password; -- * {@link IllegalArgumentException} may be thrown if <= 0 -- */ -- void setAttempts(int numberOfPasswordPrompts); -- -- /** -- * Gets the maximum number of attempts to get a password that should be -- * attempted for one identity resource through this provider. -- * -- * @return the maximum number of attempts to try, always >= 1. -- */ -- default int getAttempts() { -- return 1; -- } -- -- // The following part of this interface is from the upstream resolution of -- // SSHD-850. See https://github.com/apache/mina-sshd/commit/f19bd2e34 . -- // TODO: remove this once we move to sshd > 2.1.0 -- -- /** -- * Result value of -- * {@link RepeatingFilePasswordProvider#handleDecodeAttemptResult(String, String, Exception)}. -- */ -- public enum ResourceDecodeResult { -- /** Re-throw the decoding exception. */ -- TERMINATE, -- /** Retry the decoding process - including password prompt. */ -- RETRY, -- /** Skip attempt and see if we can proceed without the key. */ -- IGNORE; -- } -- -- /** -- * Invoked to inform the password provider about the decoding result. -- * Note: any exception thrown from this method (including if called -- * to inform about success) will be propagated instead of the original (if -- * any was reported) -- * -- * @param resourceKey -- * The resource key representing the private file -- * @param password -- * The password that was attempted -- * @param err -- * The attempt result - {@code null} for success -- * @return How to proceed in case of error - ignored if invoked in -- * order to report success. Note: {@code null} is same as -- * {@link ResourceDecodeResult#TERMINATE}. -- * @throws IOException -- * @throws GeneralSecurityException -- */ -- ResourceDecodeResult handleDecodeAttemptResult(String resourceKey, -- String password, Exception err) -- throws IOException, GeneralSecurityException; --} -diff --git a/org.eclipse.jgit.ssh.apache/src/org/eclipse/jgit/transport/sshd/SshdSessionFactory.java b/org.eclipse.jgit.ssh.apache/src/org/eclipse/jgit/transport/sshd/SshdSessionFactory.java -index cdd47bf..1968e79 100644 ---- a/org.eclipse.jgit.ssh.apache/src/org/eclipse/jgit/transport/sshd/SshdSessionFactory.java -+++ b/org.eclipse.jgit.ssh.apache/src/org/eclipse/jgit/transport/sshd/SshdSessionFactory.java -@@ -69,7 +69,7 @@ - import org.apache.sshd.common.NamedFactory; - import org.apache.sshd.common.compression.BuiltinCompressions; - import org.apache.sshd.common.config.keys.FilePasswordProvider; --import org.apache.sshd.common.keyprovider.KeyPairProvider; -+import org.apache.sshd.common.keyprovider.KeyIdentityProvider; - import org.eclipse.jgit.annotations.NonNull; - import org.eclipse.jgit.errors.TransportException; - import org.eclipse.jgit.internal.transport.sshd.CachingKeyPairProvider; -@@ -211,7 +211,7 @@ public SshdSession getSession(URIish uri, - } - HostConfigEntryResolver configFile = getHostConfigEntryResolver( - home, sshDir); -- KeyPairProvider defaultKeysProvider = toKeyPairProvider( -+ KeyIdentityProvider defaultKeysProvider = toKeyIdentityProvider( - getDefaultKeys(sshDir)); - KeyPasswordProvider passphrases = createKeyPasswordProvider( - credentialsProvider); -@@ -227,7 +227,7 @@ public SshdSession getSession(URIish uri, - client.setUserInteraction( - new JGitUserInteraction(credentialsProvider)); - client.setUserAuthFactories(getUserAuthFactories()); -- client.setKeyPairProvider(defaultKeysProvider); -+ client.setKeyIdentityProvider(defaultKeysProvider); - // JGit-specific things: - JGitSshClient jgitClient = (JGitSshClient) client; - jgitClient.setKeyCache(getKeyCache()); -@@ -438,17 +438,18 @@ private ServerKeyVerifier getServerKeyVerifier(@NonNull File homeDir, - - /** - * Converts an {@link Iterable} of {link KeyPair}s into a -- * {@link KeyPairProvider}. -+ * {@link KeyIdentityProvider}. - * - * @param keys -- * to provide via the returned {@link KeyPairProvider} -- * @return a {@link KeyPairProvider} that provides the given {@code keys} -+ * to provide via the returned {@link KeyIdentityProvider} -+ * @return a {@link KeyIdentityProvider} that provides the given -+ * {@code keys} - */ -- private KeyPairProvider toKeyPairProvider(Iterable keys) { -- if (keys instanceof KeyPairProvider) { -- return (KeyPairProvider) keys; -+ private KeyIdentityProvider toKeyIdentityProvider(Iterable keys) { -+ if (keys instanceof KeyIdentityProvider) { -+ return (KeyIdentityProvider) keys; - } -- return () -> keys; -+ return (session) -> keys; - } - - /** -diff --git a/pom.xml b/pom.xml -index cc90a7e..f2bf35d 100644 ---- a/pom.xml -+++ b/pom.xml -@@ -183,7 +183,7 @@ - ${project.build.directory}/META-INF/MANIFEST.MF - - 5.2.0.201812061821-r -- 2.0.0 -+ 2.2.0 - 0.1.54 - 1.1.1 - 1.1.6 --- -2.20.1 - diff --git a/0003-Port-to-bouncycastle-1.61-API.patch b/0003-Port-to-bouncycastle-1.61-API.patch new file mode 100644 index 0000000..4dbdd15 --- /dev/null +++ b/0003-Port-to-bouncycastle-1.61-API.patch @@ -0,0 +1,33 @@ +From 1efe1200c6694836fce298665dda538abab1f226 Mon Sep 17 00:00:00 2001 +From: Mat Booth +Date: Tue, 12 Mar 2019 18:44:51 +0000 +Subject: [PATCH 3/3] Port to bouncycastle 1.61 API + +--- + .../eclipse/jgit/lib/internal/BouncyCastleGpgKeyLocator.java | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/lib/internal/BouncyCastleGpgKeyLocator.java b/org.eclipse.jgit/src/org/eclipse/jgit/lib/internal/BouncyCastleGpgKeyLocator.java +index df9615f..3099d8c 100644 +--- a/org.eclipse.jgit/src/org/eclipse/jgit/lib/internal/BouncyCastleGpgKeyLocator.java ++++ b/org.eclipse.jgit/src/org/eclipse/jgit/lib/internal/BouncyCastleGpgKeyLocator.java +@@ -67,6 +67,7 @@ + import org.bouncycastle.gpg.keybox.KeyInformation; + import org.bouncycastle.gpg.keybox.PublicKeyRingBlob; + import org.bouncycastle.gpg.keybox.UserID; ++import org.bouncycastle.gpg.keybox.bc.BcBlobVerifier; + import org.bouncycastle.openpgp.PGPException; + import org.bouncycastle.openpgp.PGPPublicKey; + import org.bouncycastle.openpgp.PGPSecretKey; +@@ -383,7 +384,7 @@ private KeyBox readKeyBoxFile(Path keyboxFile) throws IOException { + // note: KeyBox constructor reads in the whole InputStream at once + // this code will change in 1.61 to + // either 'new BcKeyBox(in)' or 'new JcaKeyBoxBuilder().build(in)' +- keyBox = new KeyBox(in, new JcaKeyFingerprintCalculator()); ++ keyBox = new KeyBox(in, new JcaKeyFingerprintCalculator(), new BcBlobVerifier()); + } + return keyBox; + } +-- +2.20.1 + diff --git a/0005-Port-to-bouncycastle-1.61-API.patch b/0005-Port-to-bouncycastle-1.61-API.patch deleted file mode 100644 index 94bce74..0000000 --- a/0005-Port-to-bouncycastle-1.61-API.patch +++ /dev/null @@ -1,33 +0,0 @@ -From 766bec2148dff7aac4b3f03d06072c4789bbcd0e Mon Sep 17 00:00:00 2001 -From: Mat Booth -Date: Tue, 12 Mar 2019 18:44:51 +0000 -Subject: [PATCH 5/5] Port to bouncycastle 1.61 API - ---- - .../eclipse/jgit/lib/internal/BouncyCastleGpgKeyLocator.java | 3 ++- - 1 file changed, 2 insertions(+), 1 deletion(-) - -diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/lib/internal/BouncyCastleGpgKeyLocator.java b/org.eclipse.jgit/src/org/eclipse/jgit/lib/internal/BouncyCastleGpgKeyLocator.java -index 091667d..8f74827 100644 ---- a/org.eclipse.jgit/src/org/eclipse/jgit/lib/internal/BouncyCastleGpgKeyLocator.java -+++ b/org.eclipse.jgit/src/org/eclipse/jgit/lib/internal/BouncyCastleGpgKeyLocator.java -@@ -67,6 +67,7 @@ - import org.bouncycastle.gpg.keybox.KeyInformation; - import org.bouncycastle.gpg.keybox.PublicKeyRingBlob; - import org.bouncycastle.gpg.keybox.UserID; -+import org.bouncycastle.gpg.keybox.bc.BcBlobVerifier; - import org.bouncycastle.openpgp.PGPException; - import org.bouncycastle.openpgp.PGPPublicKey; - import org.bouncycastle.openpgp.PGPSecretKey; -@@ -366,7 +367,7 @@ private KeyBox readKeyBoxFile(Path keyboxFile) throws IOException { - // note: KeyBox constructor reads in the whole InputStream at once - // this code will change in 1.61 to - // either 'new BcKeyBox(in)' or 'new JcaKeyBoxBuilder().build(in)' -- keyBox = new KeyBox(in, new JcaKeyFingerprintCalculator()); -+ keyBox = new KeyBox(in, new JcaKeyFingerprintCalculator(), new BcBlobVerifier()); - } - return keyBox; - } --- -2.20.1 - diff --git a/eclipse-jgit.spec b/eclipse-jgit.spec index fd39177..b58bb08 100644 --- a/eclipse-jgit.spec +++ b/eclipse-jgit.spec @@ -1,4 +1,4 @@ -%global gittag 5.3.0.201903130848-r +%global gittag 5.4.0.201905221418-m3 # Due to circular self-dependency, one build must be done with this flag set # when updating to new versions. A second build without this flag ensures that @@ -9,8 +9,8 @@ %bcond_without jgit_eclipse_features Name: eclipse-jgit -Version: 5.3.0 -Release: 6%{?dist} +Version: 5.4.0 +Release: 0.1%{?dist} Summary: Eclipse JGit License: BSD @@ -25,7 +25,7 @@ Patch0: 0001-Ensure-the-correct-classpath-is-set-for-the-jgit-com.patch # org.slf4j.impl.log4j12 -> slf4j.simple Patch1: 0002-Don-t-embed-versions-of-third-party-libs-use-feature.patch # Changes necessary for the latest version of bouncycastle -Patch2: 0005-Port-to-bouncycastle-1.61-API.patch +Patch2: 0003-Port-to-bouncycastle-1.61-API.patch BuildArch: noarch @@ -49,16 +49,14 @@ BuildRequires: mvn(org.apache.httpcomponents:httpcore) BuildRequires: mvn(org.apache.maven.plugins:maven-antrun-plugin) BuildRequires: mvn(org.apache.maven.plugins:maven-clean-plugin) BuildRequires: mvn(org.apache.maven.plugins:maven-install-plugin) -BuildRequires: mvn(org.apache.maven.plugins:maven-shade-plugin) BuildRequires: mvn(org.apache.maven.plugins:maven-source-plugin) -BuildRequires: mvn(org.apache.sshd:sshd-core) -BuildRequires: mvn(org.apache.sshd:sshd-sftp) +BuildRequires: mvn(org.apache.sshd:sshd-osgi) >= 2.2.0 +BuildRequires: mvn(org.apache.sshd:sshd-sftp) >= 2.2.0 BuildRequires: mvn(org.bouncycastle:bcpg-jdk15on) >= 1.61 BuildRequires: mvn(org.bouncycastle:bcpkix-jdk15on) >= 1.61 BuildRequires: mvn(org.bouncycastle:bcprov-jdk15on) >= 1.61 BuildRequires: mvn(org.codehaus.mojo:build-helper-maven-plugin) BuildRequires: mvn(org.eclipse.jetty:jetty-servlet) -BuildRequires: mvn(org.hamcrest:hamcrest-library) BuildRequires: mvn(org.mockito:mockito-core) BuildRequires: mvn(org.osgi:osgi.core) BuildRequires: mvn(org.slf4j:slf4j-api) @@ -68,15 +66,17 @@ BuildRequires: mvn(org.tukaani:xz) # Needed for test suites BuildRequires: git -%if %{without bootstrap} && %{with jgit_eclipse_features} +%if %{without bootstrap} || %{with jgit_eclipse_features} # For building the eclipse features BuildRequires: tycho -BuildRequires: jgit = %{version} - Requires: eclipse-platform -Requires: jgit = %{version}-%{release} Requires: jzlib Requires: bouncycastle >= 1.61 +Requires: apache-sshd >= 1:2.2.0 +%if %{without bootstrap} +BuildRequires: jgit = %{version} +Requires: jgit = %{version}-%{release} +%endif %endif %description @@ -122,8 +122,6 @@ done # Don't build source features %pom_disable_module org.eclipse.jgit.source.feature org.eclipse.jgit.packaging -%pom_disable_module org.eclipse.jgit.ssh.apache.source.feature org.eclipse.jgit.packaging -%pom_disable_module org.eclipse.jgit.pgm.source.feature org.eclipse.jgit.packaging # Use newer Felix dep %pom_change_dep -r org.osgi:org.osgi.core org.osgi:osgi.core @@ -160,12 +158,11 @@ popd # manifest-first builds in the same reactor build hence two separate invocations # First invocation installs jgit so the second invocation will succeed -# One test always fails "RacyGitTests.testRacyGitDetection" so ignore failures for now %mvn_build -f --post install:install -- -Pjavac \ -Dmaven.repo.local=$(pwd)/org.eclipse.jgit.packaging/.m2 -Dmaven.test.failure.ignore=true # Second invocation builds the eclipse features -%if %{without bootstrap} && %{with jgit_eclipse_features} +%if %{without bootstrap} || %{with jgit_eclipse_features} pushd org.eclipse.jgit.packaging %mvn_build -j -- -Dfedora.p2.repos=$(pwd)/.m2 popd @@ -179,7 +176,7 @@ install -dm755 %{buildroot}%{_javadocdir}/jgit cp -pr .xmvn/apidocs/* %{buildroot}%{_javadocdir}/jgit echo '%{_javadocdir}/jgit' >>.mfiles-javadoc -%if %{without bootstrap} && %{with jgit_eclipse_features} +%if %{without bootstrap} || %{with jgit_eclipse_features} pushd org.eclipse.jgit.packaging %mvn_install popd @@ -192,7 +189,7 @@ install -m 755 org.eclipse.jgit.pgm/jgit.sh %{buildroot}%{_bindir}/jgit # Ant task configuration install -dm 755 %{buildroot}%{_sysconfdir}/ant.d cat > %{buildroot}%{_sysconfdir}/ant.d/jgit < - 5.4.0-0.1 +- Update to latest milestone release + * Fri Apr 19 2019 Mat Booth - 5.3.0-6 - Allowing conditional build of eclipse features without being in 'bootstrap' mode diff --git a/sources b/sources index c372bbd..4e815c0 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -SHA512 (jgit-5.3.0.201903130848-r.tar.xz) = da7cb1c8b6da587e4b3c12519ddc43aea286b03a568bb27824f7d01c3cdda8b7e27fc7b6eae7d048fc0b8f8fd38875a920fa3ebd4a49601e8de935e1efe57324 +SHA512 (jgit-5.4.0.201905221418-m3.tar.xz) = c58f90abfd0a46c7c7036630db3c0624ae3190cef87910117179a89a2d3e1a8aa983e15c25fae75fddf6ad616ea9387676131890d90c05e026b454ecb47783f6