Problem listing files when server expects an asterisk in the path #5

Closed
bbigras opened this Issue Aug 24, 2011 · 4 comments

Projects

None yet

2 participants

@bbigras
Contributor
bbigras commented Aug 24, 2011

With tcpdump I didn't see the second ftp connection that should be used, if I remember correctly, to get the file listing.

Code :

ftp.auth(user, pass, function(err, res) {
    if (err) throw err;

    ftp.ls("/", function(err, data) {
        if (err) throw err;

        console.log("data", data);

        ftp.raw.quit(function(err, res) {
            if (err) throw err;

            console.log("FTP session finalized! See you soon!");
        });
    });
});

Captured data :

feat

220  FTP server (Hummingbird Ltd. (HCLFTPD) Version 7.0.0.0) ready.

500 'FEAT': command not understood.

user userName

331 Password required for userName.

pass password

230 User userName logged in.

stat /

502 STAT command not implemented.

type A

200 Type set to A.

pasv

227 Entering Passive Mode (10,1,10,11,10,217)

LIST /

150 Opening data connection for / (10.1.10.12,33571) (0 bytes).

quit

226 Transfer complete.

221 Goodbye.

stdout :

$ node app.js
FTP socket connected

feat
500 'FEAT': command not understood.

user userName
331 Password required for userName.

PASS ****
230 User userName logged in.

stat /
502 STAT command not implemented.

type A
200 Type set to A.

pasv
227 Entering Passive Mode (10,1,10,11,10,217)

LIST /
150 Opening data connection for / (10.1.10.12,33571) (0 bytes).
data []

quit
221 Goodbye.
FTP session finalized! See you soon!
Ftp socket closed its doors to the public.
@sergi
Owner
sergi commented Aug 24, 2011

Strange. Your server doesn't accept the FEAT command either, which
tells me me that it is a really old or simple one. The raw file
listing should also show up in your stdout. If you don't mind me
asking, is there the possibility that there aren't files in that
folder? If there are, would it be possible to use cyberduck or
filezilla client to connect to that server and send a copy of the raw
stdout that these programs give?

The server you are querying is a gold mine to find bugs :)

Thanks,

Sergi

On Wed, Aug 24, 2011 at 7:45 PM, brunoqc
reply@reply.github.com
wrote:

With tcpdump I didn't see the second ftp connection that should be used, if I remember correctly, to get the file listing.

Code :

   ftp.auth(user, pass, function(err, res) {
       if (err) throw err;

       ftp.ls("/", function(err, data) {
           if (err) throw err;

           console.log("data", data);

           ftp.raw.quit(function(err, res) {
               if (err) throw err;

               console.log("FTP session finalized! See you soon!");
           });
       });
   });

Captured data :

   feat

   220  FTP server (Hummingbird Ltd. (HCLFTPD) Version 7.0.0.0) ready.

   500 'FEAT': command not understood.

   user userName

   331 Password required for userName.

   pass password

   230 User userName logged in.

   stat /

   502 STAT command not implemented.

   type A

   200 Type set to A.

   pasv

   227 Entering Passive Mode (10,1,10,11,10,217)

   LIST /

   150 Opening data connection for / (10.1.10.12,33571) (0 bytes).

   quit

   226 Transfer complete.

   221 Goodbye.

stdout :

   $ node app.js
   FTP socket connected

   feat
   500 'FEAT': command not understood.

   user userName
   331 Password required for userName.

   PASS ****
   230 User userName logged in.

   stat /
   502 STAT command not implemented.

   type A
   200 Type set to A.

   pasv
   227 Entering Passive Mode (10,1,10,11,10,217)

   LIST /
   150 Opening data connection for / (10.1.10.12,33571) (0 bytes).
   data []

   quit
   221 Goodbye.
   FTP session finalized! See you soon!
   Ftp socket closed its doors to the public.

Reply to this email directly or view it on GitHub:
#5

@bbigras
Contributor
bbigras commented Aug 25, 2011

Indeed there was no files in this directory, I forgot that I was testing against a Windows ftp server, my bad.

With the correct path, I still don't see the second connection with jsftp.

I tried commenting the "ftp.raw.quit" part in case it killed the connection too fast but it only idled for a while.

I made it work by doing 'ftp.ls("C:*", ...'. but maybe it should use the 'CWD' trick like FileZilla does so the code would be the same for FTP servers that want an asterisk or not in the path.

FileZilla

220  FTP server (Hummingbird Ltd. (HCLFTPD) Version 7.0.0.0) ready.
USER userName
331 Password required for userName.
PASS password
120 User userName logged in.
CWD C:\
250 CWD command successful.
PWD
257 "C:\" is current directory.
TYPE I
200 Type set to I.
PASV
227 Entering Passive Mode (10,1,10,11,16,103)
LIST
150 Opening data connection for *.* (10.1.10.13,4170) (0 bytes).
226 Transfer complete.
221 You could at least say goodbye.

second connection

drwx------  1          user          group          0 May  2 08:06 dir1
-rwx------  1          user          group      26818 Jun  2  2008 file1

jsftp

feat
220  FTP server (Hummingbird Ltd. (HCLFTPD) Version 7.0.0.0) ready.
500 'FEAT': command not understood.
user userName
331 Password required for userName.
pass password
120 User userName logged in.
stat C:\
502 STAT command not implemented.
type A
200 Type set to A.
pasv
227 Entering Passive Mode (10,1,10,11,16,112)
LIST C:\
150 Opening data connection for C:\ (10.1.10.12,43527) (0 bytes).
quit
226 Transfer complete.
221 Goodbye.

code

ftp.auth(user, pass, function(err, res) {
    if (err) throw err;

    ftp.ls("C:\\", function(err, data) {
        if (err) throw err;

        console.log("data", data);

        ftp.raw.quit(function(err, res) {
            if (err) throw err;
            console.log("FTP session finalized! See you soon!");
        });
    });
});
@sergi
Owner
sergi commented Aug 26, 2011

0.1.3 improves compatibility with Windows. Can you try and tell me if you still have the problem?

@bbigras
Contributor
bbigras commented Aug 26, 2011

I still have to use an asterisk to make it work.

// works
ftp.ls("C:\\*", ...

// doesn't
ftp.ls("C:\\", ...
@sergi sergi closed this Jan 15, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment