I have rtfm man pages for procmail, but please feel free to point
me to an FAQ or digest.
Among other things with procmail, I want to set up the capability
for non-ftp-capable users to fetch files from my ftp lib via email. I
wrote a recipe, which is INCLUDERC'd, based fairly closely on the recipe
for the "very simple fileserver" given on page 8 of man procmailex(5).
It is appended below my sig. Note that some variables are defined in
procmail code "above" this one.
Because I myself am sometimes a sloppy typist, I would like to give
others the same privilege. In particular, I want to allow more than one
space between keywords in the Subject: get file {whatever} line in
the requesting email header. The recipe below successfully allows more
than one space before the "get" and "file" keywords. However, if there
is not exactly one space between "file" and the filename, the recipe
fails and generates the following response by return email:
Date: Sun, 14 Apr 1996 11:58:28 -0400
From: "Paul O. Bartlett" <pobart(_at_)access(_dot_)digex(_dot_)net>
To: pobart(_at_)access(_dot_)digex(_dot_)net
Subject: Re: get file pgpkey
cat: ./: Is a directory
I admit that I am not a regexp guru. If anyone has any suggestions
for a fix, I will be grateful.
Second point. Some of the files in my ftp lib are binary, so this
receipe as it stands will not work for them. Is there a reasonable mod
to this code so that filenames ending in .exe, .com, .zip, .gif, or
.jpg will be automatically UUENCODEd?
Thanks very much.
Paul <pobart(_at_)access(_dot_)digex(_dot_)net>
----------------------------------------------------------
Paul O. Bartlett, P.O. Box 857, Vienna, VA 22183-0857, USA
Finger, keyserver, or WWW for PGP 2.6.2 public key
Home Page: URL: http://www.access.digex.net/~pobart
# ====================== getstuff.rc ======================
# ========== automatically send a specified file ==========
# Directory for files available by email
FTP_LIB=/ftp/pobart
# Turn on logging so we know if anyone is requesting files
VERBOSE=off
LOGABSTRACT=yes
# Whom did this mail come from
WHOFROM=`formail -xFrom:`
:0
* ^Subject: +get +file +[0-9A-Za-z]
* !^X-Loop: $MY_ADDR
* !^Subject:.*Re:
* !^FROM_DAEMON
* !^Precedence: *junk
* !^Subject: +get +file +.*[/.]\.
{
MAILDIR=$FTP_LIB # chdir to fileserver directory
:0 fhw # Reverse mailheader and extract name
* ^Subject: +get +file +\/[^ ]*
| formail -rA "X-Loop: $MY_ADDR"
FILE="$MATCH" # The requested filename
LOG=$WHOFROM # Log the requestor
:0 ah
| cat - ./$FILE 2>&1 | $SENDMAIL -oi -t
}
# Reset to our usual mail directory
MAILDIR=$DIRMAIL
# Reset logging to what it normally is for procmail
VERBOSE=$VERBOSITY
LOGABSTRACT=$LOGGING