~ubuntu-branches/ubuntu/raring/clamav/raring

« back to all changes in this revision

Viewing changes to contrib/cleanup-partial.pl

  • Committer: Bazaar Package Importer
  • Author(s): Stephen Gran
  • Date: 2008-09-05 17:25:34 UTC
  • mfrom: (0.35.1 lenny)
  • Revision ID: james.westby@ubuntu.com-20080905172534-yi3f8fkye1o7u1r3
* New upstream version (closes: #497662, #497773)
  - lots of new options for clamd.conf
  - fixes CVEs CVE-2008-3912, CVE-2008-3913, CVE-2008-3914, and
    CVE-2008-1389
* No longer supports --unzip option, so typo is gone (closes: #496276)
* Translations:
  - sv (thanks Martin Bagge <brother@bsnet.se>) (closes: #491760)

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#!/usr/bin/perl
 
2
 
 
3
# ---- Settings ----
 
4
# TemporaryDirectory in clamd.conf
 
5
my $TMPDIR='/tmp';
 
6
# How long to wait for next part of RFC1341 message (seconds)
 
7
my $cleanup_interval=3600;
 
8
 
 
9
# ---- End of Settings ----
 
10
 
 
11
my $partial_dir = "$TMPDIR/clamav-partial";
 
12
#  if there is no partial directory, nothing to clean up
 
13
opendir(DIR, $partial_dir) || exit 0;
 
14
 
 
15
my $cleanup_threshold = time - $cleanup_interval;
 
16
while(my $file = readdir(DIR)) {
 
17
        next unless $file =~ m/^clamav-partial-([0-9]+)_[0-9a-f]{32}-[0-9]+$/;
 
18
        my $filetime = $1;
 
19
        unlink "$partial_dir/$file" unless $filetime > $cleanup_threshold;
 
20
}
 
21
closedir DIR;