Hello, 

I reinstalled clamav from Debian repositories. By default, it runs as
clamav user. 

To have it working with courier-pythonfilter, I have done some
modifications to clamav.py: 

--- clamav.py.orig 2009-06-13 18:32:01.000000000 +0200
+++ clamav.py 2009-06-13 19:04:13.000000000 +0200
@@ -29,7 +29,11 @@
 import pyclamav
 def scanMessage(bodyFile, controlFileList):
 try:
- avresult = pyclamav.scanfile(bodyFile)
+ f = open(bodyFile, "rb")
+ mail_to_scan = f.read()
+ f.close()
+
+ avresult = pyclamav.scanthis(mail_to_scan)
 except Exception, e:
 return "554 " + str(e)
 if avresult[0]:
@@ -39,12 +43,16 @@
 import pyclamd
 def scanMessage(bodyFile, controlFileList):
 try:
+ f = open(bodyFile, "rb")
+ mail_to_scan = f.read()
+ f.close()
+
 pyclamd.init_unix_socket(localSocket)
- avresult = pyclamd.scan_file(bodyFile)
+ avresult = pyclamd.scan_stream(mail_to_scan)
 except Exception, e:
 return "554 " + str(e)
- if avresult != None and avresult.has_key(bodyFile):
- return
handleVirus(bodyFile, controlFileList, avresult[bodyFile])
+ if avresult != None and avresult.has_key('stream'):
+ return handleVirus(bodyFile, controlFileList, avresult['stream'])
 return '' 

HTH.
Jerome Blion.
------------------------------------------------------------------------------
Crystal Reports - New Free Runtime and 30 Day Trial
Check out the new simplified licensing option that enables unlimited
royalty-free distribution of the report engine for externally facing 
server and web deployment.
http://p.sf.net/sfu/businessobjects
_______________________________________________
courier-users mailing list
courier-users@lists.sourceforge.net
Unsubscribe: https://lists.sourceforge.net/lists/listinfo/courier-users

Reply via email to