Subject: How to enable 'site exec index' on Redhat5.2

From: "Cai, Xuejun" <[email-masked]>
Date: Sun, 28 Feb 1999 22:17:07 +0800 (CST)

Hi, list

My users want to use the 'site exec index' command to locate file. But I
can't find answers from FAQ the list's archive. What need I do in server
side to enable this function?

Thanks in advance!

Cai Xuejun

|=================================================
| Cai, Xuejun
| Tel: (+86-10) 68236038(o) 68244467(h)
! http://alpha01.ihep.ac.cn/~caixj
| Public PGP key:
|    http://alpha01.ihep.ac.cn/~caixj/DSSkey.txt
|=================================================

---

From: Gregory A Lundberg <[email-masked]>
Date: Sun, 28 Feb 1999 10:45:55 -0500 (EST)

On Sun, 28 Feb 1999, Cai, Xuejun wrote:

> My users want to use the 'site exec index' command to locate file. But
> I can't find answers from FAQ the list's archive. What need I do in
> server side to enable this function?

First off, let me say that the SITE EXEC feature has marginal usefullness.
I rather doubt, once you get it working, that it'll do what your customers
expect.

The short syntax for index is 'SITE INDEX <parameters>'.  The meaning of
<parameters> is undefined since the prorgam 'index' is undefined.  This is
a legacy from WUarchive, the comment in the code says "this is just for
backward compatibility since we thought of INDEX before we thought of
EXEC."  Internally, the daemon converts this to a SITE EXEC.

The syntax for SITE EXEC is 'SITE EXEC <program>[ <parameters>]'.  Note
that the SPACE (' ') character between <program> and <parameters> is
REQUIRED if <parameters> is present.

The daemon parses <program> to remove _all_ pathname components, if any,
leaving just the name of the program file.  For instance, if you say "SITE
EXEC /bin/ls" the daemon will use only the 'ls' and ignore '/bin/'.  This
is an important point, read on ...

The daemon then inserts the _PATH_EXECPATH and a slash ('/') BEFORE this
program name.  On most systems (NB.: NOT ON REDHAT Linux) _PATH_EXECPATH
is /bin/ftp-exec .  The value is set in src/pathnames.h .. Redhat, for
some vague reason having to do with local naming conventions has choosen
to quietly move this to /usr/bin/ftp-exec (of course nobody notices
because nobody uses SITE EXEC anyway).

It then parses the <parameters> into an arg array and attempts to execute
the command.  So, on most systems, the following command

  SITE EXEC /bin/ls

is similar to executing the following (users chroot to /home/users on my
systems ...)

  chroot /home/users /bin/ftp-exec/ls

or, on Redhat Linux

  chroot /home/users /usr/bin/ftp-exec/ls

remembering when you do this you're root (the remote user won't be) and
your environment is full of stuff (the remote user's will be empty).

Now then, a few final points:

 - on most text-based ftp client you need to add 'quote' before the
   SITE command to tell the client to send it literally as typed.  Most
   window-based clients (specifically, web browsers) do not have any way
   to type random commands like this.

 - you cannot provide any input to the program except on the command line

 - output from the program is returned to the remote user via the CONTROL
   connection.  If the user used a hyphen before their password, they
   won't see it because it's extended output the hyphen tells the daemon
   to suppress.  Also, if the user is NOT using a text-based FTP client,
   they probably won't see the output anyway because most web browsers
   (well, IE at least, I'm sure a Netscape user will correct me) simply
   don't bother to show it.

 - the output sent over the control connection is truncated.  The default
   is to chop off the output after 20 lines (1000 lines on Redhat).  The
   VR versions include the 'site-exec-max-lines' clause which allows you
   to determine where truncation occurs, if at all.

 - I can think of some very good reasons to use SITE EXEC but know of no
   sites which use it for those reasons.  In fact, I'd be surprised if
   more than a few dozen sites out of the millions running wu-ftpd even
   use it at all.

-- 

Gregory A Lundberg              Senior Partner, VRnet Company
1441 Elmdale Drive              [email-masked]
Kettering, OH 45409-1615 USA    1-800-809-2195