Re: qmail file filter

From: ___cliff rayman___ (cliff@genwax.com)
Date: 10/10/01


Message-ID: <3BC37893.4475B189@spamless.genwax.com>
Date: Tue, 09 Oct 2001 15:22:11 -0700
From: ___cliff rayman___ <cliff@genwax.com>
To: Andrew Blogg <apblogg@bigpond.net.au>
Subject: Re: qmail file filter


Andrew Blogg wrote:

> ---snip---
>
> sub extcheck
> {

local $_;
chomp; #remove end of line on our local copy
# there may need to be some more cleanup here to
# make sure we have the filename and the filename only

>
> /.*.[Vv][Bb][Ss]/ && errormsg;
> /.*.[Cc][Oo][Mm]/ && errormsg;
> /.*.[Ee][Xx][Ee]/ && errormsg;
> /.*.[Cc][Hh][Mm]/ && errormsg;
> /.*.[Ss][Cc][Rr]/ && errormsg;
> /.*.[Hh][Tt][Aa]/ && errormsg;
> /.*.[Vv][Bb][Ee]/ && errormsg;
> /.*.[Ss][Hh][Ss]/ && errormsg;
> /.*.[Bb][Aa][Tt]/ && errormsg;
> };

i think these should be in the form of /.*\.vbs$/i && errormsg;
the \. means a period and not just any character
the $ at the end anchors the pattern at the end
the /i modifier is not that important, just clearer, since you do not have to
give an alternation for each character.

the regex's that you are using cause any filename that has at least
one character followed by any of those three characters to get a warning
message. so a filename of "welcome.gif" would get a warning message
because of the 'com' preceded by at least one character in the name.

--
___cliff rayman___cliff@genwax.com___http://www.genwax.com/



Relevant Pages

  • [TOMOYO #16 18/25] TOMOYO: Add utility functions.
    ... * @c: The character to check. ... Pointer to pointer to the string. ... * @filename: The pathname to check. ... * @domainname: The domainname to check. ...
    (Linux-Kernel)
  • Re: UTF-8 problem with NTFS support?
    ... Typically this would mean a non-UTF8 filename but please see below. ... Invalid or incomplete multibyte or wide character ... corrupted disk sectors. ...
    (Fedora)
  • Re: Regex question
    ... First, if you're using character sets, there's no need to use a or in there. ... This will capture all directories until it can no longer find a trailing slash. ... It will capture any chracter that isn't a singel or double quote. ... The last would even be optional as it's already caught by the filename expression. ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: Could not bulk insert. File does not exist
    ... Is there any chance what you think is a space character before ... Operating system error code 123(The filename, directory name, or volume ... > @sampleSourceTypeKey INT, ... > WHERE SampleSourceKey IS NULL ...
    (microsoft.public.sqlserver.programming)
  • Re: Alternatives to CreateFile for getting a file handle?
    ... saved a filename that included the invalid character "?". ... Note that Windows EXplorer displays the filename without the "?", ... the CreateFile fails even tho we know the file is there. ...
    (microsoft.public.vb.winapi)