This is an automated email from the ASF dual-hosted git repository.

jaikiran pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/ant.git


The following commit(s) were added to refs/heads/master by this push:
     new 06efb4baf 68773: ftp - issue PBSZ command before PROT
06efb4baf is described below

commit 06efb4bafca14659b236a8a2955f7bee13a01a07
Author: Jaikiran Pai <[email protected]>
AuthorDate: Sun May 5 17:06:03 2024 +0530

    68773: ftp - issue PBSZ command before PROT
---
 src/main/org/apache/tools/ant/taskdefs/optional/net/FTP.java | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/src/main/org/apache/tools/ant/taskdefs/optional/net/FTP.java 
b/src/main/org/apache/tools/ant/taskdefs/optional/net/FTP.java
index d435a355a..eee4f8210 100644
--- a/src/main/org/apache/tools/ant/taskdefs/optional/net/FTP.java
+++ b/src/main/org/apache/tools/ant/taskdefs/optional/net/FTP.java
@@ -2590,6 +2590,10 @@ public class FTP extends Task implements FTPTaskConfig {
             if (useFtps && useSecureDataChannel) {
                 FTPSClient ftps = (FTPSClient) ftp;
                 try {
+                    // first issue a PBSZ command as mandated by RFC-2228.
+                    // we set 0 because the buffer size is redundant since the 
encryption
+                    // is handled at TLS layer and not application layer
+                    ftps.execPBSZ(0);
                     ftps.execPROT("P"); // P implies PRIVATE and enables 
encryption
                 } catch (IOException e) {
                     throw new BuildException("failed to enable secure data 
channel: " + e, e);

Reply via email to