2024-10-17 09:28:57 +00:00
committed by Git OBS Bridge
parent 63439894f7
commit 0182ea1cc6
4 changed files with 71 additions and 113 deletions

View File

@@ -1,105 +0,0 @@
From accd3e006a05615cf6eed9369d91fbedcc4eab16 Mon Sep 17 00:00:00 2001
From: Mat Booth <mat.booth@redhat.com>
Date: Thu, 7 Mar 2019 11:27:55 +0000
Subject: [PATCH] Avoid optional dependency on native tomcat APR library
---
pom.xml | 5 -----
sshd-core/pom.xml | 6 ------
.../sshd/agent/local/ProxyAgentFactory.java | 16 +---------------
sshd-osgi/pom.xml | 6 ------
4 files changed, 1 insertion(+), 32 deletions(-)
diff --git a/pom.xml b/pom.xml
index 867ca88..7c29678 100644
--- a/pom.xml
+++ b/pom.xml
@@ -434,11 +434,6 @@
<artifactId>mina-core</artifactId>
<version>2.0.23</version>
</dependency>
- <dependency>
- <groupId>tomcat</groupId>
- <artifactId>tomcat-apr</artifactId>
- <version>5.5.23</version>
- </dependency>
<dependency>
<groupId>net.i2p.crypto</groupId>
diff --git a/sshd-core/pom.xml b/sshd-core/pom.xml
index 6171c5c..73a43a7 100644
--- a/sshd-core/pom.xml
+++ b/sshd-core/pom.xml
@@ -43,12 +43,6 @@
</dependency>
<dependency>
- <groupId>tomcat</groupId>
- <artifactId>tomcat-apr</artifactId>
- <optional>true</optional>
- </dependency>
-
- <dependency>
<groupId>org.bouncycastle</groupId>
<artifactId>bcpg-jdk18on</artifactId>
<optional>true</optional>
diff --git a/sshd-core/src/main/java/org/apache/sshd/agent/local/ProxyAgentFactory.java b/sshd-core/src/main/java/org/apache/sshd/agent/local/ProxyAgentFactory.java
index ab19539..5757e68 100644
--- a/sshd-core/src/main/java/org/apache/sshd/agent/local/ProxyAgentFactory.java
+++ b/sshd-core/src/main/java/org/apache/sshd/agent/local/ProxyAgentFactory.java
@@ -27,8 +27,6 @@ import java.util.concurrent.atomic.AtomicBoolean;
import org.apache.sshd.agent.SshAgent;
import org.apache.sshd.agent.SshAgentFactory;
import org.apache.sshd.agent.SshAgentServer;
-import org.apache.sshd.agent.unix.AprLibrary;
-import org.apache.sshd.agent.unix.UnixAgentFactory;
import org.apache.sshd.common.FactoryManager;
import org.apache.sshd.common.PropertyResolver;
import org.apache.sshd.common.channel.ChannelFactory;
@@ -51,9 +49,7 @@ public class ProxyAgentFactory implements SshAgentFactory {
@Override
public List<ChannelFactory> getChannelForwardingFactories(FactoryManager manager) {
- return isPreferredUnixAgent(manager)
- ? UnixAgentFactory.DEFAULT_FORWARDING_CHANNELS
- : LocalAgentFactory.DEFAULT_FORWARDING_CHANNELS;
+ return LocalAgentFactory.DEFAULT_FORWARDING_CHANNELS;
}
@Override
@@ -104,16 +100,6 @@ public class ProxyAgentFactory implements SshAgentFactory {
}
public static boolean isPreferredUnixAgent(PropertyResolver resolver) {
- if (CoreModuleProperties.PREFER_UNIX_AGENT.getRequired(resolver)) {
- try {
- if (AprLibrary.getInstance() != null) {
- return true;
- }
- } catch (Exception ignore) {
- // ignored
- }
- }
-
return false;
}
}
diff --git a/sshd-osgi/pom.xml b/sshd-osgi/pom.xml
index 5395ceb..f456263 100644
--- a/sshd-osgi/pom.xml
+++ b/sshd-osgi/pom.xml
@@ -81,12 +81,6 @@
<optional>true</optional>
<scope>provided</scope>
</dependency>
- <dependency>
- <groupId>tomcat</groupId>
- <artifactId>tomcat-apr</artifactId>
- <optional>true</optional>
- <scope>provided</scope>
- </dependency>
</dependencies>
<build>
--
2.20.1

View File

