This is an automated email from the ASF dual-hosted git repository.
davsclaus pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/camel.git
The following commit(s) were added to refs/heads/main by this push:
new 9d7c28bb4702 CAMEL-27054: camel-ftp - refuse a file or directory name
with a carriage return or line feed (#30211)
9d7c28bb4702 is described below
commit 9d7c28bb470242877e4109e1453830565f3847ac
Author: Claus Ibsen <[email protected]>
AuthorDate: Mon Nov 16 21:03:10 2026 +0100
CAMEL-27054: camel-ftp - refuse a file or directory name with a carriage
return or line feed (#30211)
FtpOperations (also used by ftps) checks every remote file or directory name
before it sends a command for it, and refuses a name with a carriage return
or a
line feed with a GenericFileOperationFailedException. Nothing is sent to the
server for it. siteCommand is unchanged. Docs and the upgrade guide (4.24,
and
4.22.3 / 4.18.6 for the backports) updated.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
---
.../apache/camel/catalog/docs/ftp-component.adoc | 7 +
.../camel-ftp/src/main/docs/ftp-component.adoc | 7 +
.../camel/component/file/remote/FtpOperations.java | 32 +++++
.../camel/component/file/remote/FakeFtpServer.java | 7 +
.../remote/FtpProducerFileNameLineBreakTest.java | 154 +++++++++++++++++++++
.../FtpProducerFileNameLineBreakIT.java | 87 ++++++++++++
.../ROOT/pages/camel-4x-upgrade-guide-4_18.adoc | 12 ++
.../ROOT/pages/camel-4x-upgrade-guide-4_22.adoc | 12 ++
.../ROOT/pages/camel-4x-upgrade-guide-4_24.adoc | 12 ++
9 files changed, 330 insertions(+)
diff --git
a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/docs/ftp-component.adoc
b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/docs/ftp-component.adoc
index 702cbf71401e..294010afe951 100644
---
a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/docs/ftp-component.adoc
+++
b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/docs/ftp-component.adoc
@@ -268,6 +268,13 @@ wait on that connection again:
* When disconnecting, for example when the consumer or the producer stops, the
client sends `QUIT` and waits at most
2 seconds (`soTimeout` when it is shorter) for its reply.
+=== File and directory names with a line break
+
+The FTP control connection sends one command per line, so a remote file or
directory name with a carriage return or
+a line feed cannot be sent as the argument of one command. The `ftp` and
`ftps` components refuse such a name with a
+`GenericFileOperationFailedException` before they send any command for it, for
example when the producer writes a file
+whose `CamelFileName` header has a line break. Remove or replace these
characters in the name before the producer.
+
[[FTP-DefaultWhenConsumingFiles]]
=== Default when consuming files
diff --git a/components/camel-ftp/src/main/docs/ftp-component.adoc
b/components/camel-ftp/src/main/docs/ftp-component.adoc
index 702cbf71401e..294010afe951 100644
--- a/components/camel-ftp/src/main/docs/ftp-component.adoc
+++ b/components/camel-ftp/src/main/docs/ftp-component.adoc
@@ -268,6 +268,13 @@ wait on that connection again:
* When disconnecting, for example when the consumer or the producer stops, the
client sends `QUIT` and waits at most
2 seconds (`soTimeout` when it is shorter) for its reply.
+=== File and directory names with a line break
+
+The FTP control connection sends one command per line, so a remote file or
directory name with a carriage return or
+a line feed cannot be sent as the argument of one command. The `ftp` and
`ftps` components refuse such a name with a
+`GenericFileOperationFailedException` before they send any command for it, for
example when the producer writes a file
+whose `CamelFileName` header has a line break. Remove or replace these
characters in the name before the producer.
+
[[FTP-DefaultWhenConsumingFiles]]
=== Default when consuming files
diff --git
a/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/FtpOperations.java
b/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/FtpOperations.java
index fe5f3d9b0e3e..19a07b2f5bbf 100644
---
a/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/FtpOperations.java
+++
b/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/FtpOperations.java
@@ -374,6 +374,7 @@ public class FtpOperations implements
RemoteFileOperations<FTPFile> {
@Override
public boolean deleteFile(String name) throws
GenericFileOperationFailedException {
log.debug("Deleting file: {}", name);
+ checkName(name);
boolean result;
String target = name;
@@ -414,6 +415,8 @@ public class FtpOperations implements
RemoteFileOperations<FTPFile> {
@Override
public boolean renameFile(String from, String to) throws
GenericFileOperationFailedException {
log.debug("Renaming file: {} to: {}", from, to);
+ checkName(from);
+ checkName(to);
try {
reconnectIfNecessary(null);
return client.rename(from, to);
@@ -426,6 +429,7 @@ public class FtpOperations implements
RemoteFileOperations<FTPFile> {
public boolean buildDirectory(String directory, boolean absolute) throws
GenericFileOperationFailedException {
// must normalize directory first
directory = endpoint.getConfiguration().normalizePath(directory);
+ checkName(directory);
log.trace("buildDirectory({})", directory);
try {
@@ -457,6 +461,7 @@ public class FtpOperations implements
RemoteFileOperations<FTPFile> {
@Override
public boolean retrieveFile(String name, Exchange exchange, long size)
throws GenericFileOperationFailedException {
+ checkName(name);
// store the name of the file to download on the listener
clientActivityListener.setDownload(true);
clientActivityListener.setRemoteFileName(name);
@@ -742,6 +747,8 @@ public class FtpOperations implements
RemoteFileOperations<FTPFile> {
public boolean storeFile(String name, Exchange exchange, long size) throws
GenericFileOperationFailedException {
// must normalize name first
name = endpoint.getConfiguration().normalizePath(name);
+ // before the listener and the client, so nothing is sent for a name
that is refused
+ checkName(name);
// store the name of the file to upload on the listener
clientActivityListener.setDownload(false);
@@ -884,6 +891,7 @@ public class FtpOperations implements
RemoteFileOperations<FTPFile> {
@Override
public boolean storeFileDirectly(String name, String payload) throws
GenericFileOperationFailedException {
+ checkName(name);
ByteArrayInputStream bis = new
ByteArrayInputStream(payload.getBytes());
try {
return client.storeFile(name, bis);
@@ -897,6 +905,7 @@ public class FtpOperations implements
RemoteFileOperations<FTPFile> {
@Override
public boolean existsFile(String name) throws
GenericFileOperationFailedException {
log.trace("existsFile({})", name);
+ checkName(name);
if (endpoint.isFastExistsCheck()) {
return fastExistsFile(name);
}
@@ -929,6 +938,7 @@ public class FtpOperations implements
RemoteFileOperations<FTPFile> {
protected boolean fastExistsFile(String name) throws
GenericFileOperationFailedException {
log.trace("fastExistsFile({})", name);
+ checkName(name);
try {
String[] names = client.listNames(name);
if (names == null) {
@@ -958,6 +968,7 @@ public class FtpOperations implements
RemoteFileOperations<FTPFile> {
if (org.apache.camel.util.ObjectHelper.isEmpty(path)) {
return;
}
+ checkName(path);
// must compact path so FTP server can traverse correctly
// use the ftp utils implementation of the compact path
@@ -1045,6 +1056,7 @@ public class FtpOperations implements
RemoteFileOperations<FTPFile> {
if (org.apache.camel.util.ObjectHelper.isEmpty(path)) {
path = ".";
}
+ checkName(path);
try {
return checkListing(client.listFiles(path), "directory: " + path);
@@ -1096,6 +1108,26 @@ public class FtpOperations implements
RemoteFileOperations<FTPFile> {
}
}
+ /**
+ * The FTP control connection sends one command per line, so a file or
directory name with a carriage return or a
+ * line feed cannot be sent as the argument of a single command. Such a
name is refused before any command is sent.
+ * The message gives the character and its index, not the name.
+ */
+ private static void checkName(String name) {
+ if (name == null) {
+ return;
+ }
+ for (int i = 0; i < name.length(); i++) {
+ char ch = name.charAt(i);
+ if (ch == '\r' || ch == '\n') {
+ throw new GenericFileOperationFailedException(
+ String.format("Cannot use the file or directory name:
it has the character U+%04X at index %d, and a"
+ + " carriage return or a line feed
cannot be sent in an FTP command",
+ (int) ch, i));
+ }
+ }
+ }
+
protected FTPClient getFtpClient() {
return client;
}
diff --git
a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FakeFtpServer.java
b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FakeFtpServer.java
index c84710caac1a..19a0028cf9db 100644
---
a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FakeFtpServer.java
+++
b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FakeFtpServer.java
@@ -70,6 +70,7 @@ final class FakeFtpServer implements Closeable {
private final Map<String, byte[]> files = new ConcurrentHashMap<>();
private final Set<String> directories = ConcurrentHashMap.newKeySet();
private final List<Connection> connections = new CopyOnWriteArrayList<>();
+ private final List<String> commands = new CopyOnWriteArrayList<>();
private final AtomicInteger connectionIds = new AtomicInteger();
private volatile Predicate<String> trigger;
private volatile Stall stall = Stall.BEFORE_REPLY;
@@ -119,6 +120,11 @@ final class FakeFtpServer implements Closeable {
return answer;
}
+ /** Every command line the server received, on any connection, in the
order received. */
+ List<String> commands() {
+ return commands;
+ }
+
/** How many control connections the client has opened so far. */
int connectionsOpened() {
return connectionIds.get();
@@ -181,6 +187,7 @@ final class FakeFtpServer implements Closeable {
reply("220 fake FTP server ready (connection " + id + ")");
String line;
while ((line = in.readLine()) != null) {
+ commands.add(line);
Predicate<String> t = trigger;
if (!silent && t != null && t.test(line)) {
// one shot: only the first matching connection stalls
diff --git
a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpProducerFileNameLineBreakTest.java
b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpProducerFileNameLineBreakTest.java
new file mode 100644
index 000000000000..4ffe7bda3e56
--- /dev/null
+++
b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpProducerFileNameLineBreakTest.java
@@ -0,0 +1,154 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.component.file.remote;
+
+import java.nio.charset.StandardCharsets;
+import java.util.List;
+import java.util.Set;
+
+import org.apache.camel.CamelExecutionException;
+import org.apache.camel.Exchange;
+import org.apache.camel.builder.RouteBuilder;
+import org.apache.camel.component.file.GenericFileOperationFailedException;
+import org.apache.camel.test.junit6.CamelTestSupport;
+import org.apache.commons.net.ftp.FTPFile;
+import org.junit.jupiter.api.AfterEach;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.function.Executable;
+import org.junit.jupiter.params.ParameterizedTest;
+import org.junit.jupiter.params.provider.ValueSource;
+
+import static org.apache.camel.test.junit6.TestSupport.assertIsInstanceOf;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertThrows;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+
+/**
+ * The FTP control connection sends one command per line, so the ftp producer
and the ftp operations refuse a file or
+ * directory name with a carriage return or a line feed, and send nothing to
the server for it.
+ */
+public class FtpProducerFileNameLineBreakTest extends CamelTestSupport {
+
+ private static final String EXISTING = "/outbox/existing.txt";
+
+ private FakeFtpServer server;
+
+ @BeforeEach
+ void startServer() throws Exception {
+ server = new FakeFtpServer();
+ server.addFile(EXISTING, "existing".getBytes(StandardCharsets.UTF_8));
+ }
+
+ @AfterEach
+ void stopServer() throws Exception {
+ server.close();
+ }
+
+ private String ftpUri(String options) {
+ String uri = "ftp://[email protected]:" + server.port()
+ +
"/outbox?password=secret&passiveMode=true&soTimeout=5000&timeout=5000";
+ return options.isEmpty() ? uri : uri + "&" + options;
+ }
+
+ private void addRoute(String options) throws Exception {
+ context.addRoutes(new RouteBuilder() {
+ @Override
+ public void configure() {
+ from("direct:upload").to(ftpUri(options));
+ }
+ });
+ }
+
+ @ParameterizedTest
+ @ValueSource(strings = {
+ "before\nafter.txt", "before\rafter.txt", "before\r\nafter.txt",
"before\r\nafter/hello.txt",
+ "sub/before\nafter.txt" })
+ void fileNameWithLineBreakIsRefused(String name) throws Exception {
+ addRoute("");
+
+ assertRefused(name);
+ }
+
+ @ParameterizedTest
+ @ValueSource(strings = {
+ "stepwise=false", "tempFileName=${file:name}.tmp",
"tempPrefix=tmp-", "fileExist=Move&moveExisting=old",
+ "fileExist=Append", "fileExist=Fail",
"fileExist=Ignore&fastExistsCheck=true", "chmod=640",
+ "doneFileName=${file:name}.done" })
+ void fileNameWithLineBreakIsRefusedWithOption(String options) throws
Exception {
+ addRoute(options);
+
+ assertRefused("before\r\nafter.txt");
+ }
+
+ @Test
+ void plainFileNameIsStored() throws Exception {
+
addRoute("tempFileName=${file:name}.tmp&doneFileName=${file:name}.done&chmod=640");
+
+ template.sendBodyAndHeader("direct:upload", "hello",
Exchange.FILE_NAME, "hello.txt");
+
+ assertEquals("hello", new
String(server.files().get("/outbox/hello.txt"), StandardCharsets.UTF_8));
+ assertTrue(server.files().containsKey("/outbox/hello.txt.done"));
+ }
+
+ @Test
+ void operationsRefuseNameWithLineBreak() throws Exception {
+ FtpEndpoint<FTPFile> endpoint = context.getEndpoint(ftpUri(""),
FtpEndpoint.class);
+ RemoteFileOperations<FTPFile> operations =
endpoint.createRemoteFileOperations();
+ operations.connect(endpoint.getConfiguration(), null);
+ Exchange exchange = endpoint.createExchange();
+ String name = "before\nafter.txt";
+ try {
+ List<Executable> calls = List.of(
+ () -> operations.deleteFile(name),
+ () -> operations.renameFile("existing.txt", name),
+ () -> operations.renameFile(name, "renamed.txt"),
+ () -> operations.buildDirectory(name, false),
+ () -> operations.existsFile(name),
+ () -> operations.changeCurrentDirectory(name),
+ () -> operations.listFiles(name),
+ () -> operations.storeFileDirectly(name, "hello"),
+ () -> operations.retrieveFile(name, exchange, 5));
+ for (Executable call : calls) {
+ GenericFileOperationFailedException e =
assertThrows(GenericFileOperationFailedException.class, call);
+ assertTrue(e.getMessage().contains("U+000A at index 6"),
e.getMessage());
+ }
+ } finally {
+ operations.disconnect();
+ }
+
+ assertNothingSentFor();
+ }
+
+ private void assertRefused(String name) {
+ CamelExecutionException e = assertThrows(CamelExecutionException.class,
+ () -> template.sendBodyAndHeader("direct:upload", "hello",
Exchange.FILE_NAME, name));
+ GenericFileOperationFailedException cause =
assertIsInstanceOf(GenericFileOperationFailedException.class, e.getCause());
+ assertTrue(cause.getMessage().contains("a carriage return or a line
feed cannot be sent in an FTP command"),
+ cause.getMessage());
+
+ assertNothingSentFor();
+ assertEquals(Set.of(EXISTING), server.files().keySet());
+ }
+
+ private void assertNothingSentFor() {
+ List<String> sent = server.commands().stream()
+ .filter(command -> command.contains("before") ||
command.contains("after"))
+ .toList();
+ assertEquals(List.of(), sent, "Commands received for the refused name:
" + server.commands());
+ }
+}
diff --git
a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/integration/FtpProducerFileNameLineBreakIT.java
b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/integration/FtpProducerFileNameLineBreakIT.java
new file mode 100644
index 000000000000..1196f2bbd12a
--- /dev/null
+++
b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/integration/FtpProducerFileNameLineBreakIT.java
@@ -0,0 +1,87 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.component.file.remote.integration;
+
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.util.List;
+import java.util.stream.Stream;
+
+import org.apache.camel.CamelExecutionException;
+import org.apache.camel.Exchange;
+import org.apache.camel.builder.RouteBuilder;
+import org.apache.camel.component.file.GenericFileOperationFailedException;
+import org.junit.jupiter.api.Test;
+
+import static org.apache.camel.test.junit6.TestSupport.assertIsInstanceOf;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertThrows;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+
+/**
+ * The ftp producer refuses a file or directory name with a carriage return or
a line feed, as the FTP control
+ * connection sends one command per line, and the server gets no file or
directory for it.
+ */
+public class FtpProducerFileNameLineBreakIT extends FtpServerTestSupport {
+
+ private String getFtpUrl() {
+ return
"ftp://admin@localhost:{{ftp.server.port}}/upload/linebreak?password=admin";
+ }
+
+ @Test
+ public void testFileNameWithLineBreakIsRefused() throws Exception {
+ CamelExecutionException e = assertThrows(CamelExecutionException.class,
+ () -> template.sendBodyAndHeader("direct:start", "Hello
World", Exchange.FILE_NAME, "before\r\nafter.txt"));
+ GenericFileOperationFailedException cause =
assertIsInstanceOf(GenericFileOperationFailedException.class, e.getCause());
+ assertTrue(cause.getMessage().contains("the character U+000D"),
cause.getMessage());
+
+ assertEquals(List.of(), serverEntriesNamed("before", "after"));
+ }
+
+ @Test
+ public void testDirectoryNameWithLineBreakIsRefused() throws Exception {
+ CamelExecutionException e = assertThrows(CamelExecutionException.class,
+ () -> template.sendBodyAndHeader("direct:start", "Hello
World", Exchange.FILE_NAME, "before\nafter/hello.txt"));
+ assertIsInstanceOf(GenericFileOperationFailedException.class,
e.getCause());
+
+ assertEquals(List.of(), serverEntriesNamed("before", "after"));
+ }
+
+ @Test
+ public void testPlainFileNameIsStored() throws Exception {
+ template.sendBodyAndHeader("direct:start", "Hello World",
Exchange.FILE_NAME, "hello.txt");
+
+ assertEquals("Hello World",
Files.readString(service.ftpFile("upload/linebreak/hello.txt")));
+ }
+
+ private List<Path> serverEntriesNamed(String... parts) throws Exception {
+ try (Stream<Path> entries = Files.walk(service.getFtpRootDir())) {
+ return entries.filter(p -> Stream.of(parts).anyMatch(part ->
p.getFileName().toString().contains(part)))
+ .toList();
+ }
+ }
+
+ @Override
+ protected RouteBuilder createRouteBuilder() {
+ return new RouteBuilder() {
+ @Override
+ public void configure() {
+ from("direct:start").to(getFtpUrl());
+ }
+ };
+ }
+}
diff --git
a/docs/user-manual/modules/ROOT/pages/camel-4x-upgrade-guide-4_18.adoc
b/docs/user-manual/modules/ROOT/pages/camel-4x-upgrade-guide-4_18.adoc
index d0e08af5357e..91b17ada2a78 100644
--- a/docs/user-manual/modules/ROOT/pages/camel-4x-upgrade-guide-4_18.adoc
+++ b/docs/user-manual/modules/ROOT/pages/camel-4x-upgrade-guide-4_18.adoc
@@ -123,6 +123,18 @@ wildcard to select a file, use the real name of the file
in the producer, and th
consumer that lists the directory instead of a wildcard in `fileName` with
`useList=false`. See the
xref:components::sftp-component.adoc[SFTP component].
+=== camel-ftp - ftp and ftps refuse a file or directory name with a carriage
return or a line feed
+
+The `ftp` and `ftps` components now refuse a remote file or directory name
with a carriage return or a line feed, with
+a `GenericFileOperationFailedException`, before they send any command to the
server for it. This applies to the name
+the producer writes (the `CamelFileName` header, `tempFileName`,
`doneFileName` and `moveExisting`), to the directories
+it creates or changes to, and to the names the consumer retrieves, deletes,
renames or lists.
+
+The FTP control connection sends one command per line, so such a name cannot
be sent as one command. Before, the server
+got the name cut at the line break: the operation failed or acted on another
file, and the replies of the later
+commands on that connection could get out of step. Remove or replace these
characters in the name before the producer.
+The `sftp` component is not affected. See the
xref:components::ftp-component.adoc[FTP component].
+
=== camel-file - jailStartingDirectory resolves symbolic links
With `jailStartingDirectory` enabled (the default), the file consumer and
producer now resolve symbolic links when
diff --git
a/docs/user-manual/modules/ROOT/pages/camel-4x-upgrade-guide-4_22.adoc
b/docs/user-manual/modules/ROOT/pages/camel-4x-upgrade-guide-4_22.adoc
index 2248d2a052e3..17405c7e612b 100644
--- a/docs/user-manual/modules/ROOT/pages/camel-4x-upgrade-guide-4_22.adoc
+++ b/docs/user-manual/modules/ROOT/pages/camel-4x-upgrade-guide-4_22.adoc
@@ -156,6 +156,18 @@ wildcard to select a file, use the real name of the file
in the producer, and th
consumer that lists the directory instead of a wildcard in `fileName` with
`useList=false`. See the
xref:components::sftp-component.adoc[SFTP component].
+=== camel-ftp - ftp and ftps refuse a file or directory name with a carriage
return or a line feed
+
+The `ftp` and `ftps` components now refuse a remote file or directory name
with a carriage return or a line feed, with
+a `GenericFileOperationFailedException`, before they send any command to the
server for it. This applies to the name
+the producer writes (the `CamelFileName` header, `tempFileName`,
`doneFileName` and `moveExisting`), to the directories
+it creates or changes to, and to the names the consumer retrieves, deletes,
renames or lists.
+
+The FTP control connection sends one command per line, so such a name cannot
be sent as one command. Before, the server
+got the name cut at the line break: the operation failed or acted on another
file, and the replies of the later
+commands on that connection could get out of step. Remove or replace these
characters in the name before the producer.
+The `sftp` component is not affected. See the
xref:components::ftp-component.adoc[FTP component].
+
=== camel-file - the consumer skips a file it would move through a symbolic
link resolving outside the starting directory
With `jailStartingDirectory` enabled (the default), the file consumer now
resolves symbolic links on the targets of
diff --git
a/docs/user-manual/modules/ROOT/pages/camel-4x-upgrade-guide-4_24.adoc
b/docs/user-manual/modules/ROOT/pages/camel-4x-upgrade-guide-4_24.adoc
index 1da36cc0581d..a9f062ac8abf 100644
--- a/docs/user-manual/modules/ROOT/pages/camel-4x-upgrade-guide-4_24.adoc
+++ b/docs/user-manual/modules/ROOT/pages/camel-4x-upgrade-guide-4_24.adoc
@@ -423,6 +423,18 @@ the `include` or `antInclude` option.
See the xref:components::sftp-component.adoc[SFTP component].
+=== camel-ftp - ftp and ftps refuse a file or directory name with a carriage
return or a line feed
+
+The `ftp` and `ftps` components now refuse a remote file or directory name
with a carriage return or a line feed, with
+a `GenericFileOperationFailedException`, before they send any command to the
server for it. This applies to the name
+the producer writes (the `CamelFileName` header, `tempFileName`,
`doneFileName` and `moveExisting`), to the directories
+it creates or changes to, and to the names the consumer retrieves, deletes,
renames or lists.
+
+The FTP control connection sends one command per line, so such a name cannot
be sent as one command. Before, the server
+got the name cut at the line break: the operation failed or acted on another
file, and the replies of the later
+commands on that connection could get out of step. Remove or replace these
characters in the name before the producer.
+The `sftp` component is not affected. See the
xref:components::ftp-component.adoc[FTP component].
+
=== camel-ftp - a directory listing the server refuses fails the poll
The `ftp` and `ftps` consumers now fail the poll when the server refuses the
listing of a directory, for example the