Re: lftp-3.0.4 always tries to issue CPSV command when doing secure FXP with SSCN-enabled server

Roboco Sanchez <[email protected]>
Newsgroups gmane.network.lftp.devel
Message-ID <[email protected]>
Thanks for the patch. I had to modify is4xx to is4XX
to get it compiled. I have the log below. It now works
but only in the first case (set ftp:fxp-passive-sscn
no) and not the other (set ftp:fxp-passive-sscn yes -
the default setting). Not sure if that's what it
should be.

I'll try asking Raiden team about FEAT.

Also will test with set ftp:fxp-passive-source yes
later when a friend's server (where there is no
firewall) is up.

Cheers,
Rob.

[C:\Temp]lftp
lftp :~> version
Lftp | Version 3.0.5rc2 | Copyright (c) 1996-2004
Alexander V. Lukyanov
This is free software with ABSOLUTELY NO WARRANTY. See
COPYING for details.
Send bug reports and questions to <[email protected]>.
lftp :~> debug -c 20
lftp :~> set ftp:fxp-passive-source no
lftp :~> set ftp:ssl-protect-fxp yes
lftp :~> set ftp:fxp-passive-sscn no
lftp :~> mirror -vv
ftp://anonymous:lftp@@ftp.smartftp.com/Common/InstMsi
ftps://upload:[email protected]:2121/InstMsi
ftp.smartftp.com ---- Resolving host address...
ftp.smartftp.com ---- 1 address found
ftp.smartftp.com ---- Connecting to ftp.smartftp.com
(213.144.155.6) port 21
ftp.smartftp.com <--- 220-SmartFTP Server
ftp.smartftp.com <--- 220 service ready
ftp.smartftp.com ---> FEAT
ftp.smartftp.com <--- 503 Bad sequence of commands.
ftp.smartftp.com ---> AUTH TLS
ftp.smartftp.com <--- 234 Negotiating secure
session...
ftp.smartftp.com ---> USER anonymous
Certificate depth: 0; subject:
/CN=smartftp.com/[email protected]/O=SmartFTP/OU=HQ/L=\x00Z\x00\xFC\x00r\x00
i\x00c\x00h/ST=ZH/C=CH; issuer:
/CN=smartftp.com/[email protected]/O=SmartFTP/OU=HQ/L=\x00Z\x00\xFC\x00r\x0
0i\x00c\x00h/ST=ZH/C=CH
WARNING: Certificate verification: unable to get local
issuer certificate
WARNING: Certificate verification: unable to verify
the first certificate
ftp.smartftp.com <--- 331 User name okay, need
password.
ftp.smartftp.com ---> PASS XXXX
ftp.smartftp.com <--- 230 User logged in, proceed.
ftp.smartftp.com ---> FEAT
ftp.smartftp.com <--- 211-Extensions supported:
ftp.smartftp.com <---  SIZE
ftp.smartftp.com <---  REST
ftp.smartftp.com <---  MDTM
ftp.smartftp.com <---  AUTH TLS
ftp.smartftp.com <---  AUTH SSL
ftp.smartftp.com <---  PBSZ
ftp.smartftp.com <---  PROT
ftp.smartftp.com <---  CLNT
ftp.smartftp.com <---  SSCN
ftp.smartftp.com <---  XCRC
ftp.smartftp.com <---  EPRT
ftp.smartftp.com <---  EPSV
ftp.smartftp.com <---  MLST
type*;size*;modify*;create*;perm*;unix.owner;unix.group;windows.lastaccesstime;
ftp.smartftp.com <--- 211 END
ftp.smartftp.com ---> PWD
ftp.smartftp.com <--- 257 "/" is the current directory
ftp.smartftp.com ---> PBSZ 0
ftp.smartftp.com <--- 200 Command okay.
ftp.smartftp.com ---> CLNT lftp/3.0.5rc2
ftp.smartftp.com <--- 200 Noted.
ftp.smartftp.com ---> OPTS MLST
type;size;modify;perm;unix.owner;unix.group;
ftp.smartftp.com <--- 200 MLST OPTS
type;size;modify;perm;unix.owner;unix.group;
ftp.smartftp.com ---> CWD /Common/InstMsi
ftp.smartftp.com <--- 250 Requested file action okay,
completed.
111.111.111.111 ---- Resolving host address...
111.111.111.111 ---- 1 address found
111.111.111.111 ---- Connecting to 111.111.111.111
(111.111.111.111) port 2121
Certificate depth: 0; subject:
/CN=Serv-V/L=Washington/ST=DC/O=Serv-V
Incoporated/C=US/[email protected]/OU=George
 Town; issuer: /CN=Serv-V/L=Washington/ST=DC/O=Serv-V
Incoporated/C=US/[email protected]/OU=George
Town
WARNING: Certificate verification: self signed
certificate
111.111.111.111 <--- 220 Serv-U FTP Server v4.0 for
WinSock ready...
111.111.111.111 ---> FEAT
111.111.111.111 <--- 211-Extension supported
111.111.111.111 <---  AUTH TLS
111.111.111.111 <---  PBSZ
111.111.111.111 <---  PROT
111.111.111.111 <---  MDTM
111.111.111.111 <---  MDTM YYYYMMDDHHMMSS[+-TZ]
filename
111.111.111.111 <---  SIZE
111.111.111.111 <---  SITE
PSWD;EXEC;SET;INDEX;ZONE;CHMOD;MSG
111.111.111.111 <---  REST STREAM
111.111.111.111 <--- 211 End
111.111.111.111 ---> USER upload
111.111.111.111 <--- 331 User name okay, need
password.
111.111.111.111 ---> PASS XXXX
111.111.111.111 <--- 230 User logged in, proceed.
111.111.111.111 ---> PWD
111.111.111.111 <--- 257 "/" is current directory.
111.111.111.111 ---> PBSZ 0
111.111.111.111 <--- 200 PBSZ command OK. Protection
buffer size set to 0.
111.111.111.111 ---> TYPE I
111.111.111.111 <--- 200 Type set to I.
111.111.111.111 ---> MKD /InstMsi
111.111.111.111 <--- 257 "/InstMsi" directory created.
111.111.111.111 ---> CWD /InstMsi
111.111.111.111 <--- 250 Directory changed to /InstMsi
---> PROT P
---> TYPE A
111.111.111.111 <--- 200 Type set to A.
111.111.111.111 ---> PASV
ftp.smartftp.com <--- 200 Command okay.
ftp.smartftp.com ---> PASV
111.111.111.111 <--- 227 Entering Passive Mode
(111,111,111,111,23,165)
111.111.111.111 ---- Connecting data socket to
(111.111.111.111) port 6053
111.111.111.111 ---> LIST
ftp.smartftp.com <--- 227 Entering Passive Mode
(213,144,155,6,62,191)
ftp.smartftp.com ---- Connecting data socket to
(213.144.155.6) port 16063
ftp.smartftp.com ---> LIST
111.111.111.111 <--- 150 Opening ASCII mode data
connection for /bin/ls.
111.111.111.111 <--- 226 Transfer complete.
111.111.111.111 ---- Closing data socket
ftp.smartftp.com <--- 150 File status okay; about to
open data connection.
Certificate depth: 0; subject:
/CN=smartftp.com/[email protected]/O=SmartFTP/OU=HQ/L=\x00Z\x00\xFC\x00r\x00
i\x00c\x00h/ST=ZH/C=CH; issuer:
/CN=smartftp.com/[email protected]/O=SmartFTP/OU=HQ/L=\x00Z\x00\xFC\x00r\x0
0i\x00c\x00h/ST=ZH/C=CH
WARNING: Certificate verification: unable to get local
issuer certificate
WARNING: Certificate verification: unable to verify
the first certificate
ftp.smartftp.com <--- 226 Closing data connection.
Transfer Complete (165 bytes)
ftp.smartftp.com ---- Closing data socket
ftp.smartftp.com ---> TYPE I
ftp.smartftp.com <--- 200 Command okay.
ftp.smartftp.com ---> MDTM INSTMSIA.EXE
ftp.smartftp.com <--- 213 20020127221452
ftp.smartftp.com ---> MDTM INSTMSIW.EXE
ftp.smartftp.com <--- 213 20020127221930
Transferring file `INSTMSIA.EXE'
111.111.111.111 ---> TYPE I
ftp.smartftp.com ---> SSCN ON
111.111.111.111 <--- 200 Type set to I.
111.111.111.111 ---> PASV
111.111.111.111 <--- 227 Entering Passive Mode
(111,111,111,111,23,156)
ftp.smartftp.com <--- 200 SSCN: CLIENT METHOD.
ftp.smartftp.com ---> PORT 111,111,111,111,23,156
ftp.smartftp.com <--- 200 Command okay.
111.111.111.111 ---> STOR INSTMSIA.EXE
ftp.smartftp.com ---> RETR INSTMSIA.EXE
ftp.smartftp.com <--- 150 File status okay; about to
open data connection.
111.111.111.111 <--- 150 Opening BINARY mode data
connection for INSTMSIA.EXE.
ftp.smartftp.com <--- 226 Closing data connection.
Transfer Complete (1710061 bytes)
111.111.111.111 <--- 226 Transfer complete.
copy: get hit eof
copy: waiting for put confirmation
copy: put confirmed store
copy: get is finished - all done
Transferring file `INSTMSIW.EXE'
111.111.111.111 ---> PASV
111.111.111.111 <--- 227 Entering Passive Mode
(111,111,111,111,23,157)
ftp.smartftp.com ---> PORT 111,111,111,111,23,157
ftp.smartftp.com <--- 200 Command okay.
111.111.111.111 ---> STOR INSTMSIW.EXE
ftp.smartftp.com ---> RETR INSTMSIW.EXE
ftp.smartftp.com <--- 150 File status okay; about to
open data connection.
111.111.111.111 <--- 150 Opening BINARY mode data
connection for INSTMSIW.EXE.
ftp.smartftp.com <--- 226 Closing data connection.
Transfer Complete (1823360 bytes)
111.111.111.111 <--- 226 Transfer complete.
copy: get hit eof
copy: waiting for put confirmation
copy: put confirmed store
copy: get is finished - all done
111.111.111.111 ---> SITE CHMOD 700 INSTMSIA.EXE
111.111.111.111 <--- 253 Attributes changed okay.
111.111.111.111 ---> SITE CHMOD 700 INSTMSIW.EXE
111.111.111.111 <--- 253 Attributes changed okay.
Total: 1 directory, 2 files, 0 symlinks
New: 2 files, 0 symlinks
lftp :~> quit
ftp.smartftp.com ---> QUIT
ftp.smartftp.com ---- Closing control socket
111.111.111.111 ---> QUIT
111.111.111.111 ---- Closing control socket

