Subject: Re: FTP client does improper use of NLST primitive ???
To: Brian Stark <bstark@siemens-psc.com>
From: Robert Elz <kre@munnari.OZ.AU>
List: netbsd-help
Date: 12/20/1998 14:45:55
    Date:        Sat, 19 Dec 1998 20:58:45 -0600 (CST)
    From:        Brian Stark <bstark@siemens-psc.com>
    Message-ID:  <Pine.A41.4.05.9812192052510.48818-100000@possum.empros.com>

  | I've got two questions: What is the "NLST primitive" in our ftp program

NLST is the ftp command intended to generate lists of files in a directory
for use with commands like "mget" (so the server can find out which files
are available and select the ones it wants to fetch, or whatever).

  | and is there really a problem with the "NLST primitive" in NetBSD 1.3.2?

NetBSD's ftp client uses NLST to get user directory listings, which isn't
what NLST is meant for.   That is, you issue a "ls" command, and the client
sends NLST.   When you issue "ls -lrt" the client sends "NLST -lrt" which
is truly bogus.   The command intended to get directory listings is LIST
not NLST.

  | I got the following message from ftp.funet.fi the other day (BTW, that
  | server also gives the same message when I connect from an AIX 4.2.1
  | workstation):

Ancient BSD ftp commands started using NLST for ls - that's because the
server always answered LIST with a "ls -l" equivalent, and they wanted
a way to get just the file names (the equivalent of a "ls" command with
no options).

Unfortunately, the ftp protocol simply has never provided that kind of
functionality (it is coming soon).   That is, the only functionality for
user type directory listings has left it entirely to the server to define
exactly what data is returned, and in what format.   You can't ask (in any
standard way) for just names, or names plus extra sate, etc.   That is
what is being fixed (extra commands are being added to the protocol).

  | ftp> ls -lrt
  | 150 Opening ASCII mode data connection for -lrt.

When the client sends "NLST -lrt" (which is what happens there) what should
hapen is that you would get a listing of the files in the directorty "-lrt".
It is only because the server simply exec's /bin/ls and hands it the arg that
you gave that this works as it does.   Other servers that implement the
directory listing internally (don't exec ls) or which aren't unix won't
do what you expect at all.

kre