[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

ftp: RFC 2228 (PROT) broken



Hello,

The 0.3c version of ftp appears to be broken when it comes to the data
protection extensions, e.g.

  ftp> prot data private
  S:200 Data protection is private.
  ftp> ls
  S:150 Opening ASCII mode data connection for '/bin/ls'.
  421 Service not available, remote server has closed connection

Is there anyone out there using this functionality (encrypted ftp)
successfully?

This appears to be a simple bug in security.c:sec_read.  With the
following patch SAFE and PRIVATE data protection works correctly for me.
I haven't checked to see when this bug was introduced. 

--- appl/ftp/ftp/security.c.orig	Sun Feb  6 21:11:43 2000
+++ appl/ftp/ftp/security.c	Fri Nov  3 10:11:47 2000
@@ -237,7 +237,7 @@
 	ret = sec_get_data(fd, &in_buffer, data_prot);
 	if (ret < 0)
 	    return -1;
-	if(ret == 0 || in_buffer.size == 0) {
+	if(ret == 0 && in_buffer.size == 0) {
 	    if(rx)
 		in_buffer.eof_flag = 1;
 	    return rx;


Cheers,
-- 
Jacques Vidrine / n@nectar.com / jvidrine@verio.net / nectar@FreeBSD.org