@@ -32,9 +32,9 @@ License: Apache-2.0 AND ISC
Group: Development/Libraries/Java
URL: https://mina.apache.org/sshd-project
Source0: https://archive.apache.org/dist/mina/sshd/%{version}/apache-sshd-%{version}-src.tar.gz
# Avoid optional dep on tomcat native APR library
Patch0: 0001-Avoid-optional-dependency-on-native-tomcat-APR-libra.patch
Patch1: apache-sshd-javadoc.patch
Patch0: apache-sshd-javadoc.patch
Patch1: file-name-mapping.patch
Patch2: password-no-echo.patch
BuildRequires: fdupes
BuildRequires: maven-local
BuildRequires: mvn(junit:junit)
@@ -43,6 +43,7 @@ BuildRequires: mvn(org.apache.felix:maven-bundle-plugin)
BuildRequires: mvn(org.apache.maven.plugins:maven-remote-resources-plugin)
BuildRequires: mvn(org.apache.maven.surefire:surefire-junit47)
BuildRequires: mvn(org.apache.maven:maven-archiver)
BuildRequires: mvn(org.apache.tomcat:tomcat-jni)
BuildRequires: mvn(org.apache:apache-jar-resource-bundle)
BuildRequires: mvn(org.apache:apache:pom:) >= 30
BuildRequires: mvn(org.bouncycastle:bcpg-jdk18on)
@@ -64,6 +65,7 @@ BuildRequires: mvn(org.apache.sshd:sshd-sftp) = %{version}
BuildRequires: mvn(org.assertj:assertj-core)
BuildRequires: mvn(org.bouncycastle:bcprov-jdk18on)
BuildRequires: mvn(org.bouncycastle:bcutil-jdk18on)
BuildRequires: mvn(org.c02e.jpgpj:jpgpj)
BuildRequires: mvn(org.codehaus.plexus:plexus-archiver)
BuildRequires: mvn(org.eclipse.jgit:org.eclipse.jgit)
BuildRequires: mvn(org.eclipse.jgit:org.eclipse.jgit.pgm)
@@ -95,10 +97,12 @@ Requires: javaewah
Requires: jcl-over-slf4j
Requires: jctools
Requires: jgit
Requires: jpgpj
Requires: netty
Requires: objectweb-asm
Requires: slf4j
Requires: slf4j-jdk14
Requires: tomcat-lib
%description -n apache-sshd-standalone
This package provides standalone installation of apache-sshd
@@ -113,12 +117,11 @@ This package provides %{name}.
%prep
%setup -q -n apache-sshd-%{version}
# Avoid optional dep on tomcat native APR library
%patch -P 0 -p1
%patch -P 1 -p1
%patch -P 2 -p1
rm -rf sshd-core/src/main/java/org/apache/sshd/agent/unix
%pom_remove_dep -r tomcat:tomcat-apr
%pom_change_dep -r tomcat:tomcat-apr org.apache.tomcat:tomcat-jni
# Avoid unnecessary dep on spring framework
%pom_remove_dep :spring-framework-bom
@@ -129,8 +132,6 @@ rm -rf sshd-core/src/main/java/org/apache/sshd/agent/unix
%pom_remove_dep -r org.apache.sshd:sshd-mina
%pom_disable_module sshd-spring-sftp
%pom_remove_dep -r org.apache.sshd:sshd-spring-sftp
%pom_disable_module sshd-openpgp
%pom_remove_dep -r org.apache.sshd:sshd-openpgp
# don't require bom that we don't package
%pom_remove_dep org.testcontainers:testcontainers-bom sshd-scp
%pom_remove_dep :netty-bom sshd-netty
@@ -148,6 +149,7 @@ rm -rf sshd-core/src/main/java/org/apache/sshd/agent/unix
%pom_disable_module sshd-git
%pom_disable_module sshd-contrib
%pom_disable_module sshd-cli
%pom_disable_module sshd-openpgp
%pom_disable_module assembly
%endif
@@ -174,6 +176,7 @@ rm -rf sshd-core/src/main/java/org/apache/sshd/agent/unix
%{mvn_file} :{*} apache-sshd/@1
%{mvn_package} :sshd __noinstall
%{mvn_package} :apache-sshd __noinstall
%build

27
file-name-mapping.patch Normal file
View File

@@ -0,0 +1,27 @@
--- apache-sshd-2.12.0/assembly/src/main/components/modules.xml 2024-10-17 09:52:06.438341043 +0200
+++ apache-sshd-2.12.0/assembly/src/main/components/modules.xml 2024-10-17 10:04:38.853297583 +0200
@@ -39,6 +39,7 @@
</excludes>
<outputDirectory>lib</outputDirectory>
<useProjectArtifact>false</useProjectArtifact>
+ <outputFileNameMapping>${artifact.groupId}-${artifact.artifactId}${dashClassifier?}.${artifact.extension}</outputFileNameMapping>
</dependencySet>
<dependencySet>
<includes>
@@ -52,6 +53,7 @@
</includes>
<outputDirectory>extras</outputDirectory>
<useProjectArtifact>false</useProjectArtifact>
+ <outputFileNameMapping>${artifact.groupId}-${artifact.artifactId}${dashClassifier?}.${artifact.extension}</outputFileNameMapping>
</dependencySet>
<dependencySet>
<includes>
@@ -68,6 +70,7 @@
</includes>
<outputDirectory>dependencies</outputDirectory>
<useProjectArtifact>false</useProjectArtifact>
+ <outputFileNameMapping>${artifact.groupId}-${artifact.artifactId}${dashClassifier?}.${artifact.extension}</outputFileNameMapping>
</dependencySet>
</dependencySets>
</component>
\ No newline at end of file

33
password-no-echo.patch Normal file
View File

@@ -0,0 +1,33 @@
--- apache-sshd-2.12.0/sshd-cli/src/main/java/org/apache/sshd/cli/client/SshClientCliSupport.java 2024-10-17 09:52:06.441674383 +0200
+++ apache-sshd-2.12.0/sshd-cli/src/main/java/org/apache/sshd/cli/client/SshClientCliSupport.java 2024-10-17 11:13:10.836164379 +0200
@@ -19,6 +19,7 @@
package org.apache.sshd.cli.client;
import java.io.BufferedReader;
+import java.io.Console;
import java.io.IOException;
import java.io.OutputStream;
import java.io.PrintStream;
@@ -492,6 +493,11 @@
throws Throwable {
client.setFilePasswordProvider((session, file, index) -> {
stdout.print("Enter password for private key file=" + file + ": ");
+
+ Console cons = System.console();
+ if (cons != null) {
+ return new String(cons.readPassword());
+ }
return stdin.readLine();
});
@@ -552,6 +558,10 @@
public String getUpdatedPassword(ClientSession clientSession, String prompt, String lang) {
stdout.append(prompt).print(" ");
try {
+ Console cons = System.console();
+ if (cons != null) {
+ return new String(cons.readPassword());
+ }
return stdin.readLine();
} catch (IOException e) {
stderr.append("WARNING: ").append(e.getClass().getSimpleName())