From ee26bdc3f42497ec4246afecbb19a8baec2d932c Mon Sep 17 00:00:00 2001 From: Guillaume Nodet Date: Tue, 23 Jul 2024 18:30:26 +0200 Subject: [PATCH] Upgrade parent to apache:43, require JDK 11 at build time and upgrade a few plugins (fixes #536) --- .github/workflows/build.yml | 6 +- .github/workflows/master-build.yml | 2 +- .mvn/maven.config | 2 + pom.xml | 194 +++--------------- .../sshd/common/file/util/BaseFileSystem.java | 2 +- .../apache/sshd/common/util/io/IoUtils.java | 4 +- .../ExposedBufferByteArrayOutputStream.java | 2 +- .../client/channel/ClientChannelEvent.java | 6 +- .../common/channel/ChannelOutputStream.java | 2 +- .../sshd/common/channel/RequestHandler.java | 2 +- .../sshd/common/forward/ForwarderFactory.java | 2 +- .../apache/sshd/common/kex/DHGroupData.java | 2 +- .../sshd/common/kex/KexFactoryManager.java | 2 +- .../server/ServerAuthenticationManager.java | 2 +- .../hostbased/HostBasedAuthenticator.java | 2 +- .../sshd/server/command/CommandLifecycle.java | 6 +- .../sshd/server/session/ServerSession.java | 2 +- .../auth/pubkey/HostBoundPubKeyAuthTest.java | 20 +- .../ClientOpenSSHCertificatesTest.java | 80 ++++---- .../sshd/common/cipher/OpenSshCipherTest.java | 16 +- .../PortForwardingWithOpenSshTest.java | 20 +- .../StrictKexInteroperabilityTest.java | 18 +- .../sshd/ldap/LdapNetworkConnector.java | 2 +- .../sshd/ldap/LdapPasswordAuthenticator.java | 2 +- .../openpgp/PGPKeyPairResourceParser.java | 2 +- .../org/apache/sshd/putty/PuttyKeyReader.java | 2 +- ...stractScpTransferEventListenerAdapter.java | 2 +- .../sshd/scp/client/ScpCharsetTest.java | 16 +- .../sftp/client/FullAccessSftpClient.java | 2 +- .../common/SftpUniversalOwnerAndGroup.java | 2 +- .../AbstractCheckFileExtensionTest.java | 2 +- .../helpers/CopyDataExtensionImplTest.java | 2 +- 32 files changed, 152 insertions(+), 276 deletions(-) create mode 100644 .mvn/maven.config diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 0eb87ee6b..72acedeb0 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -29,7 +29,7 @@ jobs: strategy: matrix: os: [ ubuntu-latest, windows-latest ] - java: [ '8' ] + java: [ '8', '11' ] steps: - uses: actions/checkout@v4 @@ -47,7 +47,7 @@ jobs: ${{ matrix.os }}-maven- - name: Build with maven - run: mvn -B --errors --activate-profiles ci --no-transfer-progress package -DskipTests + run: mvn -B --errors --activate-profiles ci,jdk{{matrix.java}}? --no-transfer-progress package -DskipTests test: needs: compile @@ -74,7 +74,7 @@ jobs: - name: Build and test with maven # Skip all static checks, they were already done in the compile jobs - run: mvn -B --errors --activate-profiles ci --no-transfer-progress package + run: mvn -B --errors --activate-profiles ci,jdk{{matrix.java}}? --no-transfer-progress package - name: Archive test results and logs # if: success() || failure() to also get the test results on successful runs. diff --git a/.github/workflows/master-build.yml b/.github/workflows/master-build.yml index 7aa899eb8..1d5a9913a 100644 --- a/.github/workflows/master-build.yml +++ b/.github/workflows/master-build.yml @@ -47,7 +47,7 @@ jobs: uses: actions/setup-java@v4 with: distribution: temurin - java-version: '8' + java-version: '11' # Create a ~/.m2/settings.xml referencing these environment variable names server-id: 'apache.snapshots.https' server-username: NEXUS_USERNAME diff --git a/.mvn/maven.config b/.mvn/maven.config new file mode 100644 index 000000000..6f7ab7285 --- /dev/null +++ b/.mvn/maven.config @@ -0,0 +1,2 @@ +-Dworkspace.root.dir=${session.rootDirectory} +-DprojectRoot=${session.rootDirectory} diff --git a/pom.xml b/pom.xml index fcbc28d7a..eb47d5a9b 100644 --- a/pom.xml +++ b/pom.xml @@ -22,7 +22,7 @@ org.apache apache - 32 + 33 org.apache.sshd @@ -79,18 +79,14 @@ - ${project.basedir} + 11 + 3.9.8 + UTF-8 2024-06-20T20:44:27Z - - - - 1 - 8 8 - 1.0 - ${java.major.version}.${java.minor.version} + ${java.sdk.version} ${javac.source} ${javac.source} 1.10.12 @@ -137,10 +133,34 @@ - release + jdk8 - [1.8,1.9) + 8 + + + + net.revelc.code.formatter + formatter-maven-plugin + + + format + none + + + + + net.revelc.code + impsort-maven-plugin + + + sort-imports + none + + + + + @@ -318,21 +338,6 @@ - - - org.codehaus.gmavenplus - gmavenplus-plugin - [1.0,) - - compile - execute - testCompile - - - - - - org.apache.rat @@ -752,27 +757,6 @@ - - org.codehaus.mojo - animal-sniffer-maven-plugin - 1.23 - - - org.codehaus.mojo.signature - java${java.major.version}${java.minor.version} - ${sniffer.signatures.version} - - - - - - org.codehaus.mojo.signature - java${java.major.version}${java.minor.version} - ${sniffer.signatures.version} - pom - - - org.apache.maven.plugins maven-scm-plugin @@ -844,56 +828,6 @@ - - org.codehaus.gmavenplus - gmavenplus-plugin - 3.0.2 - - - - org.apache.ant - ant - ${ant.version} - - - org.apache.ant - ant-launcher - ${ant.version} - - - org.apache.ant - ant-junit4 - ${ant.version} - - - org.apache.ant - ant-antlr - ${ant.version} - - - junit - junit - ${junit.version} - - - - org.apache.groovy - groovy - ${groovy.version} - - - org.apache.groovy - groovy-ant - ${groovy.version} - - - org.apache.ant - ant-junit - - - - - org.apache.maven.plugins maven-checkstyle-plugin @@ -1062,7 +996,7 @@ net.revelc.code.formatter formatter-maven-plugin - 2.16.0 + 2.23.0 true true @@ -1074,15 +1008,7 @@ net.revelc.code impsort-maven-plugin - 1.6.2 - - - - org.codehaus.plexus - plexus-utils - 3.0.24 - - + 1.11.0 LF java.,javax.,org.w3c.,org.xml.,junit. @@ -1091,52 +1017,10 @@ java.,javax.,org.w3c.,org.xml.,junit. - - org.codehaus.mojo - build-helper-maven-plugin - ${build-helper-maven-plugin.version} - - - org.codehaus.gmavenplus - gmavenplus-plugin - - - - detect-workspace-root-dir - - validate - - execute - - - - - - - - - net.revelc.code.formatter formatter-maven-plugin @@ -1430,18 +1314,6 @@ ${project.build.outputDirectory}/META-INF/MANIFEST.MF - - - org.apache.maven - maven-archiver - ${maven.archiver.version} - - - org.codehaus.plexus - plexus-archiver - ${plexus.archiver.version} - - org.apache.maven.plugins diff --git a/sshd-common/src/main/java/org/apache/sshd/common/file/util/BaseFileSystem.java b/sshd-common/src/main/java/org/apache/sshd/common/file/util/BaseFileSystem.java index 51b9a03bc..e835912eb 100644 --- a/sshd-common/src/main/java/org/apache/sshd/common/file/util/BaseFileSystem.java +++ b/sshd-common/src/main/java/org/apache/sshd/common/file/util/BaseFileSystem.java @@ -123,7 +123,7 @@ protected void appendDedupSep(StringBuilder sb, CharSequence s) { /** * In case we are running on Windows, accept "\\" as a file separator. Ignore in *nix as "\\" is a valid filename - * + * * @param name the name to fix the separator for if running on Windows * @return the fixed name */ diff --git a/sshd-common/src/main/java/org/apache/sshd/common/util/io/IoUtils.java b/sshd-common/src/main/java/org/apache/sshd/common/util/io/IoUtils.java index 11dd1d92d..5d1bb0697 100644 --- a/sshd-common/src/main/java/org/apache/sshd/common/util/io/IoUtils.java +++ b/sshd-common/src/main/java/org/apache/sshd/common/util/io/IoUtils.java @@ -601,7 +601,7 @@ public static String appendPathComponent(String prefix, String component) { StringBuilder sb = new StringBuilder( prefix.length() + component.length() + File.separator.length()) - .append(prefix); + .append(prefix); if (sb.charAt(prefix.length() - 1) == File.separatorChar) { if (component.charAt(0) == File.separatorChar) { @@ -743,7 +743,7 @@ private static List removeExtraCdUps(Path toResolve) { /** * Build a path from the list of path parts - * + * * @param root the root path * @param fs the filesystem * @param namesList the parts of the path to build diff --git a/sshd-contrib/src/main/java/org/apache/sshd/contrib/common/util/io/ExposedBufferByteArrayOutputStream.java b/sshd-contrib/src/main/java/org/apache/sshd/contrib/common/util/io/ExposedBufferByteArrayOutputStream.java index e64f8ffaf..48a8912d8 100644 --- a/sshd-contrib/src/main/java/org/apache/sshd/contrib/common/util/io/ExposedBufferByteArrayOutputStream.java +++ b/sshd-contrib/src/main/java/org/apache/sshd/contrib/common/util/io/ExposedBufferByteArrayOutputStream.java @@ -23,7 +23,7 @@ /** * Exposes direct access to the underlying buffer - * + * * @author Apache MINA SSHD Project */ public class ExposedBufferByteArrayOutputStream extends ByteArrayOutputStream { diff --git a/sshd-core/src/main/java/org/apache/sshd/client/channel/ClientChannelEvent.java b/sshd-core/src/main/java/org/apache/sshd/client/channel/ClientChannelEvent.java index d0d6c1034..4ee0a0c91 100644 --- a/sshd-core/src/main/java/org/apache/sshd/client/channel/ClientChannelEvent.java +++ b/sshd-core/src/main/java/org/apache/sshd/client/channel/ClientChannelEvent.java @@ -24,7 +24,7 @@ /** * Various events used by {@link ClientChannel#waitFor(java.util.Collection, long)} - * + * * @author Apache MINA SSHD Project */ public enum ClientChannelEvent { @@ -42,13 +42,13 @@ public enum ClientChannelEvent { EOF, /** * Received exit status from remote peer - * + * * @see ClientChannel#getExitStatus() **/ EXIT_STATUS, /** * Received exit signal from remote peer - * + * * @see ClientChannel#getExitSignal() */ EXIT_SIGNAL, diff --git a/sshd-core/src/main/java/org/apache/sshd/common/channel/ChannelOutputStream.java b/sshd-core/src/main/java/org/apache/sshd/common/channel/ChannelOutputStream.java index d86bd4f77..3722a0ee9 100644 --- a/sshd-core/src/main/java/org/apache/sshd/common/channel/ChannelOutputStream.java +++ b/sshd-core/src/main/java/org/apache/sshd/common/channel/ChannelOutputStream.java @@ -222,7 +222,7 @@ public synchronized void write(byte[] buf, int s, int l) throws IOException { } catch (InterruptedException e) { throw (IOException) new InterruptedIOException( "Interrupted while waiting for remote space on write len=" + l + " to " + this) - .initCause(e); + .initCause(e); } session.resetIdleTimeout(); break; diff --git a/sshd-core/src/main/java/org/apache/sshd/common/channel/RequestHandler.java b/sshd-core/src/main/java/org/apache/sshd/common/channel/RequestHandler.java index 1feb723da..275d0490b 100644 --- a/sshd-core/src/main/java/org/apache/sshd/common/channel/RequestHandler.java +++ b/sshd-core/src/main/java/org/apache/sshd/common/channel/RequestHandler.java @@ -64,7 +64,7 @@ public static Result fromName(String name) { /** * Process an SSH request. If an exception is thrown, the ConnectionService will send a failure message if needed * and the request will be considered handled. - * + * * @param t The input parameter * @param request The request string * @param wantReply Whether a reply is requested diff --git a/sshd-core/src/main/java/org/apache/sshd/common/forward/ForwarderFactory.java b/sshd-core/src/main/java/org/apache/sshd/common/forward/ForwarderFactory.java index 6bf06f22b..c5d95f6b9 100644 --- a/sshd-core/src/main/java/org/apache/sshd/common/forward/ForwarderFactory.java +++ b/sshd-core/src/main/java/org/apache/sshd/common/forward/ForwarderFactory.java @@ -22,7 +22,7 @@ /** * A factory for creating forwarder objects for client port forwarding - * + * * @author Apache MINA SSHD Project */ @FunctionalInterface diff --git a/sshd-core/src/main/java/org/apache/sshd/common/kex/DHGroupData.java b/sshd-core/src/main/java/org/apache/sshd/common/kex/DHGroupData.java index 9c2c2704f..8907e341f 100644 --- a/sshd-core/src/main/java/org/apache/sshd/common/kex/DHGroupData.java +++ b/sshd-core/src/main/java/org/apache/sshd/common/kex/DHGroupData.java @@ -194,7 +194,7 @@ public static byte[] readOakleyGroupPrimeValue(Reader r) throws IOException { *
  • Remaining lines are appended to one big string assumed to contain the HEX-encoded value
  • *

    * - * + * * @param br The {@link BufferedReader} to read the data from * @return The prime value bytes suitable for building a {@code BigInteger} * @throws IOException If invalid data or no encoded value found diff --git a/sshd-core/src/main/java/org/apache/sshd/common/kex/KexFactoryManager.java b/sshd-core/src/main/java/org/apache/sshd/common/kex/KexFactoryManager.java index 5aa0cf826..c64548483 100644 --- a/sshd-core/src/main/java/org/apache/sshd/common/kex/KexFactoryManager.java +++ b/sshd-core/src/main/java/org/apache/sshd/common/kex/KexFactoryManager.java @@ -39,7 +39,7 @@ /** * Holds KEX negotiation stage configuration - * + * * @author Apache MINA SSHD Project */ public interface KexFactoryManager extends SignatureFactoriesManager, KexExtensionHandlerManager { diff --git a/sshd-core/src/main/java/org/apache/sshd/server/ServerAuthenticationManager.java b/sshd-core/src/main/java/org/apache/sshd/server/ServerAuthenticationManager.java index 52a666117..5d3d52a96 100644 --- a/sshd-core/src/main/java/org/apache/sshd/server/ServerAuthenticationManager.java +++ b/sshd-core/src/main/java/org/apache/sshd/server/ServerAuthenticationManager.java @@ -46,7 +46,7 @@ /** * Holds providers and helpers related to the server side authentication process - * + * * @author Apache MINA SSHD Project */ public interface ServerAuthenticationManager diff --git a/sshd-core/src/main/java/org/apache/sshd/server/auth/hostbased/HostBasedAuthenticator.java b/sshd-core/src/main/java/org/apache/sshd/server/auth/hostbased/HostBasedAuthenticator.java index 2aa6686bf..43abc6b2a 100644 --- a/sshd-core/src/main/java/org/apache/sshd/server/auth/hostbased/HostBasedAuthenticator.java +++ b/sshd-core/src/main/java/org/apache/sshd/server/auth/hostbased/HostBasedAuthenticator.java @@ -27,7 +27,7 @@ /** * Invoked when "hostbased" authentication is used - * + * * @author Apache MINA SSHD Project * @see RFC 4252 - section 9 */ diff --git a/sshd-core/src/main/java/org/apache/sshd/server/command/CommandLifecycle.java b/sshd-core/src/main/java/org/apache/sshd/server/command/CommandLifecycle.java index f91669529..d95f65f3b 100644 --- a/sshd-core/src/main/java/org/apache/sshd/server/command/CommandLifecycle.java +++ b/sshd-core/src/main/java/org/apache/sshd/server/command/CommandLifecycle.java @@ -31,9 +31,11 @@ public interface CommandLifecycle { /** * Starts the command execution. All streams must have been set before calling this method. The command * should implement {@link java.lang.Runnable}, and this method should spawn a new thread like: - * + * *
    -     * {@code Thread(this).start(); }
    +     * {@code
    +     * Thread(this).start();
    +     * }
          * 
    * * @param channel The {@link ChannelSession} through which the command has been received diff --git a/sshd-core/src/main/java/org/apache/sshd/server/session/ServerSession.java b/sshd-core/src/main/java/org/apache/sshd/server/session/ServerSession.java index c0c97699c..b566ef54e 100644 --- a/sshd-core/src/main/java/org/apache/sshd/server/session/ServerSession.java +++ b/sshd-core/src/main/java/org/apache/sshd/server/session/ServerSession.java @@ -77,7 +77,7 @@ public interface ServerSession *
  • Sends the {@code SSH_MSG_USERAUTH_SUCCESS} message.
  • *

    * - * + * * @param username The authenticated username * @param authService The service to start * @param buffer Any extra data received to use to start the service diff --git a/sshd-core/src/test/java/org/apache/sshd/client/auth/pubkey/HostBoundPubKeyAuthTest.java b/sshd-core/src/test/java/org/apache/sshd/client/auth/pubkey/HostBoundPubKeyAuthTest.java index d99b84231..325f2fe04 100644 --- a/sshd-core/src/test/java/org/apache/sshd/client/auth/pubkey/HostBoundPubKeyAuthTest.java +++ b/sshd-core/src/test/java/org/apache/sshd/client/auth/pubkey/HostBoundPubKeyAuthTest.java @@ -67,16 +67,16 @@ public class HostBoundPubKeyAuthTest extends BaseTestSupport { .run("mkdir -p /home/bob/.ssh") // Create the SSH config directory .entryPoint("/entrypoint.sh") // Sets bob as owner of anything under /home/bob and launches sshd .build())) // - .withCopyFileToContainer( - MountableFile.forClasspathResource(TEST_KEYS + "/user01_authorized_keys"), - "/home/bob/.ssh/authorized_keys") - // entrypoint must be executable. Spotbugs doesn't like 0777, so use hex - .withCopyFileToContainer( - MountableFile.forClasspathResource(TEST_RESOURCES + "/entrypoint.sh", 0x1ff), - "/entrypoint.sh") - .waitingFor(Wait.forLogMessage(".*Server listening on :: port 22.*\\n", 1)) - .withExposedPorts(22) // - .withLogConsumer(new Slf4jLogConsumer(LOG)); + .withCopyFileToContainer( + MountableFile.forClasspathResource(TEST_KEYS + "/user01_authorized_keys"), + "/home/bob/.ssh/authorized_keys") + // entrypoint must be executable. Spotbugs doesn't like 0777, so use hex + .withCopyFileToContainer( + MountableFile.forClasspathResource(TEST_RESOURCES + "/entrypoint.sh", 0x1ff), + "/entrypoint.sh") + .waitingFor(Wait.forLogMessage(".*Server listening on :: port 22.*\\n", 1)) + .withExposedPorts(22) // + .withLogConsumer(new Slf4jLogConsumer(LOG)); private final String privateKeyName; diff --git a/sshd-core/src/test/java/org/apache/sshd/client/opensshcerts/ClientOpenSSHCertificatesTest.java b/sshd-core/src/test/java/org/apache/sshd/client/opensshcerts/ClientOpenSSHCertificatesTest.java index fe2e68282..a5fe5b121 100644 --- a/sshd-core/src/test/java/org/apache/sshd/client/opensshcerts/ClientOpenSSHCertificatesTest.java +++ b/sshd-core/src/test/java/org/apache/sshd/client/opensshcerts/ClientOpenSSHCertificatesTest.java @@ -95,46 +95,46 @@ public class ClientOpenSSHCertificatesTest extends BaseTestSupport { .run("echo 'user02:password02' | chpasswd") // ...both users .entryPoint("/entrypoint.sh") // Sets up supervisor to run sshd .build())) // - .withCopyFileToContainer(MountableFile.forClasspathResource( - "org/apache/sshd/client/opensshcerts/docker/sshd_config"), "/etc/ssh/sshd_config") - .withCopyFileToContainer( - MountableFile.forClasspathResource( - "org/apache/sshd/client/opensshcerts/docker/supervisord.conf"), - "/etc/supervisor/supervisord.conf") - .withCopyFileToContainer( - MountableFile.forClasspathResource( - "org/apache/sshd/client/opensshcerts/user/user01_authorized_keys"), - "/keys/user/user01/authorized_keys") - .withCopyFileToContainer( - MountableFile.forClasspathResource( - "org/apache/sshd/client/opensshcerts/user/user02_authorized_keys"), - "/keys/user/user02/authorized_keys") - .withCopyFileToContainer( - MountableFile.forClasspathResource("org/apache/sshd/client/opensshcerts/host/host01"), - "/keys/host/host01") - .withCopyFileToContainer( - MountableFile.forClasspathResource("org/apache/sshd/client/opensshcerts/host/host01" - + PublicKeyEntry.PUBKEY_FILE_SUFFIX), - "/keys/host/host01" + PublicKeyEntry.PUBKEY_FILE_SUFFIX) - .withCopyFileToContainer( - MountableFile.forClasspathResource("org/apache/sshd/client/opensshcerts/host/host02"), - "/keys/host/host02") - .withCopyFileToContainer( - MountableFile.forClasspathResource("org/apache/sshd/client/opensshcerts/host/host02" - + PublicKeyEntry.PUBKEY_FILE_SUFFIX), - "/keys/host/host02" + PublicKeyEntry.PUBKEY_FILE_SUFFIX) - .withCopyFileToContainer( - MountableFile.forClasspathResource( - "org/apache/sshd/client/opensshcerts/ca/ca" + PublicKeyEntry.PUBKEY_FILE_SUFFIX), - "/ca" + PublicKeyEntry.PUBKEY_FILE_SUFFIX) - // entrypoint must be executable. Spotbugs doesn't like 0777, so use hex - .withCopyFileToContainer( - MountableFile.forClasspathResource( - "org/apache/sshd/client/opensshcerts/docker/entrypoint.sh", 0x1ff), - "/entrypoint.sh") - // must be set to "/keys/host/host01" or "/keys/host/host02" - .withEnv("SSH_HOST_KEY", "/keys/host/host01") // - .withExposedPorts(22); + .withCopyFileToContainer(MountableFile.forClasspathResource( + "org/apache/sshd/client/opensshcerts/docker/sshd_config"), "/etc/ssh/sshd_config") + .withCopyFileToContainer( + MountableFile.forClasspathResource( + "org/apache/sshd/client/opensshcerts/docker/supervisord.conf"), + "/etc/supervisor/supervisord.conf") + .withCopyFileToContainer( + MountableFile.forClasspathResource( + "org/apache/sshd/client/opensshcerts/user/user01_authorized_keys"), + "/keys/user/user01/authorized_keys") + .withCopyFileToContainer( + MountableFile.forClasspathResource( + "org/apache/sshd/client/opensshcerts/user/user02_authorized_keys"), + "/keys/user/user02/authorized_keys") + .withCopyFileToContainer( + MountableFile.forClasspathResource("org/apache/sshd/client/opensshcerts/host/host01"), + "/keys/host/host01") + .withCopyFileToContainer( + MountableFile.forClasspathResource("org/apache/sshd/client/opensshcerts/host/host01" + + PublicKeyEntry.PUBKEY_FILE_SUFFIX), + "/keys/host/host01" + PublicKeyEntry.PUBKEY_FILE_SUFFIX) + .withCopyFileToContainer( + MountableFile.forClasspathResource("org/apache/sshd/client/opensshcerts/host/host02"), + "/keys/host/host02") + .withCopyFileToContainer( + MountableFile.forClasspathResource("org/apache/sshd/client/opensshcerts/host/host02" + + PublicKeyEntry.PUBKEY_FILE_SUFFIX), + "/keys/host/host02" + PublicKeyEntry.PUBKEY_FILE_SUFFIX) + .withCopyFileToContainer( + MountableFile.forClasspathResource( + "org/apache/sshd/client/opensshcerts/ca/ca" + PublicKeyEntry.PUBKEY_FILE_SUFFIX), + "/ca" + PublicKeyEntry.PUBKEY_FILE_SUFFIX) + // entrypoint must be executable. Spotbugs doesn't like 0777, so use hex + .withCopyFileToContainer( + MountableFile.forClasspathResource( + "org/apache/sshd/client/opensshcerts/docker/entrypoint.sh", 0x1ff), + "/entrypoint.sh") + // must be set to "/keys/host/host01" or "/keys/host/host02" + .withEnv("SSH_HOST_KEY", "/keys/host/host01") // + .withExposedPorts(22); private static final String USER_KEY_PATH = "org/apache/sshd/client/opensshcerts/user/"; diff --git a/sshd-core/src/test/java/org/apache/sshd/common/cipher/OpenSshCipherTest.java b/sshd-core/src/test/java/org/apache/sshd/common/cipher/OpenSshCipherTest.java index 10d6c34e7..e7389c504 100644 --- a/sshd-core/src/test/java/org/apache/sshd/common/cipher/OpenSshCipherTest.java +++ b/sshd-core/src/test/java/org/apache/sshd/common/cipher/OpenSshCipherTest.java @@ -74,14 +74,14 @@ public class OpenSshCipherTest extends BaseTestSupport { .run("mkdir -p /home/bob/.ssh") // Create the SSH config directory .entryPoint("/entrypoint.sh") // Sets bob as owner of anything under /home/bob and launches sshd .build())) // - .withCopyFileToContainer(MountableFile.forClasspathResource(TEST_RESOURCES + "/bob_key.pub"), - "/home/bob/.ssh/authorized_keys") - // entrypoint must be executable. Spotbugs doesn't like 0777, so use hex - .withCopyFileToContainer( - MountableFile.forClasspathResource(TEST_RESOURCES + "/entrypoint.sh", 0x1ff), - "/entrypoint.sh") - .waitingFor(Wait.forLogMessage(".*Server listening on :: port 22.*\\n", 1)).withExposedPorts(22) // - .withLogConsumer(new Slf4jLogConsumer(LOG)); + .withCopyFileToContainer(MountableFile.forClasspathResource(TEST_RESOURCES + "/bob_key.pub"), + "/home/bob/.ssh/authorized_keys") + // entrypoint must be executable. Spotbugs doesn't like 0777, so use hex + .withCopyFileToContainer( + MountableFile.forClasspathResource(TEST_RESOURCES + "/entrypoint.sh", 0x1ff), + "/entrypoint.sh") + .waitingFor(Wait.forLogMessage(".*Server listening on :: port 22.*\\n", 1)).withExposedPorts(22) // + .withLogConsumer(new Slf4jLogConsumer(LOG)); private final String providerName; diff --git a/sshd-core/src/test/java/org/apache/sshd/common/forward/PortForwardingWithOpenSshTest.java b/sshd-core/src/test/java/org/apache/sshd/common/forward/PortForwardingWithOpenSshTest.java index 6f77e7280..1d9910c81 100644 --- a/sshd-core/src/test/java/org/apache/sshd/common/forward/PortForwardingWithOpenSshTest.java +++ b/sshd-core/src/test/java/org/apache/sshd/common/forward/PortForwardingWithOpenSshTest.java @@ -190,16 +190,16 @@ public void forwardingWithConnectionClose() throws Exception { .run("mkdir -p /root/.ssh") // Create the SSH config directory .entryPoint("/entrypoint.sh") // .build())) // - .withCopyFileToContainer(MountableFile.forClasspathResource(TEST_KEYS + "/user01_ed25519"), - "/root/.ssh/id_ed25519") - .withCopyFileToContainer(MountableFile.forClasspathResource(TEST_KEYS + "/user01_ed25519.pub"), - "/root/.ssh/id_ed25519.pub") - // Spotbugs doesn't like 0777, so use hex - .withCopyFileToContainer(MountableFile.forHostPath(entryPoint.getPath(), 0x1ff), - "/entrypoint.sh") - .withAccessToHost(true) // - .waitingFor(Wait.forLogMessage(".*forwarding_success.*\n", 1)) - .withLogConsumer(new Slf4jLogConsumer(LOG)); + .withCopyFileToContainer(MountableFile.forClasspathResource(TEST_KEYS + "/user01_ed25519"), + "/root/.ssh/id_ed25519") + .withCopyFileToContainer(MountableFile.forClasspathResource(TEST_KEYS + "/user01_ed25519.pub"), + "/root/.ssh/id_ed25519.pub") + // Spotbugs doesn't like 0777, so use hex + .withCopyFileToContainer(MountableFile.forHostPath(entryPoint.getPath(), 0x1ff), + "/entrypoint.sh") + .withAccessToHost(true) // + .waitingFor(Wait.forLogMessage(".*forwarding_success.*\n", 1)) + .withLogConsumer(new Slf4jLogConsumer(LOG)); try { Testcontainers.exposeHostPorts(sshPort, gRpcPort); sshdContainer.start(); diff --git a/sshd-core/src/test/java/org/apache/sshd/common/kex/extension/StrictKexInteroperabilityTest.java b/sshd-core/src/test/java/org/apache/sshd/common/kex/extension/StrictKexInteroperabilityTest.java index 5a77fde3a..7c578202e 100644 --- a/sshd-core/src/test/java/org/apache/sshd/common/kex/extension/StrictKexInteroperabilityTest.java +++ b/sshd-core/src/test/java/org/apache/sshd/common/kex/extension/StrictKexInteroperabilityTest.java @@ -121,15 +121,15 @@ private void testStrictKex(boolean withStrictKex) throws Exception { .run("mkdir -p /home/bob/.ssh") // Create the SSH config directory .entryPoint("/entrypoint.sh") // .build())) // - .withCopyFileToContainer(MountableFile.forClasspathResource(TEST_RESOURCES + "/bob_key.pub"), - "/home/bob/.ssh/authorized_keys") - // entrypoint must be executable. Spotbugs doesn't like 0777, so use hex - .withCopyFileToContainer( - MountableFile.forClasspathResource(TEST_RESOURCES + "/entrypoint.sh", 0x1ff), - "/entrypoint.sh") - .waitingFor(Wait.forLogMessage(".*Server listening on :: port 22.*\\n", 1)) // - .withExposedPorts(22) // - .withLogConsumer(new Slf4jLogConsumer(LOG)); + .withCopyFileToContainer(MountableFile.forClasspathResource(TEST_RESOURCES + "/bob_key.pub"), + "/home/bob/.ssh/authorized_keys") + // entrypoint must be executable. Spotbugs doesn't like 0777, so use hex + .withCopyFileToContainer( + MountableFile.forClasspathResource(TEST_RESOURCES + "/entrypoint.sh", 0x1ff), + "/entrypoint.sh") + .waitingFor(Wait.forLogMessage(".*Server listening on :: port 22.*\\n", 1)) // + .withExposedPorts(22) // + .withLogConsumer(new Slf4jLogConsumer(LOG)); sshdContainer.start(); try { FileKeyPairProvider keyPairProvider = CommonTestSupportUtils.createTestKeyPairProvider(TEST_RESOURCES + "/bob_key"); diff --git a/sshd-ldap/src/main/java/org/apache/sshd/ldap/LdapNetworkConnector.java b/sshd-ldap/src/main/java/org/apache/sshd/ldap/LdapNetworkConnector.java index cf596f655..5be56e073 100644 --- a/sshd-ldap/src/main/java/org/apache/sshd/ldap/LdapNetworkConnector.java +++ b/sshd-ldap/src/main/java/org/apache/sshd/ldap/LdapNetworkConnector.java @@ -80,7 +80,7 @@ public class LdapNetworkConnector extends NetworkConnector { public static final String DEFAULT_LDAP_BIND_PASSWORD_PATTERN = "{1}"; /** * A list of known binary attributes - * + * * @see LDAP Attributes */ public static final String DEFAULT_BINARY_ATTRIBUTES diff --git a/sshd-ldap/src/main/java/org/apache/sshd/ldap/LdapPasswordAuthenticator.java b/sshd-ldap/src/main/java/org/apache/sshd/ldap/LdapPasswordAuthenticator.java index 8b9e2bfe5..3973b3fc8 100644 --- a/sshd-ldap/src/main/java/org/apache/sshd/ldap/LdapPasswordAuthenticator.java +++ b/sshd-ldap/src/main/java/org/apache/sshd/ldap/LdapPasswordAuthenticator.java @@ -46,7 +46,7 @@ * "{0}@my.domain.com". *

    * - * + * * @author Apache MINA SSHD Project */ public class LdapPasswordAuthenticator extends LdapAuthenticator implements PasswordAuthenticator { diff --git a/sshd-openpgp/src/main/java/org/apache/sshd/openpgp/PGPKeyPairResourceParser.java b/sshd-openpgp/src/main/java/org/apache/sshd/openpgp/PGPKeyPairResourceParser.java index e8d2eeda7..0691e1894 100644 --- a/sshd-openpgp/src/main/java/org/apache/sshd/openpgp/PGPKeyPairResourceParser.java +++ b/sshd-openpgp/src/main/java/org/apache/sshd/openpgp/PGPKeyPairResourceParser.java @@ -81,7 +81,7 @@ public Collection extractKeyPairs( int numLines = GenericUtils.size(lines); StringBuilder sb = new StringBuilder( beginMarker.length() + endMarker.length() + 4 + numLines * 80) - .append(beginMarker); + .append(beginMarker); if (numLines > 0) { for (String l : lines) { sb.append(eol).append(l); diff --git a/sshd-putty/src/main/java/org/apache/sshd/putty/PuttyKeyReader.java b/sshd-putty/src/main/java/org/apache/sshd/putty/PuttyKeyReader.java index 903db8607..cab66b0b0 100644 --- a/sshd-putty/src/main/java/org/apache/sshd/putty/PuttyKeyReader.java +++ b/sshd-putty/src/main/java/org/apache/sshd/putty/PuttyKeyReader.java @@ -30,7 +30,7 @@ /** * Helper class for {@code Putty} key files decoders - * + * * @author Apache MINA SSHD Project */ public class PuttyKeyReader implements Closeable { diff --git a/sshd-scp/src/main/java/org/apache/sshd/scp/common/AbstractScpTransferEventListenerAdapter.java b/sshd-scp/src/main/java/org/apache/sshd/scp/common/AbstractScpTransferEventListenerAdapter.java index ef6043b0c..bd4b82b0b 100644 --- a/sshd-scp/src/main/java/org/apache/sshd/scp/common/AbstractScpTransferEventListenerAdapter.java +++ b/sshd-scp/src/main/java/org/apache/sshd/scp/common/AbstractScpTransferEventListenerAdapter.java @@ -30,7 +30,7 @@ /** * A no-op implementation of {@link ScpTransferEventListener} for those who wish to implement only a small number of * methods. By default, all non-overridden methods simply log at TRACE level their invocation parameters - * + * * @author Apache MINA SSHD Project */ public abstract class AbstractScpTransferEventListenerAdapter diff --git a/sshd-scp/src/test/java/org/apache/sshd/scp/client/ScpCharsetTest.java b/sshd-scp/src/test/java/org/apache/sshd/scp/client/ScpCharsetTest.java index 3d7753cb9..5382ea024 100644 --- a/sshd-scp/src/test/java/org/apache/sshd/scp/client/ScpCharsetTest.java +++ b/sshd-scp/src/test/java/org/apache/sshd/scp/client/ScpCharsetTest.java @@ -69,14 +69,14 @@ public class ScpCharsetTest extends BaseTestSupport { .run("mkdir -p /home/bob/.ssh") // Create the SSH config directory .entryPoint("/entrypoint.sh") // Prepare environment, set locale, and launch .build())) // - .withCopyFileToContainer(MountableFile.forClasspathResource(TEST_RESOURCES + "/bob_key.pub"), - "/home/bob/.ssh/authorized_keys") - // entrypoint must be executable. Spotbugs doesn't like 0777, so use hex - .withCopyFileToContainer( - MountableFile.forClasspathResource(TEST_RESOURCES + "/entrypoint.sh", 0x1ff), - "/entrypoint.sh") - .waitingFor(Wait.forLogMessage(".*Server listening on :: port 22.*\\n", 1)).withExposedPorts(22) // - .withLogConsumer(new Slf4jLogConsumer(LOG)); + .withCopyFileToContainer(MountableFile.forClasspathResource(TEST_RESOURCES + "/bob_key.pub"), + "/home/bob/.ssh/authorized_keys") + // entrypoint must be executable. Spotbugs doesn't like 0777, so use hex + .withCopyFileToContainer( + MountableFile.forClasspathResource(TEST_RESOURCES + "/entrypoint.sh", 0x1ff), + "/entrypoint.sh") + .waitingFor(Wait.forLogMessage(".*Server listening on :: port 22.*\\n", 1)).withExposedPorts(22) // + .withLogConsumer(new Slf4jLogConsumer(LOG)); @Rule public TemporaryFolder tmp = new TemporaryFolder(); diff --git a/sshd-sftp/src/main/java/org/apache/sshd/sftp/client/FullAccessSftpClient.java b/sshd-sftp/src/main/java/org/apache/sshd/sftp/client/FullAccessSftpClient.java index eec17c5eb..79813057e 100644 --- a/sshd-sftp/src/main/java/org/apache/sshd/sftp/client/FullAccessSftpClient.java +++ b/sshd-sftp/src/main/java/org/apache/sshd/sftp/client/FullAccessSftpClient.java @@ -23,7 +23,7 @@ /** * Provides both structured and raw SFTP access - * + * * @author Apache MINA SSHD Project */ public interface FullAccessSftpClient extends SftpClient, RawSftpClient { diff --git a/sshd-sftp/src/main/java/org/apache/sshd/sftp/common/SftpUniversalOwnerAndGroup.java b/sshd-sftp/src/main/java/org/apache/sshd/sftp/common/SftpUniversalOwnerAndGroup.java index 4948028f8..f5b522b5a 100644 --- a/sshd-sftp/src/main/java/org/apache/sshd/sftp/common/SftpUniversalOwnerAndGroup.java +++ b/sshd-sftp/src/main/java/org/apache/sshd/sftp/common/SftpUniversalOwnerAndGroup.java @@ -27,7 +27,7 @@ /** * Some universal identifiers used in owner and/or group specification strings - * + * * @author Apache MINA SSHD Project * @see SFTP ACL */ diff --git a/sshd-sftp/src/test/java/org/apache/sshd/sftp/client/extensions/helpers/AbstractCheckFileExtensionTest.java b/sshd-sftp/src/test/java/org/apache/sshd/sftp/client/extensions/helpers/AbstractCheckFileExtensionTest.java index b192122ad..c7ac8fab8 100644 --- a/sshd-sftp/src/test/java/org/apache/sshd/sftp/client/extensions/helpers/AbstractCheckFileExtensionTest.java +++ b/sshd-sftp/src/test/java/org/apache/sshd/sftp/client/extensions/helpers/AbstractCheckFileExtensionTest.java @@ -134,7 +134,7 @@ private void testCheckFileExtension(String expectedAlgorithm, int inputDataSize, + "-" + expectedAlgorithm + "-" + inputDataSize + "/" + hashBlockSize + IoUtils.EOL) - .getBytes(StandardCharsets.UTF_8); + .getBytes(StandardCharsets.UTF_8); try (ByteArrayOutputStream baos = new ByteArrayOutputStream(inputDataSize + seed.length)) { while (baos.size() < inputDataSize) { diff --git a/sshd-sftp/src/test/java/org/apache/sshd/sftp/client/extensions/helpers/CopyDataExtensionImplTest.java b/sshd-sftp/src/test/java/org/apache/sshd/sftp/client/extensions/helpers/CopyDataExtensionImplTest.java index e24458d72..8d3867942 100644 --- a/sshd-sftp/src/test/java/org/apache/sshd/sftp/client/extensions/helpers/CopyDataExtensionImplTest.java +++ b/sshd-sftp/src/test/java/org/apache/sshd/sftp/client/extensions/helpers/CopyDataExtensionImplTest.java @@ -118,7 +118,7 @@ private void testCopyDataExtension(int dataSize, int readOffset, int readLength, + "-" + dataSize + "-" + readOffset + "/" + readLength + "/" + writeOffset + IoUtils.EOL) - .getBytes(StandardCharsets.UTF_8); + .getBytes(StandardCharsets.UTF_8); try (ByteArrayOutputStream baos = new ByteArrayOutputStream(dataSize + seed.length)) { while (baos.size() < dataSize) { baos.write(seed);