[links-list] Another connect problem

Brent Cook busterb at mail.utexas.edu
Sun Jan 28 11:02:08 PST 2001


> >Yes, same thing with links .94. Maybe check with ncftp what sorts of
> >messages the ftp server sends - it may be broken.
>
> Was this a generic comment, or is there some debugging
> facility in ncftp?
> In fact I don't know anything about all those protocols so usually
> I hope that someone with deeper knowledge would check on this ... :-)

Hi,
  This is my first time looking at the FTP protocol too, even though I
suggested you do it, here's what I found:

  ncftp has a debug facility that displays all of the messages between the
FTP server and the client. I must say that FTP is an interesting protocol,
full of little messages and strange commands. It's got to be pretty old,
right? Anyway, I connected to both ftp.freesoftware.com and your broken
ftp server with ncftp and looked at the messages.

-- begin paste --

ncftp> debug 1
ncftp> open ftp://ftp.nag.co.uk/sc22wg5/N1101-N1150/N1122
> open ftp://ftp.nag.co.uk/sc22wg5/N1101-N1150/N1122

Remote server is running Microsoft FTP Service.

extweb Microsoft FTP Service (Version 4.0).
220: extweb Microsoft FTP Service (Version 4.0).
Connected to 62.232.54.242.
Cmd: USER anonymous
331: Anonymous access allowed, send identity (e-mail name) as password.
Cmd: PASS busterb at lisa.lithuania

Anonymous user logged in.
230: Anonymous user logged in.
Cmd: PWD
257: "/" is current directory.
Logged in to 62.232.54.242 as anonymous.
Cmd: FEAT
500: 'FEAT': command not understood
Logged in to ftp.nag.co.uk.
Cmd: CLNT NcFTP 3.0.1 linux-x86
500: 'CLNT NcFTP 3.0.1 linux-x86': command not understood
Cmd: CWD sc22wg5
250: CWD command successful.
Cmd: CWD N1101-N1150
250: CWD command successful.
Cmd: CWD N1122
250: CWD command successful.
Cmd: PWD
257: "/sc22wg5/N1101-N1150/N1122" is current directory.
Current remote directory is /sc22wg5/N1101-N1150/N1122.

ncftp / > open ftp.slackware.com
> open ftp.slackware.com

Cmd: QUIT
221: Goodbye!
Connecting to 216.66.64.162...
sourcerer.freesoftware.com FTP server (Version DG-4.0.62 974200128) ready.
220: sourcerer.freesoftware.com FTP server (Version DG-4.0.62 974200128) ready.
Connected to 216.66.64.162.
Cmd: USER anonymous
331: Guest login ok, send your email address as password.
Cmd: PASS busterb at lisa.lithuania

Welcome to ftp.freesoftware.com - home FTP site for Walnut Creek CDROM.
There are currently 803 users out of 5000 possible.
  < rest of login message deleted for brevity >

Cmd: PWD
257: "/" is current directory.
Logged in to 216.66.64.162 as anonymous.
Cmd: FEAT
500: 'FEAT': command not understood.
Logged in to ftp.slackware.com.
Cmd: CLNT NcFTP 3.0.1 linux-x86
500: 'CLNT NcFTP 3.0.1 linux-x86': command not understood.
ncftp / > cd pub/
> cd pub/

Cmd: CWD pub
250: CWD command successful.
Cmd: PWD
257: "/pub" is current directory.
ncftp /pub >

-- end paste --

An FTP novice like myself was able to follow this session without even
looking at the RFC (wherever it may be), and noticed one difference
between the way the two servers responded. After a "PWD" command,
ftp.nag.co.uk returns _two_ lines, the one starting with 257: and the one
that looks like a plain comment, but ftp.freesoftware.com returns only
one, just a 257:. So, by that observation, Links is unable to handle a
second (or maybe more) line after the PWD command. It looks like most of
the other numerical responses allow multiple lined responses.

But it gets better. Perusing the source in Links for ftp.c, I found that
it doesn't even _use_ the PWD command, but only the LIST command. So,
here's the output for ftp.nag.co.uk:

ncftp / > ls
> ls

Cmd: PASV
227: Entering Passive Mode (62,232,54,242,8,6).
Cmd: LIST
125: Data connection already open; Transfer starting.
226: Transfer complete.
Remote listing contents {
    10-31-00  09:26AM       <DIR>          FTN90
    01-24-01  04:50PM       <DIR>          pub
    11-13-00  01:32PM       <DIR>          sc22wg5
}
FTN90/    pub/      sc22wg5/
FTN90/    pub/      sc22wg5/

and for ftp.freesoftware.com:

ncftp / > ls
> ls

Cmd: PASV
227: Entering Passive Mode (216,66,64,162,78,134)
Cmd: LIST
150: Opening ASCII mode data connection for 'file list'.
226: Transfer complete.
Remote listing contents {
    total 137605
    -r--r--r--  1 root  wheel        424 Feb 28  2000 README
    drwxr-xr-x  2 root  wheel        512 Feb 10  2000 archive-info
    drwxr-xr-x  2 root  wheel        512 Jul  5  2000 etc
    -rw-r--r--  1 root  wheel  124317906 Jan 28 13:27 ls-lR
    -rw-r--r--  1 root  wheel   16584531 Jan 28 13:28 ls-lR.gz
    drwxr-xr-x  2 root  wheel       1024 Nov 11 03:48 pub
}
README         archive-info/  etc/           ls-lR          ls-lR.gz
pub/
README         archive-info/  etc/           ls-lR          ls-lR.gz
pub/

Hmm! Things look quite a bit different, especially in the Remote listing
contents {} section. I took a look at the ftp_process_dirlist() function
in ftp.c, and it seems to expect a more unix-like listing. It checks for a
'd' at the beginning of a line to see if it's a directory for one thing.
I couldn't see how the rest of it works - it's a little confusing with no
comments and seven goto lines. Maybe the nag server is right, maybe it's
wrong, but Links definitely can't process a Windows directory listing properly.

Sorry this is so long. - Brent


_______________________________________________
links-list mailing list
links-list at appwatch.com
http://mailman.appwatch.com/listinfo/links-list



More information about the links-list mailing list