[Mimedefang] a whacky problem with my filter...

alan premselaar alien at 12inch.com
Thu Mar 27 05:15:01 EST 2003


hey guys, 

So, i just experienced something strange here at work. some people trying to
send .txt files to customers were having the files rejected due to the
following rule in my filter:



   return 1 if re_match($entity, '\.(ade|adp|bas|bat|chm|cmd|com|cpl|crt|' .
                                 'dll|exe|hlp|hta|inf|ini|ins|isp|js|jse|' .
                                 'lib|lnk|mdb|mde|msc|msi|msp|mst|ocx|pcd|'
.
                                 'pif|reg|scr|sct|shb|shs|sys|url|vb|vbe|' .
                                 'vbs|vxd|wsc|wsf|wsh)');


the problem wasn't that they were sending any files of these types, but that
the filesnames were in japanese.  in one case, the filename was "190x40" +
<japanese text> + .com + <more japanese text> + .txt


Mime type  : text/plain
File name   : 190×40【るるぶ.comトップMバナー】.txt

and another file didn't have any ".com" or any other match but was:

Mime type  : application/octet-stream
File name   : キューピッド様 配信報告03.03.27.lzh

(sorry for those of you who don't have japanese text, i'm actually hoping
that something obvious shows up in the non-encoded text that could point to
what the problem might be)


the reason i'm writing this to the list is because a) I don't have a lot of
experience dealing with 2-byte character encoding on a programming level,
and b) because re_match() is part of mimedefang, i'm hoping that someone on
the list can offer some insight as to what might be going on, or how i can
re-write this test more appropriately.

for the time being, i've added a switch to the test and turned it off (so
it's being bypassed) since our employees and customers have a need to send
files with japanese filenames. (which is reasonable, since i'm in japan)
however, i'd really like to have this test operational in order to catch the
evil stuff.

thanks in advance for any and all assistance.

alan

P.S. i'm running MD 2.30 and a slightly modified version of the
linuxorg/mimedefang/filter found in the MD source distribution.




More information about the MIMEDefang mailing list