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