关于3CDaemon的FTP服务端异常

最近在做FTP的代理程序,发现3CDaemon的FTP服务端在回复客户端的退出请求(QUIT)时,其Response Arg数据没有正确的结束标志:\r\n。除此QUIT命令外,其它的控制请求命令(USER、PASS等)都能得到正确的回复,回复消息的Response Arg数据都是以\r\n结束。如下wireshark的截图,QUIT命令的回复以空格字符(0x20)结束。

关于3CDaemon的FTP服务端异常

这对FTP客户端影响不大,因为QUIT命令之后服务端和客户端之间的连接马上就断开了,不存在异常情况,只是在回显服务端相应时没有换行,如下导致回显内容和之后的命令提示符在同一行显示。但是作为FTP代理服务需要注意就不能够以\r\n字段来判读获取响应消息了。

[email protected]:~$ ftp 192.168.1.108
Connected to 192.168.1.108.
220 3Com 3CDaemon FTP .0    
Name (192.168.1.108:kernel): 
331 ȷ,        
Password:
230 ¼    
Remote system type is UNIX.
ftp> bye
221                     [email protected]:~$ 
[email protected]:~$ 

使用Filezilla作为FTP服务端,如下可见,所有请求的回复消息都可以正常的显示,对比以上的3CDaemon,其响应消息其实都是乱码:

[email protected]:~$ ftp 192.168.1.108
Connected to 192.168.1.108.
220-FileZilla Server 0.9.60 beta
220-written by Tim Kosse ([email protected]g)
220 Please visit https://filezilla-project.org/
Name (192.168.1.108:kernel): 
331 Password required for kernel
Password:
230 Logged on
Remote system type is UNIX.
ftp> 
ftp> bye
221 Goodbye
[email protected]:~$

完。