[Mimedefang] FreeBSD 5.4, MD 2.54, and Quarantine Directories

David Nelson dave at itsdave.tv
Sat Jan 21 14:09:26 EST 2006


I don't know if this is the proper forum for this, but I'd like to make
a feature request for MD.

I ran into a problem quarantining messages on a FreeBSD 5.4 box.
Specifically, I hit the upper limit for the number of directories a
single directory can hold (32767).  I store about 2 weeks of quarantined
mail in case anything needs to be released and I average over 3000
quarantined messages daily.

The solution was to create 256 directories under MD-Quarantine (00-FF
inclusive), have get_quarantine_dir() randomly generate a number,
convert it to hex, and append it to $Features{'Path:QUARANTINEDIR'}.

get_quarantine_dir():

   my $HexSubdir = sprintf("%02X",rand(256));

   do {
      $counter++;
      $QuarantineSubdir =
sprintf("%s/%s/qdir-%s-%03d",$Features{'Path:QUARANTINEDIR'},$HexSubdir,
$tm,$counter);
      if (mkdir($QuarantineSubdir, 0750)) {
         $success = 1;
      }
   } while (!$success && ($tries++ < 1000));

I don't know if there's a more ''elegant'' way of doing it, but it does
take care of the problem.

Thanks!
-- Dave




More information about the MIMEDefang mailing list