[C:\Temp]lftp
lftp :~> version
Lftp | Version 3.0.5rc2 | Copyright (c) 1996-2004
Alexander V. Lukyanov
This is free software with ABSOLUTELY NO WARRANTY. See
COPYING for details.
Send bug reports and questions to <[email protected]>.
lftp :~> debug -c 20
lftp :~> set ftp:fxp-passive-source no
lftp :~> set ftp:ssl-protect-fxp yes
lftp :~> set ftp:fxp-passive-sscn yes
lftp :~> mirror -vv
ftp://anonymous:lftp@@ftp.smartftp.com/Common/InstMsi
ftps://upload:[email protected]:2121/InstMsi
ftp.smartftp.com ---- Resolving host address...
ftp.smartftp.com ---- 1 address found
ftp.smartftp.com ---- Connecting to ftp.smartftp.com
(213.144.155.6) port 21
ftp.smartftp.com <--- 220-SmartFTP Server
ftp.smartftp.com <--- 220 service ready
ftp.smartftp.com ---> FEAT
ftp.smartftp.com <--- 503 Bad sequence of commands.
ftp.smartftp.com ---> AUTH TLS
ftp.smartftp.com <--- 234 Negotiating secure
session...
ftp.smartftp.com ---> USER anonymous
Certificate depth: 0; subject:
/CN=smartftp.com/[email protected]/O=SmartFTP/OU=HQ/L=\x00Z\x00\xFC\x00r\x00
i\x00c\x00h/ST=ZH/C=CH; issuer:
/CN=smartftp.com/[email protected]/O=SmartFTP/OU=HQ/L=\x00Z\x00\xFC\x00r\x0
0i\x00c\x00h/ST=ZH/C=CH
WARNING: Certificate verification: unable to get local
issuer certificate
WARNING: Certificate verification: unable to verify
the first certificate
ftp.smartftp.com <--- 331 User name okay, need
password.
ftp.smartftp.com ---> PASS XXXX
ftp.smartftp.com <--- 230 User logged in, proceed.
ftp.smartftp.com ---> FEAT
ftp.smartftp.com <--- 211-Extensions supported:
ftp.smartftp.com <---  SIZE
ftp.smartftp.com <---  REST
ftp.smartftp.com <---  MDTM
ftp.smartftp.com <---  AUTH TLS
ftp.smartftp.com <---  AUTH SSL
ftp.smartftp.com <---  PBSZ
ftp.smartftp.com <---  PROT
ftp.smartftp.com <---  CLNT
ftp.smartftp.com <---  SSCN
ftp.smartftp.com <---  XCRC
ftp.smartftp.com <---  EPRT
ftp.smartftp.com <---  EPSV
ftp.smartftp.com <---  MLST
type*;size*;modify*;create*;perm*;unix.owner;unix.group;windows.lastaccesstime;
ftp.smartftp.com <--- 211 END
ftp.smartftp.com ---> PWD
ftp.smartftp.com <--- 257 "/" is the current directory
ftp.smartftp.com ---> PBSZ 0
ftp.smartftp.com <--- 200 Command okay.
ftp.smartftp.com ---> CLNT lftp/3.0.5rc2
ftp.smartftp.com <--- 200 Noted.
ftp.smartftp.com ---> OPTS MLST
type;size;modify;perm;unix.owner;unix.group;
ftp.smartftp.com <--- 200 MLST OPTS
type;size;modify;perm;unix.owner;unix.group;
ftp.smartftp.com ---> CWD /Common/InstMsi
ftp.smartftp.com <--- 250 Requested file action okay,
completed.
111.111.111.111 ---- Resolving host address...
111.111.111.111 ---- 1 address found
111.111.111.111 ---- Connecting to 111.111.111.111
(111.111.111.111) port 2121
Certificate depth: 0; subject:
/CN=Serv-V/L=Washington/ST=DC/O=Serv-V
Incoporated/C=US/[email protected]/OU=George
 Town; issuer: /CN=Serv-V/L=Washington/ST=DC/O=Serv-V
