[Mimedefang] That .com extension

Joseph Brennan brennan at columbia.edu
Wed Jan 4 08:38:00 EST 2006



--On Tuesday, January 3, 2006 21:23 -0500 "Kevin A. McGrail" 
<kmcgrail at pccc.com> wrote:

> I just tested by renaming a gif to .com.txt and sending it to myself and
> it worked fine.  Can you post your filter_bad_filename?
>
> ----- Original Message -----
> From: "Joseph Brennan" <brennan at columbia.edu>
>
>> An attachment with this name was snagged as an executable by the
>> example filter_bad_filename routine:
>>
>> WSJ.com - Cutting Hedge_ Law Firm Grows With Funds.pdf



The space after ".com" might be the significant factor.  Here 'tis:


# This procedure returns true for entities with bad filenames.
sub filter_bad_filename ($) {
    my($entity) = @_;
    my($bad_exts, $re);

    # Bad extensions
    # List updated 8/27/03 to conform to MS Office 2003 list at 
microsoft.com
    # except inf removed (used for OCLC library-related data mailings)
    $bad_exts = 
'(ade|adp|app|bas|bat|chm|cmd|com|cpl|crt|csh|dll|exe|fxp|hlp|h\
ta|ini|ins|isp|jse?|ksh|lib|lnk|mda|mdb|mde|mdt|mdw|msc|msi|msp|mst|ocx|ops|pcd\
|pif|prg|reg|scr|sct|shb|shs|sys|upx|vb|vbe|vbs|wsc|wsf|wsh|xsl|\{[^\}]+\})';

    # Do not allow:
    # - CLSIDs  {foobarbaz}
    # - bad extensions (possibly with trailing dots) at end
    # added ] and / to the list, to stop catching urls for dot-coms
    $re = '\.' . $bad_exts . '\.*$';
    return re_match($entity, $re);
}


Joseph Brennan      postmaster at columbia.edu
Columbia University in the City of New York








More information about the MIMEDefang mailing list