Hello,

I am looking to provide a good unix ftps client for our users, since they will  
have to upload their personal web pages to our web server through ftps. As 
far as I can see, from a feature point-of-view, lftp is the only real choice. 
The scripting and mirroring features are indispensable, and the rest of lftp 
is great too :-)

Unfortunately I have been having trouble getting lftp (debian packages: 
3.3.2-1 w/ gnutls 1.2.6-1) and proftpd (1.2.10 on Solaris) to play nice 
together.

At first I was getting gnutls errors about unexpected ssl lengths. As it 
turned out this was a configuration problem, since proftpd was not using TLS 
on the data channel while in lftp ftp:ssl-protect-list defaults to yes.

After setting ftp:ssl-protect-list to 'no' I got the following error when 
doing 'nlist' on a empty directory:

lftp [EMAIL PROTECTED]:/emptydir> nlist
---> CWD /emptydir
<--- 250 CWD command successful
---> PASV
<--- 227 Entering Passive Mode (XXX,XXX,XXX,XXX,254,248).
---- Connecting data socket to (XXX.XXX.XXX.XXX) port 65272
---- Data connection established
---> NLST
**** data-socket: Connection reset by peer
---- Closing data socket
---- Closing control socket
---- Connecting to proftpdhost (XXX.XXX.XXX.XXX) port 21
(... lftp retries and fails again)

In the source code you have a workaround for the case where proftpd would 
return a 450 error when you NLST a empty directory. In the case above though, 
it seems that lftp decides to call DisconnectNow() when the data socket is 
reset (which happens because proftpd writes nothing to the data socket and 
just returns 450). This totally breaks mirroring so I've found a small 
workaround, which I've attached as a patch against the lftp-3.3.2 source 
code. With the patch applied I get the following correct behaviour:

lftp [EMAIL PROTECTED]:/emptydir> nlist
---> CWD /emptydir
<--- 250 CWD command successful
---> PASV
<--- 227 Entering Passive Mode (XXX,XXX,XXX,XXX,254,115).
---- Connecting data socket to (XXX.XXX.XXX.XXX) port 65139
---- Data connection established
---> NLST
<--- 450 No files found
---- Closing data socket
lftp [EMAIL PROTECTED]:/emptydir>

I would appreciate it if you would let me know about any limitations or 
problems the workaround might have.

Thank you,
Kostantinos Koukopoulos
diff -Naur lftp-3.3.2/src/ftpclass.cc lftp-3.3.2-patched/src/ftpclass.cc
--- lftp-3.3.2/src/ftpclass.cc	2005-10-01 22:45:14.000000000 +0300
+++ lftp-3.3.2-patched/src/ftpclass.cc	2005-10-19 15:40:48.000000000 +0300
@@ -2194,7 +2194,10 @@
          return MOVED;
 
       BumpEventTime(conn->data_iobuf->EventTime());
-      if(conn->data_iobuf->Error())
+      if(conn->data_iobuf->Error()
+            && !(mode == LIST 
+               && !conn->data_iobuf->Size()
+               && !conn->data_iobuf->Eof()))
       {
 	 DebugPrint("**** ",conn->data_iobuf->ErrorText(),0);
 	 if(conn->data_iobuf->ErrorFatal())

Reply via email to