Hello,

I am wondering is there any plan for full RFC2228 commands support? At the 
moment, there are just 3 commands implemented (AUTH, PROT and PBZS).

I need to have CCC command supported, so I tried to implement it by myself. 
Basically, what I did is following (Scala code)

session.resetState()
session.setAttribute(SslFilter.SESSION_UNSECURED)
session.getDataConnection.setSecure(false)
session.write(LocalizedFtpReply.translate(session, request, context, 
FtpReply.REPLY_200_COMMAND_OKAY, "CCC", null))
And everything seemed fine at first, but it seems that nothing is replied to 
any other further command received. In this exact case, the PASV command is 
received and it seems its execute method runs and finishes fine (I have even 
override it to add some more logging to prove that the whole methods is 
executed, i.e. it does not stuck anywhere, and that session.write call at the 
end is also executed. And that seems to be true. But, there is no SENT: 200 in 
the log after that. Please find the log below. The log lines from logger 
c.a.a.b are the logging added to overridden PASV command. I am wondering why 
there is no log entry for sent response to PASV, something like SENT: 227?

2018-06-20 05:26:10.220UTC [INFO  o.a.ftpserver.listener.nio.FtpLoggingFilter] 
CREATED
2018-06-20 05:26:10.221UTC [INFO  o.a.ftpserver.listener.nio.FtpLoggingFilter] 
OPENED
2018-06-20 05:26:10.223UTC [INFO  o.a.ftpserver.listener.nio.FtpLoggingFilter] 
SENT: 220 Service ready for new user.

2018-06-20 05:26:10.229UTC [INFO  o.a.ftpserver.listener.nio.FtpLoggingFilter] 
RECEIVED: AUTH TLS
2018-06-20 05:26:10.285UTC [INFO  o.a.ftpserver.listener.nio.FtpLoggingFilter] 
SENT: 234 Command AUTH okay; starting TLS connection.

2018-06-20 05:26:10.478UTC [INFO  o.a.ftpserver.listener.nio.FtpLoggingFilter] 
RECEIVED: PBSZ 0
2018-06-20 05:26:10.480UTC [INFO  o.a.ftpserver.listener.nio.FtpLoggingFilter] 
SENT: 200 Command PBSZ okay.

2018-06-20 05:26:10.481UTC [INFO  o.a.ftpserver.listener.nio.FtpLoggingFilter] 
RECEIVED: PROT P
2018-06-20 05:26:10.483UTC [INFO  o.a.ftpserver.listener.nio.FtpLoggingFilter] 
SENT: 200 Command PROT okay.

2018-06-20 05:26:10.484UTC [INFO  o.a.ftpserver.listener.nio.FtpLoggingFilter] 
RECEIVED: USER ja
2018-06-20 05:26:10.484UTC [DEBUG org.apache.ftpserver.command.impl.USER] 
Currently 0 out of 10 anonymous users logged in
2018-06-20 05:26:10.485UTC [DEBUG org.apache.ftpserver.command.impl.USER] 
Currently 0 out of 10 users logged in
2018-06-20 05:26:10.486UTC [INFO  o.a.ftpserver.listener.nio.FtpLoggingFilter] 
SENT: 331 User name okay, need password for ja.

2018-06-20 05:26:10.488UTC [INFO  o.a.ftpserver.listener.nio.FtpLoggingFilter] 
RECEIVED: PASS *****
2018-06-20 05:26:10.488UTC [DEBUG org.apache.ftpserver.command.impl.PASS] 
Currently 0 out of 10 users logged in
2018-06-20 05:26:10.489UTC [DEBUG o.a.f.f.nativefs.impl.NativeFileSystemView] 
Native filesystem view created for user "ja" with root "C:/Users/ja/"
2018-06-20 05:26:10.490UTC [INFO  org.apache.ftpserver.command.impl.PASS] Login 
success - ja
2018-06-20 05:26:10.490UTC [INFO  o.a.ftpserver.listener.nio.FtpLoggingFilter] 
SENT: 230 User logged in, proceed.

2018-06-20 05:26:10.492UTC [INFO  o.a.ftpserver.listener.nio.FtpLoggingFilter] 
RECEIVED: TYPE I
2018-06-20 05:26:10.493UTC [INFO  o.a.ftpserver.listener.nio.FtpLoggingFilter] 
SENT: 200 Command TYPE okay.

2018-06-20 05:26:10.495UTC [INFO  o.a.ftpserver.listener.nio.FtpLoggingFilter] 
RECEIVED: CCC  
2018-06-20 05:26:10.497UTC [INFO  o.a.ftpserver.listener.nio.FtpLoggingFilter] 
SENT: 200 [My implementation of CCC returned this]

2018-06-20 05:26:10.519UTC [INFO  o.a.ftpserver.listener.nio.FtpLoggingFilter] 
RECEIVED: PASV
2018-06-20 05:26:10.519UTC [DEBUG o.a.ftpserver.impl.IODataConnectionFactory] 
Initiating passive data connection
2018-06-20 05:26:10.520UTC [DEBUG o.a.ftpserver.impl.IODataConnectionFactory] 
Opening passive data connection on address "/192.168.0.1" and port 0
2018-06-20 05:26:10.520UTC [DEBUG o.a.ftpserver.impl.IODataConnectionFactory] 
Passive data connection created on address "/192.168.0.1" and port 0
2018-06-20 05:26:10.520UTC [INFO  c.a.a.b] Data conn address: 192.168.0.1
2018-06-20 05:26:10.520UTC [INFO  c.a.a.b] Server address: 192.168.0.1
2018-06-20 05:26:10.521UTC [INFO  c.a.a.b] External address: 192.168.0.1
2018-06-20 05:26:10.521UTC [INFO  c.a.a.b] External address string: 
192,168,0,1,227,90
2018-06-20 05:26:10.521UTC [INFO  c.a.a.b] Replied to client: 227
2018-06-20 05:26:10.531UTC [INFO  o.a.ftpserver.listener.nio.FtpLoggingFilter] 
RECEIVED: LIST file/packcfg.xml
2018-06-20 05:26:10.533UTC [DEBUG o.a.ftpserver.impl.IODataConnectionFactory] 
Opening passive data connection
2018-06-20 05:26:10.535UTC [DEBUG o.a.ftpserver.impl.IODataConnectionFactory] 
Passive data connection opened
2018-06-20 05:26:10.536UTC [DEBUG o.a.f.filesystem.nativefs.impl.NativeFtpFile] 
Checking authorization for /files/packcfg.xml
2018-06-20 05:26:10.536UTC [DEBUG o.a.f.filesystem.nativefs.impl.NativeFtpFile] 
Checking if file exists
2018-06-20 05:26:10.536UTC [DEBUG o.a.f.filesystem.nativefs.impl.NativeFtpFile] 
Checking can write: true
2018-06-20 05:26:10.537UTC [WARN  org.apache.ftpserver.impl.PassivePorts] 
Releasing unreserved passive port: 58202
2018-06-20 05:26:10.544UTC [INFO  o.a.ftpserver.listener.nio.FtpLoggingFilter] 
RECEIVED: PASV
2018-06-20 05:26:10.545UTC [DEBUG o.a.ftpserver.impl.IODataConnectionFactory] 
Initiating passive data connection
2018-06-20 05:26:10.545UTC [DEBUG o.a.ftpserver.impl.IODataConnectionFactory] 
Opening passive data connection on address "/192.168.0.1" and port 0
2018-06-20 05:26:10.545UTC [DEBUG o.a.ftpserver.impl.IODataConnectionFactory] 
Passive data connection created on address "/192.168.0.1" and port 0
2018-06-20 05:26:10.546UTC [INFO  c.a.a.b] Data conn address: 192.168.0.1
2018-06-20 05:26:10.546UTC [INFO  c.a.a.b] Server address: 192.168.0.1
2018-06-20 05:26:10.546UTC [INFO  c.a.a.b] External address: 192.168.0.1
2018-06-20 05:26:10.546UTC [INFO  c.a.a.b] External address string: 
192,168,0,1,227,91
2018-06-20 05:26:10.546UTC [INFO  c.a.a.b] Replied to client: 227
2018-06-20 05:26:10.549UTC [INFO  o.a.ftpserver.listener.nio.FtpLoggingFilter] 
RECEIVED: ABORT

Best regards,
Tomislav Haramustek

Reply via email to