Skip to content

Commit

Permalink
68773: ftp - issue PBSZ command before PROT
Browse files Browse the repository at this point in the history
  • Loading branch information
jaikiran committed May 5, 2024
1 parent bdf6df5 commit 06efb4b
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/main/org/apache/tools/ant/taskdefs/optional/net/FTP.java
Original file line number Diff line number Diff line change
Expand Up @@ -2590,6 +2590,10 @@ public void execute() throws BuildException {
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);
Expand Down

0 comments on commit 06efb4b

Please sign in to comment.