Subject: Re: file server example

From: [email-masked] (David W. Tamkin)
Date: Tue, 11 Apr 1995 13:32:50 -0500 (CDT)

Jon Lewis asked,

| In the procmailex man page the simple file server example contains the 
| following line which is supposed to restrict requests to the fileserver 
| dir only.
| 
| * !^Subject: send file .*[/.]\.

| This looks for 'Subject: send file' "any char sequence other than newline" 
| and then / or . and fails the request if these things are found?
| 
| What does the final '\.' do? 

It represents a literal period.  The idea is to disallow these three strings:

<space><period>  # no dotfiles in the archive directory
<slash><period>  # no dotfiles in subdirectories of the archive directory
<period><period> # no ascent out of the archive directory

An earlier condition already disallows spaces in the file name or an initial
period (it requires that the first character be a letter, a digit, or an un-
derscore), so that takes care of <space><period>.  This extra condition re-
jects file names that contain <slash><period> or <period><period>.

| Wouldn't it be enough to just use:
|  
| * !^Subject: send file .*/

That would restrict file searches to the named archive directory and forbid
descent into its subdirectories, and further it would allow requesting
dotfiles from the archive directory.  If neither of those differences is a
problem, then yes, you could substitute that condition or the simpler equiv-
alent
  * !^Subject:.*/
since " send file " contains no slashes.