628Part VRunning (Web design templates) Serverstmpfn = mktemp() tmpfh = open(tmpfn,
Monday, November 19th, 2007628Part VRunning Serverstmpfn = mktemp() tmpfh = open(tmpfn, w+b ) while True: rbuf = stdin.read(1024) if rbuf == : breaktmpfh.write(rbuf) tmpfh.close() vscan = popen( %s –no-summary –stdout –infected –mbox %s % (CLAMSCAN, tmpfn), r ) while True: rbuf = vscan.readline() if rbuf == : breakif rbuf.find( FOUND ): errors.append(rbuf[rbuf.find( : )+2:-1]) vscan.close() tmpfh = open(tmpfn, r ) if len(errors) > 0: while True: rbuf = tmpfh.readline() if rbuf == n : breakstdout.write(rbuf) for e in errors: stdout.write( X-Virus-Alert: %s in messagen % e) stdout.write( n ) while True: rbuf = tmpfh.read(1024) if rbuf == : breakstdout.write(rbuf) tmpfh.close() unlink(tmpfn) When called from maildropto process a message, this program will savethemessage to a temporary file that it scans using clamscan(which is partofthe ClamAV package). It then processes the output from clamscanto determine whether any viruses were found. Finally, it passes the messageback to maildrop, including a X-Virus-Alert header(as appropriate), andremoves the temporary file. 5.Set the permissions on clam-mailscanso that it can be executed byanyuser: # chmod 0755 /usr/local/sbin/clam-mailscan33_
Note: In case you are looking for affordable and reliable webhost to host and run your j2ee application check Vision J2ee Web Hosting services.