This commit was manufactured by cvs2svn to create tag 'milter-0_8_1'.
Sprout from bmsi 2005-05-31 18:23:49 UTC Stuart Gathman <stuart@gathman.org> 'Development changes since 0.7.2' Cherrypick from master 2005-06-17 02:23:34 UTC Stuart Gathman <stuart@gathman.org> 'Release 0.8.1': COPYING MANIFEST.in Milter/__init__.py Milter/dsn.py Milter/dynip.py NEWS TODO bms.py faq.html milter.cfg milter.html milter.spec miltermodule.c mime.py setup.cfg setup.py softfail.txt spf.py spfquery.py strike3.txt test/zip1 test/ziploop testmime.py
This commit is contained in:
+19
-2
@@ -1,4 +1,10 @@
|
||||
# $Log$
|
||||
# Revision 1.2 2005/06/02 15:00:17 customdesigned
|
||||
# Configure banned extensions. Scan zipfile option with test case.
|
||||
#
|
||||
# Revision 1.1.1.2 2005/05/31 18:23:49 customdesigned
|
||||
# Development changes since 0.7.2
|
||||
#
|
||||
# Revision 1.23 2005/02/11 18:34:14 stuart
|
||||
# Handle garbage after quote in boundary.
|
||||
#
|
||||
@@ -63,7 +69,7 @@ class MimeTestCase(unittest.TestCase):
|
||||
def testDefang(self,vname='virus1',part=1,
|
||||
fname='LOVE-LETTER-FOR-YOU.TXT.vbs'):
|
||||
msg = mime.message_from_file(open('test/'+vname,"r"))
|
||||
mime.defang(msg)
|
||||
mime.defang(msg,scan_zip=True)
|
||||
self.failUnless(msg.ismodified(),"virus not removed")
|
||||
oname = vname + '.out'
|
||||
msg.dump(open('test/'+oname,"w"))
|
||||
@@ -71,7 +77,8 @@ class MimeTestCase(unittest.TestCase):
|
||||
txt2 = msg.get_payload()
|
||||
if type(txt2) == list:
|
||||
txt2 = txt2[part].get_payload()
|
||||
self.failUnless(txt2.rstrip()+'\n' == mime.virus_msg % (fname,hostname,None),txt2)
|
||||
self.failUnless(
|
||||
txt2.rstrip()+'\n' == mime.virus_msg % (fname,hostname,None),txt2)
|
||||
|
||||
def testDefang3(self):
|
||||
self.testDefang('virus3',0,'READER_DIGEST_LETTER.TXT.pif')
|
||||
@@ -121,6 +128,14 @@ class MimeTestCase(unittest.TestCase):
|
||||
name = parts[1].getname()
|
||||
self.failUnless(name == "Jim&amp;Girlz.jpg","name=%s"%name)
|
||||
|
||||
def testZip(self,vname="zip1",fname='zip.zip'):
|
||||
self.testDefang(vname,1,'zip.zip')
|
||||
msg = mime.message_from_file(open('test/'+vname,"r"))
|
||||
mime.defang(msg,scan_zip=False)
|
||||
self.failIf(msg.ismodified())
|
||||
# test zip within zip
|
||||
self.testDefang('ziploop',1,'stuart@bmsi.com.zip')
|
||||
|
||||
def testHTML(self,fname=""):
|
||||
result = StringIO.StringIO()
|
||||
filter = mime.HTMLScriptFilter(result)
|
||||
@@ -143,3 +158,5 @@ if __name__ == '__main__':
|
||||
for fname in sys.argv[1:]:
|
||||
fp = open(fname,'r')
|
||||
msg = mime.message_from_file(fp)
|
||||
mime.defang(msg,scan_zip=True)
|
||||
print msg.as_string()
|
||||
|
||||
Reference in New Issue
Block a user