--- mimedefang.pl.in Mon Jan 5 15:37:38 2009 +++ mimedefang-KAM.pl.in Sat Oct 17 08:30:36 2009 @@ -525,6 +525,22 @@ $year + 1900, $mon+1, $mday, $hour, $min, $sec); } +#*********************************************************************** +# %PROCEDURE: short_time_str +# %ARGUMENTS: +# None +# %RETURNS: +# The current time in the form: "YYYY-MM-DD-HH" +# %DESCRIPTION: +# Returns a string representing the current date and hour +#*********************************************************************** +sub short_time_str () { + my($sec, $min, $hour, $mday, $mon, $year, $junk); + ($sec, $min, $hour, $mday, $mon, $year, $junk) = localtime(time()); + return sprintf("%04d-%02d-%02d-%02d", + $year + 1900, $mon+1, $mday, $hour); +} + no strict 'subs'; sub convert_log_facility_to_number ($) { my($facility) = @_; @@ -1298,10 +1314,27 @@ my($success) = 0; my($tm); $tm = time_str(); + my($short_tm); + $short_tm = short_time_str(); + $QuarantineSubdir = sprintf("%s/%s", + $Features{'Path:QUARANTINEDIR'}, $short_tm); + + #Create a subdir of the YYYY-MM-DD-HH to prevent a 32K limit for ext3 + unless (-d $QuarantineSubdir) { + if (mkdir($QuarantineSubdir, 0750)) { + $success = 1; + } + + if (!$success) { + $QuarantineSubdir = ""; + return ""; + } + } + do { $counter++; - $QuarantineSubdir = sprintf("%s/qdir-%s-%03d", - $Features{'Path:QUARANTINEDIR'}, $tm, $counter); + $QuarantineSubdir = sprintf("%s/%s/qdir-%s-%03d", + $Features{'Path:QUARANTINEDIR'}, $short_tm, $tm, $counter); if (mkdir($QuarantineSubdir, 0750)) { $success = 1; }