[Mimedefang] Bad, bad_filename filtering ?

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


On 10/9/03 10:15 AM, "James B. Huber" <jbh at genesis-net.net> wrote:

> Thanks Alan,
> However that is what the both the "default" recommended
> and linux.org mimedefang-filter modules do. The code
> looks like this (Pardon the long line):
>   $bad_exts =
> '(ade|adp|app|asd|asf|asx|bas|bat|chm|cmd|com|cpl|crt|dll|exe|fxp|hlp|hta|hto|
> inf|ini|ins|isp|jse?|lib|lnk|mdb|mde|msc|msi|msp|mst|ocx|pcd|pif|prg|reg|scr|s
> ct|sh|shb|shs|sys|url|vb|vbe|vbs|vcs|vxd|wmd|wms|wmz|wsc|wsf|wsh|¥{[^¥}]+¥})';
>   # Do not allow:
>   # - CLSIDs  {foobarbaz}
>   # - bad extensions (possibly with trailing dots) at end or
>   #   followed by non-alphanum
>   $re = '¥.' . $bad_exts . '¥.*([^-A-Za-z0-9_.,]|$)';

try removing the | from the line above just before the $, and put the $ on
the outside of the () grouping.  i'm not sure off the top of my head, but i
suspect that will do what you expect it to do.


also, if your intention is to say (in your grouping) "any character that is
not a = A-z 0-9 _ . ,     then you might need to escape the - (i.e. ¥-) as
it has obvious special meaning (as seen in A-Za-z0-9) and also might be
getting confused.  although again, that's off the top of my head and i'm not
sure if i'm right about that.

hope this helps

alan




More information about the MIMEDefang mailing list