[Mimedefang] Race Condition Creating Quarantine Dir

Kevin A. McGrail kmcgrail at pccc.com
Fri Nov 6 15:16:37 EST 2009


Today, I had an issue where two slaves tried to create the same quarantine 
sub dir at the same time using the 32K limit patch I posted a while back.

Anyway, if you are also hitting that 32K Quarantine Limit, here's a second 
patch where I've added some logs for errors when creating the Quarantine 
Directories and tried to allocate for the race condition we believe caused 
the issue.

From: 
http://www.peregrinehw.com/downloads/MIMEDefang/contrib/get_quarantine_dir_fix_for_32000_limit_patch_2.67-part2

And speaking of which, is anyone else also being as hammered with phishing 
zip files attached to emails?

regards,
KAM

--- mimedefang-2.67/mimedefang.pl.in    Fri Nov  6 13:26:23 2009
+++ mimedefang-2.67-KAM/mimedefang.pl.in        Fri Nov  6 13:25:05 2009
@@ -1326,8 +1326,14 @@
         }

         if (!$success) {
-            $QuarantineSubdir = "";
-            return "";
+            md_syslog('err', "$MsgID: Error creating quarantine directory 
[$QuarantineSubdir] '$!'");
+            #Due to race conditions where two slaves can try and create the 
same dir, we can check to see if it has been created again
+            if ($! =~ /File exists/i && -d $QuarantineSubdir) {
+              #NOTHING
+            } else {
+              $QuarantineSubdir = "";
+              return "";
+            }
         }
     }

@@ -1340,6 +1346,7 @@:
        }
     } while(!$success && ($tries++ < 1000));
     if (!$success) {
+        md_syslog('err', "$MsgID: Error creating quarantine directory 
[$QuarantineSubdir] '$!'");
        $QuarantineSubdir = "";
        return "";
     } 




More information about the MIMEDefang mailing list