[Mimedefang] Bad, bad_filename filtering ?

alan premselaar alien at 12inch.com
Wed Oct 8 21:00:01 EDT 2003


On 10/9/03 8:39 AM, "James B. Huber" <jbh at JudahNet.com> wrote:

> Folks,
...snip... 
> First question, why are we checking anything of a
> "path" component in the bad_filename check ? Or perhaps
> better asked, why are we NOT calling the filename
> what comes after DIRSEP (either "/" or "¥" depending
> upon your *NIX/Dos) ?
> Any thoughts on how to go about getting the "last"
> component of the filename to use in this check ?
> 
Jim,

  you could look at the basename() function which should separate the path
from the filename.  although if i'm not mistaken, you can't specify the
DIRSEP character, so i think it'll only work for *NIX style pathnames.

you could also anchor your regex to the right by putting a $ in it after the
test for the extention to ensure that it's only checking for the last
occurance of the extension in the string.

hope this helps

alan




More information about the MIMEDefang mailing list