Incoporated/C=US/[email protected]/OU=George
Town
WARNING: Certificate verification: self signed
certificate
111.111.111.111 <--- 220 Serv-U FTP Server v4.0 for
WinSock ready...
111.111.111.111 ---> FEAT
111.111.111.111 <--- 211-Extension supported
111.111.111.111 <---  AUTH TLS
111.111.111.111 <---  PBSZ
111.111.111.111 <---  PROT
111.111.111.111 <---  MDTM
111.111.111.111 <---  MDTM YYYYMMDDHHMMSS[+-TZ]
filename
111.111.111.111 <---  SIZE
111.111.111.111 <---  SITE
PSWD;EXEC;SET;INDEX;ZONE;CHMOD;MSG
111.111.111.111 <---  REST STREAM
111.111.111.111 <--- 211 End
111.111.111.111 ---> USER upload
111.111.111.111 <--- 331 User name okay, need
password.
111.111.111.111 ---> PASS XXXX
111.111.111.111 <--- 230 User logged in, proceed.
111.111.111.111 ---> PWD
111.111.111.111 <--- 257 "/" is current directory.
111.111.111.111 ---> PBSZ 0
111.111.111.111 <--- 200 PBSZ command OK. Protection
buffer size set to 0.
111.111.111.111 ---> TYPE I
111.111.111.111 <--- 200 Type set to I.
111.111.111.111 ---> MKD /InstMsi
111.111.111.111 <--- 257 "/InstMsi" directory created.
111.111.111.111 ---> CWD /InstMsi
111.111.111.111 <--- 250 Directory changed to /InstMsi
---> PROT P
---> TYPE A
111.111.111.111 <--- 200 Type set to A.
111.111.111.111 ---> PASV
111.111.111.111 <--- 227 Entering Passive Mode
(111,111,111,111,23,158)
111.111.111.111 ---- Connecting data socket to
(111.111.111.111) port 6046
ftp.smartftp.com <--- 200 Command okay.
ftp.smartftp.com ---> PASV
111.111.111.111 ---> LIST
111.111.111.111 <--- 150 Opening ASCII mode data
connection for /bin/ls.
ftp.smartftp.com <--- 227 Entering Passive Mode
(213,144,155,6,62,181)
ftp.smartftp.com ---- Connecting data socket to
(213.144.155.6) port 16053
ftp.smartftp.com ---> LIST
111.111.111.111 <--- 226 Transfer complete.
ftp.smartftp.com <--- 150 File status okay; about to
open data connection.
111.111.111.111 ---- Closing data socket
Certificate depth: 0; subject:
/CN=smartftp.com/[email protected]/O=SmartFTP/OU=HQ/L=\x00Z\x00\xFC\x00r\x00
i\x00c\x00h/ST=ZH/C=CH; issuer:
/CN=smartftp.com/[email protected]/O=SmartFTP/OU=HQ/L=\x00Z\x00\xFC\x00r\x0
0i\x00c\x00h/ST=ZH/C=CH
WARNING: Certificate verification: unable to get local
issuer certificate
WARNING: Certificate verification: unable to verify
the first certificate
ftp.smartftp.com <--- 226 Closing data connection.
Transfer Complete (165 bytes)
ftp.smartftp.com ---- Closing data socket
ftp.smartftp.com ---> TYPE I
ftp.smartftp.com <--- 200 Command okay.
ftp.smartftp.com ---> MDTM INSTMSIA.EXE
ftp.smartftp.com <--- 213 20020127221452
ftp.smartftp.com ---> MDTM INSTMSIW.EXE
ftp.smartftp.com <--- 213 20020127221930
Transferring file `INSTMSIA.EXE'
111.111.111.111 ---> TYPE I
111.111.111.111 <--- 200 Type set to I.
111.111.111.111 ---> CPSV
111.111.111.111 <--- 500 'CPSV': command not
understood.
**** FXP: trying to reverse ftp:fxp-passive-source
111.111.111.111 ---> SIZE INSTMSIA.EXE
111.111.111.111 <--- 550 /InstMsi/INSTMSIA.EXE: No
such file.
ftp.smartftp.com ---> SSCN ON
ftp.smartftp.com <--- 200 SSCN: CLIENT METHOD.
ftp.smartftp.com ---> PASV
ftp.smartftp.com <--- 227 Entering Passive Mode
(213,144,155,6,62,153)
ftp.smartftp.com ---> RETR INSTMSIA.EXE
111.111.111.111 ---> PORT 213,144,155,6,62,153
111.111.111.111 <--- 200 PORT Command successful.
111.111.111.111 ---> STOR INSTMSIA.EXE
111.111.111.111 <--- 150 Opening BINARY mode data
connection for INSTMSIA.EXE.
ftp.smartftp.com <--- 150 File status okay; about to
open data connection.
ftp.smartftp.com <--- 425 Timeout occurred while
waiting for PASV connection to be established [REF:
90D7D8D9494D]
---> ABOR
ftp.smartftp.com ---> PASV
111.111.111.111 <--- 426 Data connection closed,
receive file INSTMSIA.EXE aborted.
111.111.111.111 <--- 226 ABOR command successful.
ftp.smartftp.com <--- 227 Entering Passive Mode
(213,144,155,6,62,133)
ftp.smartftp.com ---> RETR INSTMSIA.EXE
111.111.111.111 ---> PORT 213,144,155,6,62,133
111.111.111.111 <--- 200 PORT Command successful.
111.111.111.111 ---> STOR INSTMSIA.EXE
ftp.smartftp.com <--- 150 File status okay; about to
open data connection.
111.111.111.111 <--- 150 Opening BINARY mode data
connection for INSTMSIA.EXE.
ftp.smartftp.com <--- 425 Timeout occurred while
waiting for PASV connection to be established [REF:
90D7D8D9494D]
---> ABOR
ftp.smartftp.com ---> PASV
111.111.111.111 <--- 426 Data connection closed,
receive file INSTMSIA.EXE aborted.
111.111.111.111 <--- 226 ABOR command successful.
ftp.smartftp.com <--- 227 Entering Passive Mode
(213,144,155,6,62,147)
ftp.smartftp.com ---> RETR INSTMSIA.EXE
111.111.111.111 ---> PORT 213,144,155,6,62,147
ftp.smartftp.com <--- 150 File status okay; about to
open data connection.
111.111.111.111 <--- 200 PORT Command successful.
111.111.111.111 ---> STOR INSTMSIA.EXE
111.111.111.111 <--- 150 Opening BINARY mode data
connection for INSTMSIA.EXE.
Interrupt
---> ABOR
---> ABOR
ftp.smartftp.com <--- 426 Abort initiated by control
connection [REF: D0162B0CF6D6]
111.111.111.111 <--- 426 Data connection closed,
receive file INSTMSIA.EXE aborted.
111.111.111.111 <--- 226 ABOR command successful.
ftp.smartftp.com <--- 226 ABOR command successful.
lftp :~> quit
ftp.smartftp.com ---> QUIT
ftp.smartftp.com ---- Closing control socket
111.111.111.111 ---> QUIT
111.111.111.111 ---- Closing control socket

[C:\Temp]


--- "Alexander V. Lukyanov" <[email protected]> wrote:
> On Fri, May 28, 2004 at 04:36:06AM -0700, Roboco
> Sanchez wrote:
> > Just tried lftp-3.0.5rc2. There is a new problem
> this
> > time. Please see the log below. Note that I must
> use
> > set ftp:fxp-passive-source no here. It works fine
> with
> > set ftp:ssl-protect-fxp yes but not with set
> > ftp:ssl-protect-fxp no.
> 
> Please try attached patch for rc2.
> 
> > As for FEAT, what is the standard between sending
> FEAT
> > before login and sending FEAT after login? If
> Raiden
> > doesn't conform the standard I can try asking
> them.
> 
> Yes. There are two problems:
>    1. FEAT should be allowed before login as it
> contains information about
>    AUTH command, which is used before login. I don't
> remember if it is in
>    some standard or draft, but it is common sense.
>    2. The code 500 should not be used to indicate
> impropriate use of command
>    before login. Instead, 530 should be used.
> 
> --
>    Alexander.
> > Index: ftpclass.cc
>
===================================================================
> RCS file: /home/lav/cvsroot/lftp/src/ftpclass.cc,v
> retrieving revision 1.328
> diff -u -p -r1.328 ftpclass.cc
> --- ftpclass.cc	28 May 2004 11:48:13 -0000	1.328
> +++ ftpclass.cc	28 May 2004 12:59:21 -0000
> @@ -280,6 +280,11 @@ void Ftp::NoFileCheck(int act)
>        SetError(NO_FILE,all_lines);
>        return;
>     }
> +   if(copy_mode!=COPY_NONE)
> +   {
> +      copy_failed=true;
> +      return;
> +   }
>     DataClose();
>     state=EOF_STATE;
>     eof=false;
> @@ -366,7 +371,7 @@ void Ftp::TransferCheck(int act)
>  	 real_pos=pos=p;
>        return;
>     }
> -   if(copy_mode!=COPY_NONE && act==425)
> +   if(copy_mode!=COPY_NONE && is4xx(act))
>     {
>        copy_passive=!copy_passive;
>        copy_failed=true;
> @@ -1859,7 +1864,7 @@ int   Ftp::Do()
>  	 ipv4_pasv:
>  #endif
>  #ifdef USE_SSL
> -	    if(copy_mode!=COPY_NONE && conn->prot=='P' &&
> !conn->sscn_on)
> +	    if(copy_mode!=COPY_NONE && conn->prot=='P' &&
> !conn->sscn_on && copy_ssl_connect)
>  	       conn->SendCmd("CPSV"); // same as PASV, but
> server does SSL_connect
>  	    else
>  #endif // note the following statement
> 



	
		
__________________________________
Do you Yahoo!?
Friends.  Fun.  Try the all-new Yahoo! Messenger.
http://messenger.yahoo.com/
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.